• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Flags: --allow-natives-syntax --use-osr --turbo-osr
6
7function mod() {
8  function f0() {
9    for (var i = 0; i < 3; i = i + 1 | 0) {
10      %OptimizeOsr();
11    }
12    return {blah: i};
13  }
14
15  function f1(a) {
16    for (var i = 0; i < 3; i = i + 1 | 0) {
17      %OptimizeOsr();
18    }
19    return {blah: i};
20  }
21
22  function f2(a,b) {
23    for (var i = 0; i < 3; i = i + 1 | 0) {
24      %OptimizeOsr();
25    }
26    return {blah: i};
27  }
28
29  function f3(a,b,c) {
30    for (var i = 0; i < 3; i = i + 1 | 0) {
31      %OptimizeOsr();
32    }
33    return {blah: i};
34  }
35
36  function f4(a,b,c,d) {
37    for (var i = 0; i < 3; i = i + 1 | 0) {
38      %OptimizeOsr();
39    }
40    return {blah: i};
41  }
42
43  function bar() {
44    assertEquals(3, f0().blah);
45    assertEquals(3, f1(1).blah);
46    assertEquals(3, f2(1,2).blah);
47    assertEquals(3, f3(1,2,3).blah);
48    assertEquals(3, f4(1,2,3,4).blah);
49  }
50  bar();
51}
52
53
54mod();
55mod();
56mod();
57