Index: src/ia32/full-codegen-ia32.cc |
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
index 60d9525b398e56457d52201126f26ccfad8f2f18..75cc4b8608deb679284b68e3a86ece92b3f012a4 100644 |
--- a/src/ia32/full-codegen-ia32.cc |
+++ b/src/ia32/full-codegen-ia32.cc |
@@ -4202,19 +4202,20 @@ void FullCodeGenerator::LoadContextField(Register dst, int context_index) { |
void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { |
- if (scope()->is_global_scope()) { |
+ 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))); |
- } 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. |
+ } 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. |
+ // Fetch it from the context. |
__ push(ContextOperand(esi, Context::CLOSURE_INDEX)); |
} else { |
- ASSERT(scope()->is_function_scope() || scope()->is_catch_scope()); |
+ ASSERT(declaration_scope->is_function_scope()); |
__ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
} |
} |