]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/ftl-get-my-argument-by-val-inlined-and-not-inlined.js
JavaScriptCore-7600.1.4.9.tar.gz
[apple/javascriptcore.git] / tests / stress / ftl-get-my-argument-by-val-inlined-and-not-inlined.js
1 function foo(i) {
2 return arguments[i];
3 }
4
5 function bar(i) {
6 return [arguments[i], foo(i, "one", 2, "three"), arguments[i]];
7 }
8
9 noInline(bar);
10
11 function arraycmp(a, b) {
12 if (a.length != b.length)
13 return false;
14 for (var i = 0; i < a.length; ++i) {
15 if (a[i] != b[i])
16 return false;
17 }
18 return true;
19 }
20
21 for (var i = 0; i < 10000; ++i) {
22 var thingies = [i % 4, "one", 2, "three"];
23 var otherThingies = [i % 4, "five", 6, "seven"];
24 var result = bar(i % 4, "five", 6, "seven");
25 if (!arraycmp(result, [otherThingies[i % 4], thingies[i % 4], otherThingies[i % 4]]))
26 throw "Error: bad result for i = " + i + ": " + result;
27 }