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