Index: src/x64/codegen-x64.cc |
diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc |
index 719bdf4d58ad0bf821a9e1b1bd7db9cb63e31414..d143558bc4bc3d6f441cb865773acb609ea0f72c 100644 |
--- a/src/x64/codegen-x64.cc |
+++ b/src/x64/codegen-x64.cc |
@@ -3816,8 +3816,28 @@ Operand CodeGenerator::SlotOperand(Slot* slot, Register tmp) { |
Operand CodeGenerator::ContextSlotOperandCheckExtensions(Slot* slot, |
Result tmp, |
JumpTarget* slow) { |
- UNIMPLEMENTED(); |
- return Operand(rsp, 0); |
+ ASSERT(slot->type() == Slot::CONTEXT); |
+ ASSERT(tmp.is_register()); |
+ Register context = rsi; |
+ |
+ for (Scope* s = scope(); s != slot->var()->scope(); s = s->outer_scope()) { |
+ if (s->num_heap_slots() > 0) { |
+ if (s->calls_eval()) { |
+ // Check that extension is NULL. |
+ __ cmpq(ContextOperand(context, Context::EXTENSION_INDEX), |
+ Immediate(0)); |
+ slow->Branch(not_equal, not_taken); |
+ } |
+ __ movq(tmp.reg(), ContextOperand(context, Context::CLOSURE_INDEX)); |
+ __ movq(tmp.reg(), FieldOperand(tmp.reg(), JSFunction::kContextOffset)); |
+ context = tmp.reg(); |
+ } |
+ } |
+ // Check that last extension is NULL. |
+ __ cmpq(ContextOperand(context, Context::EXTENSION_INDEX), Immediate(0)); |
+ slow->Branch(not_equal, not_taken); |
+ __ movq(tmp.reg(), ContextOperand(context, Context::FCONTEXT_INDEX)); |
+ return ContextOperand(tmp.reg(), slot->index()); |
} |