| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 assertEquals(5, f({}, 'bar', 5).bar); | 58 assertEquals(5, f({}, 'bar', 5).bar); |
| 59 | 59 |
| 60 function guard(f) { try { f(); } catch (o) { return o; } } | 60 function guard(f) { try { f(); } catch (o) { return o; } } |
| 61 assertEquals('baz', guard(function() { throw 'baz'; })); | 61 assertEquals('baz', guard(function() { throw 'baz'; })); |
| 62 assertEquals(2, (function() { try { throw {}; } catch(e) {} finally { return 2;
} })()); | 62 assertEquals(2, (function() { try { throw {}; } catch(e) {} finally { return 2;
} })()); |
| 63 assertEquals(1, guard(function() { try { throw 1; } finally { } })); | 63 assertEquals(1, guard(function() { try { throw 1; } finally { } })); |
| 64 assertEquals(2, guard(function() { try { throw 2; } finally { var x = 12; } })); | 64 assertEquals(2, guard(function() { try { throw 2; } finally { var x = 12; } })); |
| 65 assertEquals(4, guard(function() { try { throw 3; } finally { throw 4; } })); | 65 assertEquals(4, guard(function() { try { throw 3; } finally { throw 4; } })); |
| 66 | 66 |
| 67 (function () { | 67 (function () { |
| 68 var iter = 10000000; | 68 var iter = 1000000; |
| 69 for (var i = 1; i <= iter; i++) { | 69 for (var i = 1; i <= iter; i++) { |
| 70 try { | 70 try { |
| 71 if (i == iter) gc(); | 71 if (i == iter) gc(); |
| 72 } finally { | 72 } finally { |
| 73 if (i == iter) gc(); | 73 if (i == iter) gc(); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 })(); | 76 })(); |
| 77 | 77 |
| 78 function trycatch(a) { | 78 function trycatch(a) { |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 broke = false; | 340 broke = false; |
| 341 } catch (o) { | 341 } catch (o) { |
| 342 caught = true; | 342 caught = true; |
| 343 } finally { | 343 } finally { |
| 344 finalized = true; | 344 finalized = true; |
| 345 } | 345 } |
| 346 assertTrue(broke); | 346 assertTrue(broke); |
| 347 assertFalse(caught); | 347 assertFalse(caught); |
| 348 assertTrue(finalized); | 348 assertTrue(finalized); |
| 349 | 349 |
| OLD | NEW |