]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/sink-object-past-invalid-check.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / sink-object-past-invalid-check.js
1 function foo(p) {
2 var result = 0;
3 var o = {valueOf:function() { result = 1; }};
4 if (p)
5 +o;
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