]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/sink-object-past-invalid-check-sneaky.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / sink-object-past-invalid-check-sneaky.js
CommitLineData
ed1e77d3
A
1function 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
9noInline(foo);
10
11for (var i = 0; i < 10000; ++i) {
12 var result = foo(false);
13 if (result !== 0)
14 throw "Error: bad result: " + result;
15}
16
17var result = foo(true);
18if (result !== 1)
19 throw "Error: bad result at end: " + result;
20