Debian Codegraph @

js/src/jit-test/tests/arguments/inline-arguments-escaped-slice-4.js

raw
1 // |jit-test| --fast-warmup
2
3 function foo(args) {
4 with ({}) {}
5 return args.length;
6 }
7
8 function inner() {
9 return arguments;
10 }
11
12 function outer0() {
13 trialInline();
14 var args = Array.prototype.slice.call(inner(), 1, 3);
15 return foo(args);
16 }
17
18 function outer1() {
19 trialInline();
20 var args = Array.prototype.slice.call(inner(1), 1, 3);
21 return foo(args);
22 }
23
24 function outer2() {
25 trialInline();
26 var args = Array.prototype.slice.call(inner(1, 2), 1, 3);
27 return foo(args);
28 }
29
30 function outer3() {
31 trialInline();
32 var args = Array.prototype.slice.call(inner(1, 2, 3), 1, 3);
33 return foo(args);
34 }
35
36 function outer4() {
37 trialInline();
38 var args = Array.prototype.slice.call(inner(1, 2, 3, 4), 1, 3);
39 return foo(args);
40 }
41
42 with ({}) {}
43
44 for (var i = 0; i < 50; i++) {
45 assertEq(outer0(), 0);
46 assertEq(outer1(), 0);
47 assertEq(outer2(), 1);
48 assertEq(outer3(), 2);
49 assertEq(outer4(), 2);
50 }