Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 293a1db6150d5825390f27df9c5bb67062f0aa82..24431402c68ac68b1ced62ee31e37cc6228bce4d 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -2069,7 +2069,14 @@ void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
__ movq(result, ContextOperand(context, instr->slot_index())); |
if (instr->hydrogen()->RequiresHoleCheck()) { |
__ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
- DeoptimizeIf(equal, instr->environment()); |
+ if (instr->hydrogen()->DeoptimizesOnHole()) { |
+ DeoptimizeIf(equal, instr->environment()); |
+ } else { |
+ Label is_not_hole; |
+ __ j(not_equal, &is_not_hole, Label::kNear); |
+ __ movq(result, factory()->undefined_value(), RelocInfo::NONE); |
+ __ bind(&is_not_hole); |
+ } |
} |
} |
@@ -2077,12 +2084,20 @@ void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
Register context = ToRegister(instr->context()); |
Register value = ToRegister(instr->value()); |
+ |
Operand target = ContextOperand(context, instr->slot_index()); |
+ |
+ Label skip_assignment; |
if (instr->hydrogen()->RequiresHoleCheck()) { |
__ CompareRoot(target, Heap::kTheHoleValueRootIndex); |
- DeoptimizeIf(equal, instr->environment()); |
+ if (instr->hydrogen()->DeoptimizesOnHole()) { |
+ DeoptimizeIf(equal, instr->environment()); |
+ } else { |
+ __ j(not_equal, &skip_assignment, Label::kNear); |
+ } |
} |
__ movq(target, value); |
+ |
if (instr->hydrogen()->NeedsWriteBarrier()) { |
HType type = instr->hydrogen()->value()->type(); |
SmiCheck check_needed = |
@@ -2097,6 +2112,8 @@ void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
EMIT_REMEMBERED_SET, |
check_needed); |
} |
+ |
+ __ bind(&skip_assignment); |
} |