| Index: src/arm/full-codegen-arm.cc
|
| diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
|
| index 498e4443f303fa0de42f97a7743169f461af1c55..36140518c4ea4f408a3628e62ffaae9e9f45fc70 100644
|
| --- a/src/arm/full-codegen-arm.cc
|
| +++ b/src/arm/full-codegen-arm.cc
|
| @@ -757,10 +757,10 @@ void FullCodeGenerator::VisitVariableDeclaration(
|
| bool hole_init = mode == CONST || mode == CONST_HARMONY || mode == LET;
|
| switch (variable->location()) {
|
| case Variable::UNALLOCATED:
|
| - globals_.Add(variable->name());
|
| - globals_.Add(variable->binding_needs_init()
|
| - ? isolate()->factory()->the_hole_value()
|
| - : isolate()->factory()->undefined_value());
|
| + globals_->Add(variable->name());
|
| + globals_->Add(variable->binding_needs_init()
|
| + ? isolate()->factory()->the_hole_value()
|
| + : isolate()->factory()->undefined_value());
|
| break;
|
|
|
| case Variable::PARAMETER:
|
| @@ -816,12 +816,12 @@ void FullCodeGenerator::VisitFunctionDeclaration(
|
| Variable* variable = proxy->var();
|
| switch (variable->location()) {
|
| case Variable::UNALLOCATED: {
|
| - globals_.Add(variable->name());
|
| + globals_->Add(variable->name());
|
| Handle<SharedFunctionInfo> function =
|
| Compiler::BuildFunctionInfo(declaration->fun(), script());
|
| // Check for stack-overflow exception.
|
| if (function.is_null()) return SetStackOverflow();
|
| - globals_.Add(function);
|
| + globals_->Add(function);
|
| break;
|
| }
|
|
|
| @@ -869,15 +869,26 @@ void FullCodeGenerator::VisitFunctionDeclaration(
|
| void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) {
|
| VariableProxy* proxy = declaration->proxy();
|
| Variable* variable = proxy->var();
|
| + Handle<JSModule> instance = declaration->module()->interface()->Instance();
|
| + // TODO(rossberg): temporary hack until URL import is implemented:
|
| + if (instance.is_null()) return;
|
| + ASSERT(!instance.is_null());
|
| +
|
| switch (variable->location()) {
|
| - case Variable::UNALLOCATED:
|
| - // TODO(rossberg): initialize module instance object
|
| + case Variable::UNALLOCATED: {
|
| + Comment cmnt(masm_, "[ ModuleDeclaration");
|
| + globals_->Add(variable->name());
|
| + globals_->Add(instance);
|
| + Visit(declaration->module());
|
| break;
|
| + }
|
|
|
| case Variable::CONTEXT: {
|
| Comment cmnt(masm_, "[ ModuleDeclaration");
|
| EmitDebugCheckDeclarationContext(variable);
|
| - // TODO(rossberg): initialize module instance object
|
| + __ mov(r1, Operand(instance));
|
| + __ str(r1, ContextOperand(cp, variable->index()));
|
| + Visit(declaration->module());
|
| break;
|
| }
|
|
|
| @@ -4466,7 +4477,8 @@ void FullCodeGenerator::LoadContextField(Register dst, int context_index) {
|
|
|
| void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
|
| Scope* declaration_scope = scope()->DeclarationScope();
|
| - if (declaration_scope->is_global_scope()) {
|
| + if (declaration_scope->is_global_scope() ||
|
| + declaration_scope->is_module_scope()) {
|
| // Contexts nested in the global context have a canonical empty function
|
| // as their closure, not the anonymous closure containing the global
|
| // code. Pass a smi sentinel and let the runtime look up the empty
|
|
|