Index: src/x64/full-codegen-x64.cc |
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc |
index 77c687045c908fd819c0a6a7e3968e16aa1623bb..21ab4cb10e341ea97874a464f4192d45f7b02256 100644 |
--- a/src/x64/full-codegen-x64.cc |
+++ b/src/x64/full-codegen-x64.cc |
@@ -680,13 +680,16 @@ void FullCodeGenerator::EmitDeclaration(Variable* variable, |
// We bypass the general EmitSlotSearch because we know more about |
// this specific context. |
- // The variable in the decl always resides in the current context. |
+ // The variable in the decl always resides in the current function |
+ // context. |
ASSERT_EQ(0, scope()->ContextChainLength(variable->scope())); |
if (FLAG_debug_code) { |
- // Check if we have the correct context pointer. |
- __ movq(rbx, ContextOperand(rsi, Context::FCONTEXT_INDEX)); |
- __ cmpq(rbx, rsi); |
- __ Check(equal, "Unexpected declaration in current context."); |
+ // Check that we're not inside a with or catch context. |
+ __ movq(rbx, FieldOperand(rsi, HeapObject::kMapOffset)); |
+ __ CompareRoot(rbx, Heap::kWithContextMapRootIndex); |
+ __ Check(not_equal, "Declaration in with context."); |
+ __ CompareRoot(rbx, Heap::kCatchContextMapRootIndex); |
+ __ Check(not_equal, "Declaration in catch context."); |
} |
if (mode == Variable::CONST) { |
__ LoadRoot(kScratchRegister, Heap::kTheHoleValueRootIndex); |
@@ -1778,17 +1781,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, |
__ j(not_equal, &skip); |
__ movq(Operand(rbp, SlotOffset(slot)), rax); |
break; |
- case Slot::CONTEXT: { |
- __ movq(rcx, ContextOperand(rsi, Context::FCONTEXT_INDEX)); |
- __ movq(rdx, ContextOperand(rcx, slot->index())); |
- __ CompareRoot(rdx, Heap::kTheHoleValueRootIndex); |
- __ j(not_equal, &skip); |
- __ movq(ContextOperand(rcx, slot->index()), rax); |
- int offset = Context::SlotOffset(slot->index()); |
- __ movq(rdx, rax); // Preserve the stored value in eax. |
- __ RecordWrite(rcx, offset, rdx, rbx); |
- break; |
- } |
+ case Slot::CONTEXT: |
case Slot::LOOKUP: |
__ push(rax); |
__ push(rsi); |