Index: src/arm/full-codegen-arm.cc |
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc |
index 950ebc3de916c76970f318d4d72386b536ac53e5..0fff99ade08805f1c91e59f1a49638cc7c8fff11 100644 |
--- a/src/arm/full-codegen-arm.cc |
+++ b/src/arm/full-codegen-arm.cc |
@@ -4262,6 +4262,26 @@ void FullCodeGenerator::LoadContextField(Register dst, int context_index) { |
} |
+void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { |
+ if (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))); |
+ } else if (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)); |
+ } else { |
+ ASSERT(scope()->is_function_scope()); |
+ __ ldr(ip, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
+ } |
+ __ push(ip); |
+} |
+ |
+ |
// ---------------------------------------------------------------------------- |
// Non-local control flow support. |