]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/get-my-argument-by-val-inlined-no-formal-parameters.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / get-my-argument-by-val-inlined-no-formal-parameters.js
1 var index;
2
3 function foo() {
4 if (index >= 0)
5 return arguments[index];
6 else
7 return 13;
8 }
9
10 function bar() {
11 return foo();
12 }
13
14 noInline(bar);
15
16 for (var i = 0; i < 100; ++i) {
17 index = i & 1;
18 var result = foo(42, 53);
19 if (result != [42, 53][index])
20 throw "Error: bad result in first loop: " + result;
21 }
22
23 for (var i = 0; i < 100000; ++i) {
24 index = -(i & 1) - 1;
25 var result = bar();
26 if (result !== 13)
27 throw "Error: bad result in second loop: " + result;
28 }
29
30 index = 0;
31 var result = bar();
32 if (result !== void 0)
33 throw "Error: bad result at end: " + result;