]>
Commit | Line | Data |
---|---|---|
ed1e77d3 A |
1 | var gi; |
2 | ||
3 | function foo() { | |
4 | return arguments[gi]; | |
5 | } | |
6 | ||
7 | function bar(array, i) { | |
8 | gi = i; | |
9 | return foo.apply(this, array); | |
10 | } | |
11 | ||
12 | noInline(bar); | |
13 | ||
14 | var bigArray = []; | |
15 | for (var i = 0; i < 50; ++i) | |
16 | bigArray.push(42); | |
17 | ||
18 | for (var i = 0; i < 10000; ++i) { | |
19 | var mi = i % 50; | |
20 | var result = bar(bigArray, mi); | |
21 | if (result !== 42) | |
22 | throw "Bad result in first loop: " + result + "; expected: " + 42; | |
23 | } | |
24 | ||
25 | for (var i = 0; i < 10000; ++i) { | |
26 | var mi = i % 100; | |
27 | var result = bar([42], mi); | |
28 | var expected = mi ? void 0 : 42; | |
29 | if (result !== expected) | |
30 | throw "Bad result in second loop: " + result + "; expected: " + expected; | |
31 | } |