]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/sink-object-past-invalid-check-sneakier.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / sink-object-past-invalid-check-sneakier.js
1 function bar(o, p) {
2 if (p)
3 return +o.f;
4 return 42;
5 }
6
7 function foo(p, q) {
8 var result = 0;
9 var o = {valueOf: function() { result = 1; }};
10 var o2 = {f: o};
11 if (p)
12 bar(o2, q);
13 return result;
14 }
15
16 noInline(foo);
17
18 foo(true, false);
19
20 for (var i = 0; i < 10000; ++i)
21 bar({f:42}, true);
22
23 for (var i = 0; i < 10000; ++i) {
24 var result = foo(false, true);
25 if (result !== 0)
26 throw "Error: bad result: " + result;
27 }
28
29 var result = foo(true, true);
30 if (result !== 1)
31 throw "Error: bad result at end: " + result;
32