Index: src/arm/full-codegen-arm.cc |
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc |
index 2ee1594f8671227fad384b33ea3192ce531c3a73..06a9dbedd2a56442c753070e0985594743e26659 100644 |
--- a/src/arm/full-codegen-arm.cc |
+++ b/src/arm/full-codegen-arm.cc |
@@ -4191,24 +4191,27 @@ void FullCodeGenerator::LoadContextField(Register dst, int context_index) { |
} |
-void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { |
+void FullCodeGenerator::PushFunctionArgumentForContextAllocation( |
+ Register scratch) { |
Scope* declaration_scope = scope()->DeclarationScope(); |
if (declaration_scope->is_global_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 |
- // function. |
- __ mov(ip, Operand(Smi::FromInt(0))); |
+ // code. |
+ __ ldr(scratch, GlobalObjectOperand()); |
+ __ ldr(scratch, |
+ FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); |
+ __ ldr(scratch, ContextOperand(scratch, Context::CLOSURE_INDEX)); |
} else if (declaration_scope->is_eval_scope()) { |
// Contexts created by a call to eval have the same closure as the |
// context calling eval, not the anonymous closure containing the eval |
// code. Fetch it from the context. |
- __ ldr(ip, ContextOperand(cp, Context::CLOSURE_INDEX)); |
+ __ ldr(scratch, ContextOperand(cp, Context::CLOSURE_INDEX)); |
} else { |
ASSERT(declaration_scope->is_function_scope()); |
- __ ldr(ip, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
+ __ ldr(scratch, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
} |
- __ push(ip); |
+ __ push(scratch); |
} |