]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/sink-object-past-invalid-check-sneaky.js
7b38cef9a415825a2df5f38acf497d6746968f2d
[apple/javascriptcore.git] / tests / stress / sink-object-past-invalid-check-sneaky.js
1 function foo(p) {
2 var result = 0;
3 var o = {valueOf: function() { result = 1; }};
4 var q = {f: p ? o : 42};
5 var tmp = q.f + 1;
6 return result;
7 }
8
9 noInline(foo);
10
11 for (var i = 0; i < 10000; ++i) {
12 var result = foo(false);
13 if (result !== 0)
14 throw "Error: bad result: " + result;
15 }
16
17 var result = foo(true);
18 if (result !== 1)
19 throw "Error: bad result at end: " + result;
20