|
1 var count = 0; |
|
2 |
|
3 // OSR into a finally block should not throw away the frame's |
|
4 // return value. |
|
5 function test1() { |
|
6 try { |
|
7 return [1, 2, 3]; |
|
8 } finally { |
|
9 for (var i=0; i<20; i++) { count++; } |
|
10 } |
|
11 } |
|
12 assertEq(test1().toString(), "1,2,3"); |
|
13 assertEq(count, 20); |
|
14 |
|
15 // OSR into the finally block, with exception pending. |
|
16 function test2() { |
|
17 try { |
|
18 throw 3; |
|
19 } finally { |
|
20 for (var i=0; i<20; i++) { count++; } |
|
21 } |
|
22 } |
|
23 try { |
|
24 test2(); |
|
25 assertEq(0, 1); |
|
26 } catch(e) { |
|
27 assertEq(e, 3); |
|
28 } |
|
29 assertEq(count, 40); |