]>
Commit | Line | Data |
---|---|---|
ed1e77d3 A |
1 | function Cons() { |
2 | } | |
3 | Cons.prototype.__defineGetter__("f", function() { | |
4 | counter++; | |
5 | return 84; | |
6 | }); | |
7 | ||
8 | function foo(o) { | |
9 | return o.f; | |
10 | } | |
11 | ||
12 | noInline(foo); | |
13 | ||
14 | var counter = 0; | |
15 | ||
16 | function test(o, expected, expectedCount) { | |
17 | var result = foo(o); | |
18 | if (result != expected) | |
19 | throw new Error("Bad result: " + result); | |
20 | if (counter != expectedCount) | |
21 | throw new Error("Bad counter value: " + counter); | |
22 | } | |
23 | ||
24 | for (var i = 0; i < 100000; ++i) { | |
25 | test(new Cons(), 84, counter + 1); | |
26 | ||
27 | var o = new Cons(); | |
28 | o.g = 54; | |
29 | test(o, 84, counter + 1); | |
30 | } |