OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 Label try_entry, handler_entry, finally_entry; | 1280 Label try_entry, handler_entry, finally_entry; |
1281 | 1281 |
1282 // Jump to try-handler setup and try-block code. | 1282 // Jump to try-handler setup and try-block code. |
1283 __ jmp(&try_entry); | 1283 __ jmp(&try_entry); |
1284 __ bind(&handler_entry); | 1284 __ bind(&handler_entry); |
1285 handler_table()->set(stmt->index(), Smi::FromInt(handler_entry.pos())); | 1285 handler_table()->set(stmt->index(), Smi::FromInt(handler_entry.pos())); |
1286 // Exception handler code. This code is only executed when an exception | 1286 // Exception handler code. This code is only executed when an exception |
1287 // is thrown. The exception is in the result register, and must be | 1287 // is thrown. The exception is in the result register, and must be |
1288 // preserved by the finally block. Call the finally block and then | 1288 // preserved by the finally block. Call the finally block and then |
1289 // rethrow the exception if it returns. | 1289 // rethrow the exception if it returns. |
1290 // Also preserve the pending message corresponding to the thrown error when | |
1291 // executing the finally block. | |
1292 SavePendingMessage(); | |
1293 __ Call(&finally_entry); | 1290 __ Call(&finally_entry); |
1294 RestorePendingMessage(); | |
1295 __ push(result_register()); | 1291 __ push(result_register()); |
1296 __ CallRuntime(Runtime::kReThrow, 1); | 1292 __ CallRuntime(Runtime::kReThrow, 1); |
1297 | 1293 |
1298 // Finally block implementation. | 1294 // Finally block implementation. |
1299 __ bind(&finally_entry); | 1295 __ bind(&finally_entry); |
1300 EnterFinallyBlock(); | 1296 EnterFinallyBlock(); |
1301 { Finally finally_body(this); | 1297 { Finally finally_body(this); |
1302 Visit(stmt->finally_block()); | 1298 Visit(stmt->finally_block()); |
1303 } | 1299 } |
1304 ExitFinallyBlock(); // Return to the calling code. | 1300 ExitFinallyBlock(); // Return to the calling code. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 } | 1423 } |
1428 | 1424 |
1429 return false; | 1425 return false; |
1430 } | 1426 } |
1431 | 1427 |
1432 | 1428 |
1433 #undef __ | 1429 #undef __ |
1434 | 1430 |
1435 | 1431 |
1436 } } // namespace v8::internal | 1432 } } // namespace v8::internal |
OLD | NEW |