]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/arguments-interference-cfg.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / arguments-interference-cfg.js
1 function bar() {
2 return arguments;
3 }
4
5 function foo(p) {
6 var a = bar(1, 2, 3);
7 var b;
8 if (p)
9 b = bar(4, 5, 6);
10 else
11 b = [7, 8, 9];
12 return (a[0] << 0) + (a[1] << 1) + (a[2] << 2) + (b[0] << 3) + (b[1] << 4) + (b[2] << 5);
13 }
14
15 noInline(foo);
16
17 for (var i = 0; i < 20000; ++i) {
18 var p = i & 1;
19 var q = (!p) * 3;
20 var result = foo(p);
21 if (result != (1 << 0) + (2 << 1) + (3 << 2) + ((4 + q) << 3) + ((5 + q) << 4) + ((6 + q) << 5))
22 throw "Error: bad result: " + result;
23 }
24