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