]>
Commit | Line | Data |
---|---|---|
1 | function bar(o, p) { | |
2 | var o2 = {f: 0}; | |
3 | if (p) | |
4 | o2.f = o; | |
5 | return +o2.f; | |
6 | } | |
7 | ||
8 | var globalResult; | |
9 | Object.prototype.valueOf = function() { globalResult = 1; }; | |
10 | ||
11 | function foo(p, q) { | |
12 | globalResult = 0; | |
13 | var o = arguments; | |
14 | if (p) | |
15 | bar(o, q); | |
16 | return globalResult; | |
17 | } | |
18 | ||
19 | noInline(foo); | |
20 | ||
21 | foo(true, false); | |
22 | ||
23 | for (var i = 0; i < 10000; ++i) { | |
24 | bar(1, true); | |
25 | bar({}, false); | |
26 | } | |
27 | ||
28 | for (var i = 0; i < 10000; ++i) { | |
29 | var result = foo(false, true); | |
30 | if (result !== 0) | |
31 | throw "Error: bad result: " + result; | |
32 | } | |
33 | ||
34 | var result = foo(true, true); | |
35 | if (result !== 1) | |
36 | throw "Error: bad result at end: " + result; | |
37 |