Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 2b31f22247156d34b6452e90cd7f3dfaae9f4d7b..b0fbe4c1e52c4c38885567f9cf428301be81d968 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -2067,12 +2067,30 @@ void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
Register context = ToRegister(instr->context()); |
Register result = ToRegister(instr->result()); |
__ movq(result, ContextOperand(context, instr->slot_index())); |
+ if (instr->RequiresHoleCheck()) { |
+ Label is_not_hole; |
+ __ Cmp(result, factory()->the_hole_value()); |
+ __ j(not_equal, &is_not_hole, Label::kNear); |
+ |
+ __ movq(result, factory()->undefined_value(), RelocInfo::NONE); |
+ |
+ __ bind(&is_not_hole); |
+ } |
} |
void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
Register context = ToRegister(instr->context()); |
Register value = ToRegister(instr->value()); |
+ |
+ Label skip_assignment; |
+ |
+ if (instr->RequiresHoleCheck()) { |
+ __ Cmp(ContextOperand(context, instr->slot_index()), |
+ factory()->the_hole_value()); |
+ __ j(not_equal, &skip_assignment, Label::kNear); |
+ } |
+ |
__ movq(ContextOperand(context, instr->slot_index()), value); |
if (instr->hydrogen()->NeedsWriteBarrier()) { |
HType type = instr->hydrogen()->value()->type(); |
@@ -2088,6 +2106,8 @@ void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
EMIT_REMEMBERED_SET, |
check_needed); |
} |
+ |
+ __ bind(&skip_assignment); |
} |