Index: src/crankshaft/arm/lithium-codegen-arm.cc |
diff --git a/src/crankshaft/arm/lithium-codegen-arm.cc b/src/crankshaft/arm/lithium-codegen-arm.cc |
index 10b0f849412f5073151678ee20b79beb5fc773e1..07accfbb080212d447f326a05399a5e6aaba13c9 100644 |
--- a/src/crankshaft/arm/lithium-codegen-arm.cc |
+++ b/src/crankshaft/arm/lithium-codegen-arm.cc |
@@ -2567,6 +2567,15 @@ void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
Register context = ToRegister(instr->context()); |
Register result = ToRegister(instr->result()); |
__ ldr(result, ContextMemOperand(context, instr->slot_index())); |
+ if (instr->hydrogen()->RequiresHoleCheck()) { |
+ __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
+ __ cmp(result, ip); |
+ if (instr->hydrogen()->DeoptimizesOnHole()) { |
+ DeoptimizeIf(eq, instr, DeoptimizeReason::kHole); |
+ } else { |
+ __ mov(result, Operand(factory()->undefined_value()), LeaveCC, eq); |
+ } |
+ } |
} |
@@ -2576,6 +2585,19 @@ void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
Register scratch = scratch0(); |
MemOperand target = ContextMemOperand(context, instr->slot_index()); |
+ Label skip_assignment; |
+ |
+ if (instr->hydrogen()->RequiresHoleCheck()) { |
+ __ ldr(scratch, target); |
+ __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
+ __ cmp(scratch, ip); |
+ if (instr->hydrogen()->DeoptimizesOnHole()) { |
+ DeoptimizeIf(eq, instr, DeoptimizeReason::kHole); |
+ } else { |
+ __ b(ne, &skip_assignment); |
+ } |
+ } |
+ |
__ str(value, target); |
if (instr->hydrogen()->NeedsWriteBarrier()) { |
SmiCheck check_needed = |
@@ -2590,6 +2612,8 @@ void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
EMIT_REMEMBERED_SET, |
check_needed); |
} |
+ |
+ __ bind(&skip_assignment); |
} |