| Index: src/ia32/full-codegen-ia32.cc
|
| ===================================================================
|
| --- src/ia32/full-codegen-ia32.cc (revision 8462)
|
| +++ src/ia32/full-codegen-ia32.cc (working copy)
|
| @@ -687,10 +687,12 @@
|
| // context.
|
| ASSERT_EQ(0, scope()->ContextChainLength(variable->scope()));
|
| if (FLAG_debug_code) {
|
| - // Check that we're not inside a 'with'.
|
| - __ mov(ebx, ContextOperand(esi, Context::FCONTEXT_INDEX));
|
| - __ cmp(ebx, Operand(esi));
|
| - __ Check(equal, "Unexpected declaration in current context.");
|
| + // Check that we're not inside a with or catch context.
|
| + __ mov(ebx, FieldOperand(esi, HeapObject::kMapOffset));
|
| + __ cmp(ebx, isolate()->factory()->with_context_map());
|
| + __ Check(not_equal, "Declaration in with context.");
|
| + __ cmp(ebx, isolate()->factory()->catch_context_map());
|
| + __ Check(not_equal, "Declaration in catch context.");
|
| }
|
| if (mode == Variable::CONST) {
|
| __ mov(ContextOperand(esi, slot->index()),
|
| @@ -1818,17 +1820,7 @@
|
| __ j(not_equal, &skip);
|
| __ mov(Operand(ebp, SlotOffset(slot)), eax);
|
| break;
|
| - case Slot::CONTEXT: {
|
| - __ mov(ecx, ContextOperand(esi, Context::FCONTEXT_INDEX));
|
| - __ mov(edx, ContextOperand(ecx, slot->index()));
|
| - __ cmp(edx, isolate()->factory()->the_hole_value());
|
| - __ j(not_equal, &skip);
|
| - __ mov(ContextOperand(ecx, slot->index()), eax);
|
| - int offset = Context::SlotOffset(slot->index());
|
| - __ mov(edx, eax); // Preserve the stored value in eax.
|
| - __ RecordWrite(ecx, offset, edx, ebx);
|
| - break;
|
| - }
|
| + case Slot::CONTEXT:
|
| case Slot::LOOKUP:
|
| __ push(eax);
|
| __ push(esi);
|
| @@ -3704,7 +3696,7 @@
|
| // accumulator register eax.
|
| VisitForAccumulatorValue(expr->expression());
|
| SetSourcePosition(expr->position());
|
| - EmitCallIC(stub.GetCode(), NULL, expr->id());
|
| + EmitCallIC(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id());
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -4219,6 +4211,25 @@
|
| }
|
|
|
|
|
| +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.
|
|
|
|
|