| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/ast.h" | 7 #include "src/ast.h" |
| 8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 SetStatementPosition(stmt); | 1219 SetStatementPosition(stmt); |
| 1220 // The try block adds a handler to the exception handler chain before | 1220 // The try block adds a handler to the exception handler chain before |
| 1221 // entering, and removes it again when exiting normally. If an exception | 1221 // entering, and removes it again when exiting normally. If an exception |
| 1222 // is thrown during execution of the try block, the handler is consumed | 1222 // is thrown during execution of the try block, the handler is consumed |
| 1223 // and control is passed to the catch block with the exception in the | 1223 // and control is passed to the catch block with the exception in the |
| 1224 // result register. | 1224 // result register. |
| 1225 | 1225 |
| 1226 Label try_entry, handler_entry, exit; | 1226 Label try_entry, handler_entry, exit; |
| 1227 __ jmp(&try_entry); | 1227 __ jmp(&try_entry); |
| 1228 __ bind(&handler_entry); | 1228 __ bind(&handler_entry); |
| 1229 PrepareForBailoutForId(stmt->HandlerId(), NO_REGISTERS); |
| 1230 ClearPendingMessage(); |
| 1229 | 1231 |
| 1230 ClearPendingMessage(); | |
| 1231 // Exception handler code, the exception is in the result register. | 1232 // Exception handler code, the exception is in the result register. |
| 1232 // Extend the context before executing the catch block. | 1233 // Extend the context before executing the catch block. |
| 1233 { Comment cmnt(masm_, "[ Extend catch context"); | 1234 { Comment cmnt(masm_, "[ Extend catch context"); |
| 1234 __ Push(stmt->variable()->name()); | 1235 __ Push(stmt->variable()->name()); |
| 1235 __ Push(result_register()); | 1236 __ Push(result_register()); |
| 1236 PushFunctionArgumentForContextAllocation(); | 1237 PushFunctionArgumentForContextAllocation(); |
| 1237 __ CallRuntime(Runtime::kPushCatchContext, 3); | 1238 __ CallRuntime(Runtime::kPushCatchContext, 3); |
| 1238 StoreToFrameField(StandardFrameConstants::kContextOffset, | 1239 StoreToFrameField(StandardFrameConstants::kContextOffset, |
| 1239 context_register()); | 1240 context_register()); |
| 1240 } | 1241 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 // The finally block must assume a return address on top of the stack | 1289 // The finally block must assume a return address on top of the stack |
| 1289 // (or in the link register on ARM chips) and a value (return value or | 1290 // (or in the link register on ARM chips) and a value (return value or |
| 1290 // exception) in the result register (rax/eax/r0), both of which must | 1291 // exception) in the result register (rax/eax/r0), both of which must |
| 1291 // be preserved. The return address isn't GC-safe, so it should be | 1292 // be preserved. The return address isn't GC-safe, so it should be |
| 1292 // cooked before GC. | 1293 // cooked before GC. |
| 1293 Label try_entry, handler_entry, finally_entry; | 1294 Label try_entry, handler_entry, finally_entry; |
| 1294 | 1295 |
| 1295 // Jump to try-handler setup and try-block code. | 1296 // Jump to try-handler setup and try-block code. |
| 1296 __ jmp(&try_entry); | 1297 __ jmp(&try_entry); |
| 1297 __ bind(&handler_entry); | 1298 __ bind(&handler_entry); |
| 1299 PrepareForBailoutForId(stmt->HandlerId(), NO_REGISTERS); |
| 1300 |
| 1298 // Exception handler code. This code is only executed when an exception | 1301 // Exception handler code. This code is only executed when an exception |
| 1299 // is thrown. The exception is in the result register, and must be | 1302 // is thrown. The exception is in the result register, and must be |
| 1300 // preserved by the finally block. Call the finally block and then | 1303 // preserved by the finally block. Call the finally block and then |
| 1301 // rethrow the exception if it returns. | 1304 // rethrow the exception if it returns. |
| 1302 __ Call(&finally_entry); | 1305 __ Call(&finally_entry); |
| 1303 __ Push(result_register()); | 1306 __ Push(result_register()); |
| 1304 __ CallRuntime(Runtime::kReThrow, 1); | 1307 __ CallRuntime(Runtime::kReThrow, 1); |
| 1305 | 1308 |
| 1306 // Finally block implementation. | 1309 // Finally block implementation. |
| 1307 __ bind(&finally_entry); | 1310 __ bind(&finally_entry); |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1694 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); | 1697 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); |
| 1695 codegen_->scope_ = saved_scope_; | 1698 codegen_->scope_ = saved_scope_; |
| 1696 } | 1699 } |
| 1697 | 1700 |
| 1698 | 1701 |
| 1699 #undef __ | 1702 #undef __ |
| 1700 | 1703 |
| 1701 | 1704 |
| 1702 } // namespace internal | 1705 } // namespace internal |
| 1703 } // namespace v8 | 1706 } // namespace v8 |
| OLD | NEW |