Index: src/ia32/full-codegen-ia32.cc |
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
index 0496d732efd16837571b91fd1a6b27ffe97618f7..e71eda3fc0a943950d9b0817e6902ec5d0193992 100644 |
--- a/src/ia32/full-codegen-ia32.cc |
+++ b/src/ia32/full-codegen-ia32.cc |
@@ -4211,6 +4211,25 @@ 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. |
+ __ push(Immediate(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. |
+ __ push(ContextOperand(esi, Context::CLOSURE_INDEX)); |
+ } else { |
+ ASSERT(scope()->is_function_scope()); |
+ __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
+ } |
+} |
+ |
+ |
// ---------------------------------------------------------------------------- |
// Non-local control flow support. |