]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/get-argument-by-val-in-inlined-varargs-call-out-of-bounds.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / get-argument-by-val-in-inlined-varargs-call-out-of-bounds.js
CommitLineData
ed1e77d3
A
1var gi;
2
3function foo() {
4 return arguments[gi];
5}
6
7function bar(array, i) {
8 gi = i;
9 return foo.apply(this, array);
10}
11
12noInline(bar);
13
14var bigArray = [];
15for (var i = 0; i < 50; ++i)
16 bigArray.push(42);
17
18for (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
25for (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}