Index: src/x64/full-codegen-x64.cc |
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc |
index 1d9b8fffc2ba31442de8df8b9edddc25620ef549..813e5d1f2f427faa7be48f5210b762fc516ef7cc 100644 |
--- a/src/x64/full-codegen-x64.cc |
+++ b/src/x64/full-codegen-x64.cc |
@@ -4119,14 +4119,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(Smi::FromInt(0)); |
+ // code. |
+ __ movq(scratch, GlobalObjectOperand()); |
+ __ movq(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset)); |
+ __ push(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 |