Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index c0d73d8f2f479f08eaef3d01abdf224407f2daa6..2af440ab70d742defbd74cce2fd0fcd394660630 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -2085,13 +2085,22 @@ void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
Register context = ToRegister(instr->context()); |
Register result = ToRegister(instr->result()); |
__ movq(result, ContextOperand(context, instr->slot_index())); |
+ if (instr->hydrogen()->RequiresHoleCheck()) { |
+ __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
+ DeoptimizeIf(equal, instr->environment()); |
+ } |
} |
void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
Register context = ToRegister(instr->context()); |
Register value = ToRegister(instr->value()); |
- __ movq(ContextOperand(context, instr->slot_index()), value); |
+ Operand target = ContextOperand(context, instr->slot_index()); |
+ if (instr->hydrogen()->RequiresHoleCheck()) { |
+ __ CompareRoot(target, Heap::kTheHoleValueRootIndex); |
+ DeoptimizeIf(equal, instr->environment()); |
+ } |
+ __ movq(target, value); |
if (instr->hydrogen()->NeedsWriteBarrier()) { |
HType type = instr->hydrogen()->value()->type(); |
SmiCheck check_needed = |