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