| 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 Comment cmnt(masm_, "[ Link nested modules"); | 615 Comment cmnt(masm_, "[ Link nested modules"); |
| 616 Scope* scope = module->body()->scope(); | 616 Scope* scope = module->body()->scope(); |
| 617 Interface* interface = scope->interface(); | 617 Interface* interface = scope->interface(); |
| 618 DCHECK(interface->IsModule() && interface->IsFrozen()); | 618 DCHECK(interface->IsModule() && interface->IsFrozen()); |
| 619 | 619 |
| 620 interface->Allocate(scope->module_var()->index()); | 620 interface->Allocate(scope->module_var()->index()); |
| 621 | 621 |
| 622 // Set up module context. | 622 // Set up module context. |
| 623 DCHECK(scope->interface()->Index() >= 0); | 623 DCHECK(scope->interface()->Index() >= 0); |
| 624 __ Push(Smi::FromInt(scope->interface()->Index())); | 624 __ Push(Smi::FromInt(scope->interface()->Index())); |
| 625 __ Push(scope->GetScopeInfo()); | 625 __ Push(scope->GetScopeInfo(isolate())); |
| 626 __ CallRuntime(Runtime::kPushModuleContext, 2); | 626 __ CallRuntime(Runtime::kPushModuleContext, 2); |
| 627 StoreToFrameField(StandardFrameConstants::kContextOffset, | 627 StoreToFrameField(StandardFrameConstants::kContextOffset, |
| 628 context_register()); | 628 context_register()); |
| 629 | 629 |
| 630 AllocateModules(scope->declarations()); | 630 AllocateModules(scope->declarations()); |
| 631 | 631 |
| 632 // Pop module context. | 632 // Pop module context. |
| 633 LoadContextField(context_register(), Context::PREVIOUS_INDEX); | 633 LoadContextField(context_register(), Context::PREVIOUS_INDEX); |
| 634 // Update local stack frame context field. | 634 // Update local stack frame context field. |
| 635 StoreToFrameField(StandardFrameConstants::kContextOffset, | 635 StoreToFrameField(StandardFrameConstants::kContextOffset, |
| (...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1794 BailoutId declarations_id, BailoutId exit_id) | 1794 BailoutId declarations_id, BailoutId exit_id) |
| 1795 : codegen_(codegen), scope_(scope), exit_id_(exit_id) { | 1795 : codegen_(codegen), scope_(scope), exit_id_(exit_id) { |
| 1796 saved_scope_ = codegen_->scope(); | 1796 saved_scope_ = codegen_->scope(); |
| 1797 | 1797 |
| 1798 if (scope == NULL) { | 1798 if (scope == NULL) { |
| 1799 codegen_->PrepareForBailoutForId(entry_id, NO_REGISTERS); | 1799 codegen_->PrepareForBailoutForId(entry_id, NO_REGISTERS); |
| 1800 } else { | 1800 } else { |
| 1801 codegen_->scope_ = scope; | 1801 codegen_->scope_ = scope; |
| 1802 { | 1802 { |
| 1803 Comment cmnt(masm(), "[ Extend block context"); | 1803 Comment cmnt(masm(), "[ Extend block context"); |
| 1804 __ Push(scope->GetScopeInfo()); | 1804 __ Push(scope->GetScopeInfo(codegen->isolate())); |
| 1805 codegen_->PushFunctionArgumentForContextAllocation(); | 1805 codegen_->PushFunctionArgumentForContextAllocation(); |
| 1806 __ CallRuntime(Runtime::kPushBlockContext, 2); | 1806 __ CallRuntime(Runtime::kPushBlockContext, 2); |
| 1807 | 1807 |
| 1808 // Replace the context stored in the frame. | 1808 // Replace the context stored in the frame. |
| 1809 codegen_->StoreToFrameField(StandardFrameConstants::kContextOffset, | 1809 codegen_->StoreToFrameField(StandardFrameConstants::kContextOffset, |
| 1810 codegen_->context_register()); | 1810 codegen_->context_register()); |
| 1811 codegen_->PrepareForBailoutForId(entry_id, NO_REGISTERS); | 1811 codegen_->PrepareForBailoutForId(entry_id, NO_REGISTERS); |
| 1812 } | 1812 } |
| 1813 { | 1813 { |
| 1814 Comment cmnt(masm(), "[ Declarations"); | 1814 Comment cmnt(masm(), "[ Declarations"); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1829 } | 1829 } |
| 1830 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); | 1830 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); |
| 1831 codegen_->scope_ = saved_scope_; | 1831 codegen_->scope_ = saved_scope_; |
| 1832 } | 1832 } |
| 1833 | 1833 |
| 1834 | 1834 |
| 1835 #undef __ | 1835 #undef __ |
| 1836 | 1836 |
| 1837 | 1837 |
| 1838 } } // namespace v8::internal | 1838 } } // namespace v8::internal |
| OLD | NEW |