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/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/ast/ast-numbering.h" | 8 #include "src/ast/ast-numbering.h" |
9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/ast/scopeinfo.h" | 10 #include "src/ast/scopeinfo.h" |
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 | 1161 |
1162 // The try block adds a handler to the exception handler chain before | 1162 // The try block adds a handler to the exception handler chain before |
1163 // entering, and removes it again when exiting normally. If an exception | 1163 // entering, and removes it again when exiting normally. If an exception |
1164 // is thrown during execution of the try block, the handler is consumed | 1164 // is thrown during execution of the try block, the handler is consumed |
1165 // and control is passed to the catch block with the exception in the | 1165 // and control is passed to the catch block with the exception in the |
1166 // result register. | 1166 // result register. |
1167 | 1167 |
1168 Label try_entry, handler_entry, exit; | 1168 Label try_entry, handler_entry, exit; |
1169 __ jmp(&try_entry); | 1169 __ jmp(&try_entry); |
1170 __ bind(&handler_entry); | 1170 __ bind(&handler_entry); |
1171 PrepareForBailoutForId(stmt->HandlerId(), NO_REGISTERS); | |
1172 ClearPendingMessage(); | 1171 ClearPendingMessage(); |
1173 | 1172 |
1174 // Exception handler code, the exception is in the result register. | 1173 // Exception handler code, the exception is in the result register. |
1175 // Extend the context before executing the catch block. | 1174 // Extend the context before executing the catch block. |
1176 { Comment cmnt(masm_, "[ Extend catch context"); | 1175 { Comment cmnt(masm_, "[ Extend catch context"); |
1177 __ Push(stmt->variable()->name()); | 1176 __ Push(stmt->variable()->name()); |
1178 __ Push(result_register()); | 1177 __ Push(result_register()); |
1179 PushFunctionArgumentForContextAllocation(); | 1178 PushFunctionArgumentForContextAllocation(); |
1180 __ CallRuntime(Runtime::kPushCatchContext); | 1179 __ CallRuntime(Runtime::kPushCatchContext); |
1181 StoreToFrameField(StandardFrameConstants::kContextOffset, | 1180 StoreToFrameField(StandardFrameConstants::kContextOffset, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 // we push the exception and continuation token and jump to the | 1229 // we push the exception and continuation token and jump to the |
1231 // finally block (which will again dispatch based on the token once | 1230 // finally block (which will again dispatch based on the token once |
1232 // it is finished). | 1231 // it is finished). |
1233 | 1232 |
1234 Label try_entry, handler_entry, finally_entry; | 1233 Label try_entry, handler_entry, finally_entry; |
1235 DeferredCommands deferred(this, &finally_entry); | 1234 DeferredCommands deferred(this, &finally_entry); |
1236 | 1235 |
1237 // Jump to try-handler setup and try-block code. | 1236 // Jump to try-handler setup and try-block code. |
1238 __ jmp(&try_entry); | 1237 __ jmp(&try_entry); |
1239 __ bind(&handler_entry); | 1238 __ bind(&handler_entry); |
1240 PrepareForBailoutForId(stmt->HandlerId(), NO_REGISTERS); | |
1241 | 1239 |
1242 // Exception handler code. This code is only executed when an exception | 1240 // Exception handler code. This code is only executed when an exception |
1243 // is thrown. Record the continuation and jump to the finally block. | 1241 // is thrown. Record the continuation and jump to the finally block. |
1244 { | 1242 { |
1245 Comment cmt_handler(masm(), "[ Finally handler"); | 1243 Comment cmt_handler(masm(), "[ Finally handler"); |
1246 deferred.RecordThrow(); | 1244 deferred.RecordThrow(); |
1247 } | 1245 } |
1248 | 1246 |
1249 // Set up try handler. | 1247 // Set up try handler. |
1250 __ bind(&try_entry); | 1248 __ bind(&try_entry); |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || | 1792 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || |
1795 var->initializer_position() >= proxy->position(); | 1793 var->initializer_position() >= proxy->position(); |
1796 } | 1794 } |
1797 | 1795 |
1798 | 1796 |
1799 #undef __ | 1797 #undef __ |
1800 | 1798 |
1801 | 1799 |
1802 } // namespace internal | 1800 } // namespace internal |
1803 } // namespace v8 | 1801 } // namespace v8 |
OLD | NEW |