Index: src/crankshaft/ia32/lithium-codegen-ia32.cc |
diff --git a/src/crankshaft/ia32/lithium-codegen-ia32.cc b/src/crankshaft/ia32/lithium-codegen-ia32.cc |
index d18ef4fd85f23be9ca4ad3b27d89051da216dd44..6401e560b313ee70a06becab98184408f36e4529 100644 |
--- a/src/crankshaft/ia32/lithium-codegen-ia32.cc |
+++ b/src/crankshaft/ia32/lithium-codegen-ia32.cc |
@@ -2364,13 +2364,36 @@ void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
Register context = ToRegister(instr->context()); |
Register result = ToRegister(instr->result()); |
__ mov(result, ContextOperand(context, instr->slot_index())); |
+ |
+ if (instr->hydrogen()->RequiresHoleCheck()) { |
+ __ cmp(result, factory()->the_hole_value()); |
+ if (instr->hydrogen()->DeoptimizesOnHole()) { |
+ DeoptimizeIf(equal, instr, DeoptimizeReason::kHole); |
+ } else { |
+ Label is_not_hole; |
+ __ j(not_equal, &is_not_hole, Label::kNear); |
+ __ mov(result, factory()->undefined_value()); |
+ __ bind(&is_not_hole); |
+ } |
+ } |
} |
void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
Register context = ToRegister(instr->context()); |
Register value = ToRegister(instr->value()); |
+ |
+ Label skip_assignment; |
+ |
Operand target = ContextOperand(context, instr->slot_index()); |
+ if (instr->hydrogen()->RequiresHoleCheck()) { |
+ __ cmp(target, factory()->the_hole_value()); |
+ if (instr->hydrogen()->DeoptimizesOnHole()) { |
+ DeoptimizeIf(equal, instr, DeoptimizeReason::kHole); |
+ } else { |
+ __ j(not_equal, &skip_assignment, Label::kNear); |
+ } |
+ } |
__ mov(target, value); |
if (instr->hydrogen()->NeedsWriteBarrier()) { |
@@ -2387,6 +2410,8 @@ void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
EMIT_REMEMBERED_SET, |
check_needed); |
} |
+ |
+ __ bind(&skip_assignment); |
} |