| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 Comment cmnt(masm_, "[ Block"); | 812 Comment cmnt(masm_, "[ Block"); |
| 813 NestedBlock nested_block(this, stmt); | 813 NestedBlock nested_block(this, stmt); |
| 814 SetStatementPosition(stmt); | 814 SetStatementPosition(stmt); |
| 815 | 815 |
| 816 Scope* saved_scope = scope(); | 816 Scope* saved_scope = scope(); |
| 817 // Push a block context when entering a block with block scoped variables. | 817 // Push a block context when entering a block with block scoped variables. |
| 818 if (stmt->block_scope() != NULL) { | 818 if (stmt->block_scope() != NULL) { |
| 819 { Comment cmnt(masm_, "[ Extend block context"); | 819 { Comment cmnt(masm_, "[ Extend block context"); |
| 820 scope_ = stmt->block_scope(); | 820 scope_ = stmt->block_scope(); |
| 821 __ Push(scope_->GetSerializedScopeInfo()); | 821 __ Push(scope_->GetSerializedScopeInfo()); |
| 822 PushFunctionArgumentForContextAllocation(); | 822 PushFunctionArgumentForContextAllocation(result_register()); |
| 823 __ CallRuntime(Runtime::kPushBlockContext, 2); | 823 __ CallRuntime(Runtime::kPushBlockContext, 2); |
| 824 StoreToFrameField(StandardFrameConstants::kContextOffset, | 824 StoreToFrameField(StandardFrameConstants::kContextOffset, |
| 825 context_register()); | 825 context_register()); |
| 826 } | 826 } |
| 827 { Comment cmnt(masm_, "[ Declarations"); | 827 { Comment cmnt(masm_, "[ Declarations"); |
| 828 VisitDeclarations(scope_->declarations()); | 828 VisitDeclarations(scope_->declarations()); |
| 829 } | 829 } |
| 830 } | 830 } |
| 831 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); | 831 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); |
| 832 VisitStatements(stmt->statements()); | 832 VisitStatements(stmt->statements()); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 | 958 |
| 959 EmitReturnSequence(); | 959 EmitReturnSequence(); |
| 960 } | 960 } |
| 961 | 961 |
| 962 | 962 |
| 963 void FullCodeGenerator::VisitWithStatement(WithStatement* stmt) { | 963 void FullCodeGenerator::VisitWithStatement(WithStatement* stmt) { |
| 964 Comment cmnt(masm_, "[ WithStatement"); | 964 Comment cmnt(masm_, "[ WithStatement"); |
| 965 SetStatementPosition(stmt); | 965 SetStatementPosition(stmt); |
| 966 | 966 |
| 967 VisitForStackValue(stmt->expression()); | 967 VisitForStackValue(stmt->expression()); |
| 968 PushFunctionArgumentForContextAllocation(); | 968 PushFunctionArgumentForContextAllocation(result_register()); |
| 969 __ CallRuntime(Runtime::kPushWithContext, 2); | 969 __ CallRuntime(Runtime::kPushWithContext, 2); |
| 970 decrement_stack_height(); | 970 decrement_stack_height(); |
| 971 StoreToFrameField(StandardFrameConstants::kContextOffset, context_register()); | 971 StoreToFrameField(StandardFrameConstants::kContextOffset, context_register()); |
| 972 | 972 |
| 973 { WithOrCatch body(this); | 973 { WithOrCatch body(this); |
| 974 Visit(stmt->statement()); | 974 Visit(stmt->statement()); |
| 975 } | 975 } |
| 976 | 976 |
| 977 // Pop context. | 977 // Pop context. |
| 978 LoadContextField(context_register(), Context::PREVIOUS_INDEX); | 978 LoadContextField(context_register(), Context::PREVIOUS_INDEX); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 // that scope again afterwards. | 1109 // that scope again afterwards. |
| 1110 | 1110 |
| 1111 Label try_handler_setup, done; | 1111 Label try_handler_setup, done; |
| 1112 __ Call(&try_handler_setup); | 1112 __ Call(&try_handler_setup); |
| 1113 // Try handler code, exception in result register. | 1113 // Try handler code, exception in result register. |
| 1114 | 1114 |
| 1115 // Extend the context before executing the catch block. | 1115 // Extend the context before executing the catch block. |
| 1116 { Comment cmnt(masm_, "[ Extend catch context"); | 1116 { Comment cmnt(masm_, "[ Extend catch context"); |
| 1117 __ Push(stmt->variable()->name()); | 1117 __ Push(stmt->variable()->name()); |
| 1118 __ push(result_register()); | 1118 __ push(result_register()); |
| 1119 PushFunctionArgumentForContextAllocation(); | 1119 PushFunctionArgumentForContextAllocation(result_register()); |
| 1120 __ CallRuntime(Runtime::kPushCatchContext, 3); | 1120 __ CallRuntime(Runtime::kPushCatchContext, 3); |
| 1121 StoreToFrameField(StandardFrameConstants::kContextOffset, | 1121 StoreToFrameField(StandardFrameConstants::kContextOffset, |
| 1122 context_register()); | 1122 context_register()); |
| 1123 } | 1123 } |
| 1124 | 1124 |
| 1125 Scope* saved_scope = scope(); | 1125 Scope* saved_scope = scope(); |
| 1126 scope_ = stmt->scope(); | 1126 scope_ = stmt->scope(); |
| 1127 ASSERT(scope_->declarations()->is_empty()); | 1127 ASSERT(scope_->declarations()->is_empty()); |
| 1128 { WithOrCatch body(this); | 1128 { WithOrCatch body(this); |
| 1129 Visit(stmt->catch_block()); | 1129 Visit(stmt->catch_block()); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 } | 1335 } |
| 1336 | 1336 |
| 1337 return false; | 1337 return false; |
| 1338 } | 1338 } |
| 1339 | 1339 |
| 1340 | 1340 |
| 1341 #undef __ | 1341 #undef __ |
| 1342 | 1342 |
| 1343 | 1343 |
| 1344 } } // namespace v8::internal | 1344 } } // namespace v8::internal |
| OLD | NEW |