]> git.saurik.com Git - apple/javascriptcore.git/blame_incremental - tests/stress/get-argument-by-val-safe-in-inlined-varargs-call-out-of-bounds.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / get-argument-by-val-safe-in-inlined-varargs-call-out-of-bounds.js
... / ...
CommitLineData
1var gi;
2
3function foo() {
4 if (!effectful42())
5 arguments = "hello";
6 return arguments[gi];
7}
8
9function bar(array, i) {
10 gi = i;
11 return foo.apply(this, array);
12}
13
14noInline(bar);
15
16var bigArray = [];
17for (var i = 0; i < 50; ++i)
18 bigArray.push(42);
19
20for (var i = 0; i < 10000; ++i) {
21 var mi = i % 50;
22 var result = bar(bigArray, mi);
23 if (result !== 42)
24 throw "Bad result in first loop: " + result + "; expected: " + 42;
25}
26
27
28for (var i = 0; i < 10000; ++i) {
29 var mi = i % 100;
30 var result = bar([42], mi);
31 var expected = mi ? void 0 : 42;
32 if (result !== expected)
33 throw "Bad result in second loop: " + result + "; expected: " + expected;
34}
35