Index: src/crankshaft/s390/lithium-codegen-s390.cc |
diff --git a/src/crankshaft/s390/lithium-codegen-s390.cc b/src/crankshaft/s390/lithium-codegen-s390.cc |
index bbc8f839451389c73bc629f623f4447938815768..7b287c9844ef899f292e1588948440efcfe38a8e 100644 |
--- a/src/crankshaft/s390/lithium-codegen-s390.cc |
+++ b/src/crankshaft/s390/lithium-codegen-s390.cc |
@@ -2634,6 +2634,17 @@ void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
Register context = ToRegister(instr->context()); |
Register result = ToRegister(instr->result()); |
__ LoadP(result, ContextMemOperand(context, instr->slot_index())); |
+ if (instr->hydrogen()->RequiresHoleCheck()) { |
+ __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
+ if (instr->hydrogen()->DeoptimizesOnHole()) { |
+ DeoptimizeIf(eq, instr, DeoptimizeReason::kHole); |
+ } else { |
+ Label skip; |
+ __ bne(&skip, Label::kNear); |
+ __ mov(result, Operand(factory()->undefined_value())); |
+ __ bind(&skip); |
+ } |
+ } |
} |
void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
@@ -2642,6 +2653,18 @@ void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
Register scratch = scratch0(); |
MemOperand target = ContextMemOperand(context, instr->slot_index()); |
+ Label skip_assignment; |
+ |
+ if (instr->hydrogen()->RequiresHoleCheck()) { |
+ __ LoadP(scratch, target); |
+ __ CompareRoot(scratch, Heap::kTheHoleValueRootIndex); |
+ if (instr->hydrogen()->DeoptimizesOnHole()) { |
+ DeoptimizeIf(eq, instr, DeoptimizeReason::kHole); |
+ } else { |
+ __ bne(&skip_assignment); |
+ } |
+ } |
+ |
__ StoreP(value, target); |
if (instr->hydrogen()->NeedsWriteBarrier()) { |
SmiCheck check_needed = instr->hydrogen()->value()->type().IsHeapObject() |
@@ -2651,6 +2674,8 @@ void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
GetLinkRegisterState(), kSaveFPRegs, |
EMIT_REMEMBERED_SET, check_needed); |
} |
+ |
+ __ bind(&skip_assignment); |
} |
void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |