]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/phantom-inadequacy.js
bb72e22d3469ceff3d0779c1bdc51c6b5e59bdd0
[apple/javascriptcore.git] / tests / stress / phantom-inadequacy.js
1 function bar() {
2 return 42.5;
3 }
4 noInline(bar);
5
6 function baz(value) {
7 if (value != 42.5)
8 throw "Error: bad value: " + value;
9 }
10 noInline(baz);
11
12 var True = true;
13 function foo(a) {
14 var x = bar();
15 var tmp = 0;
16 if (True) {
17 var tmp2 = x;
18 tmp = a + 1;
19 baz(tmp2);
20 }
21 return x + 1 + tmp;
22 }
23 noInline(foo);
24
25 for (var i = 0; i < 10000; ++i) {
26 var result = foo(1);
27 if (result != 42.5 + 1 + 1 + 1)
28 throw "Error: bad result: " + result;
29 }
30
31 var result = foo(2147483647);
32 if (result != 42.5 + 1 + 2147483647 + 1)
33 throw "Error: bad result at end: " + result;