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