]>
Commit | Line | Data |
---|---|---|
ed1e77d3 A |
1 | function bar(o, p) { |
2 | if (p) | |
3 | return +o.f; | |
4 | return 42; | |
5 | } | |
6 | ||
7 | var globalResult; | |
8 | Function.prototype.valueOf = function() { globalResult = 1; }; | |
9 | ||
10 | function 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 | ||
19 | noInline(foo); | |
20 | ||
21 | foo(true, false); | |
22 | ||
23 | for (var i = 0; i < 10000; ++i) | |
24 | bar({f:42}, true); | |
25 | ||
26 | for (var i = 0; i < 10000; ++i) { | |
27 | var result = foo(false, true); | |
28 | if (result !== 0) | |
29 | throw "Error: bad result: " + result; | |
30 | } | |
31 | ||
32 | var result = foo(true, true); | |
33 | if (result !== 1) | |
34 | throw "Error: bad result at end: " + result; | |
35 |