]>
Commit | Line | Data |
---|---|---|
81345200 A |
1 | function foo(o) { |
2 | return o.f + 1; | |
3 | } | |
4 | ||
5 | noInline(foo); | |
6 | ||
7 | var shouldThrow = false; | |
8 | ||
9 | function makeWithGetter() { | |
10 | var o = {}; | |
11 | o.__defineGetter__("f", function() { | |
12 | if (shouldThrow) | |
13 | throw "hello"; | |
14 | return 42; | |
15 | }); | |
16 | return o; | |
17 | } | |
18 | ||
19 | for (var i = 0; i < 100000; ++i) { | |
20 | var result = foo({f:23}); | |
21 | if (result != 24) | |
22 | throw "Error: bad result: " + result; | |
23 | result = foo(makeWithGetter()); | |
24 | if (result != 43) | |
25 | throw "Error: bad result: " + result; | |
26 | } | |
27 | ||
28 | var didThrow; | |
29 | try { | |
30 | shouldThrow = true; | |
31 | foo(makeWithGetter()); | |
32 | } catch (e) { | |
33 | didThrow = e; | |
34 | } | |
35 | ||
36 | if (didThrow != "hello") | |
37 | throw "Error: didn't throw or threw wrong exception: " + didThrow; |