js/src/jit-test/tests/baseline/try-finally-osr.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/baseline/try-finally-osr.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,29 @@
     1.4 +var count = 0;
     1.5 +
     1.6 +// OSR into a finally block should not throw away the frame's
     1.7 +// return value.
     1.8 +function test1() {
     1.9 +    try {
    1.10 +	return [1, 2, 3];
    1.11 +    } finally {
    1.12 +	for (var i=0; i<20; i++) { count++; }
    1.13 +    }
    1.14 +}
    1.15 +assertEq(test1().toString(), "1,2,3");
    1.16 +assertEq(count, 20);
    1.17 +
    1.18 +// OSR into the finally block, with exception pending.
    1.19 +function test2() {
    1.20 +    try {
    1.21 +	throw 3;
    1.22 +    } finally {
    1.23 +	for (var i=0; i<20; i++) { count++; }
    1.24 +    }
    1.25 +}
    1.26 +try {
    1.27 +    test2();
    1.28 +    assertEq(0, 1);
    1.29 +} catch(e) {
    1.30 +    assertEq(e, 3);
    1.31 +}
    1.32 +assertEq(count, 40);

mercurial