Index: src/ia32/full-codegen-ia32.cc |
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
index c6f275bbdc3213c47340f6518aa689f64d0619e9..c5d3d3bc615382185d3e8a4fe47411791e31f092 100644 |
--- a/src/ia32/full-codegen-ia32.cc |
+++ b/src/ia32/full-codegen-ia32.cc |
@@ -4269,14 +4269,16 @@ 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. |
- __ push(Immediate(Smi::FromInt(0))); |
+ // code. |
+ __ mov(scratch, GlobalObjectOperand()); |
+ __ mov(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset)); |
+ __ push(ContextOperand(scratch, Context::CLOSURE_INDEX)); |
} else if (declaration_scope->is_eval_scope()) { |
// Contexts nested inside eval code have the same closure as the context |
// calling eval, not the anonymous closure containing the eval code. |