[crankshaft] Remove dead Variable hole-checking code
This is a follow-up on 45c11887929c1f0fbc54849d2627cd8bb90bcc37, which
removed hole checks from full-codegen. Variables requiring hole checks
always go through Ignition.
R=bmeurer@chromium.org
Review-Url: https://codereview.chromium.org/2622783002
Cr-Commit-Position: refs/heads/master@{#42196}
diff --git a/src/bailout-reason.h b/src/bailout-reason.h
index 23af63e..d9e9215 100644
--- a/src/bailout-reason.h
+++ b/src/bailout-reason.h
@@ -20,8 +20,6 @@
V(kArgumentsObjectValueInATestContext, \
"Arguments object value in a test context") \
V(kArrayIndexConstantValueTooBig, "Array index constant value too big") \
- V(kAssignmentToLetVariableBeforeInitialization, \
- "Assignment to let variable before initialization") \
V(kAssignmentToLOOKUPVariable, "Assignment to LOOKUP variable") \
V(kAssignmentToParameterFunctionUsesArgumentsObject, \
"Assignment to parameter, function uses arguments object") \
@@ -245,7 +243,6 @@
"Unexpected type for RegExp data, FixedArray expected") \
V(kUnexpectedValue, "Unexpected value") \
V(kUnsupportedDoubleImmediate, "Unsupported double immediate") \
- V(kUnsupportedLetCompoundAssignment, "Unsupported let compound assignment") \
V(kUnsupportedLookupSlotInDeclaration, \
"Unsupported lookup slot in declaration") \
V(kUnsupportedModuleOperation, "Unsupported module operation") \
diff --git a/src/crankshaft/arm/lithium-arm.cc b/src/crankshaft/arm/lithium-arm.cc
index 823f5a9..62aa9b2 100644
--- a/src/crankshaft/arm/lithium-arm.cc
+++ b/src/crankshaft/arm/lithium-arm.cc
@@ -1975,12 +1975,7 @@
LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
LOperand* context = UseRegisterAtStart(instr->value());
- LInstruction* result =
- DefineAsRegister(new(zone()) LLoadContextSlot(context));
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return DefineAsRegister(new (zone()) LLoadContextSlot(context));
}
@@ -1994,11 +1989,7 @@
context = UseRegister(instr->context());
value = UseRegister(instr->value());
}
- LInstruction* result = new(zone()) LStoreContextSlot(context, value);
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return new (zone()) LStoreContextSlot(context, value);
}
diff --git a/src/crankshaft/arm/lithium-codegen-arm.cc b/src/crankshaft/arm/lithium-codegen-arm.cc
index 07accfb..10b0f84 100644
--- a/src/crankshaft/arm/lithium-codegen-arm.cc
+++ b/src/crankshaft/arm/lithium-codegen-arm.cc
@@ -2567,15 +2567,6 @@
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);
- }
- }
}
@@ -2585,19 +2576,6 @@
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 =
@@ -2612,8 +2590,6 @@
EMIT_REMEMBERED_SET,
check_needed);
}
-
- __ bind(&skip_assignment);
}
diff --git a/src/crankshaft/arm64/lithium-arm64.cc b/src/crankshaft/arm64/lithium-arm64.cc
index e5227e3..9258ff7 100644
--- a/src/crankshaft/arm64/lithium-arm64.cc
+++ b/src/crankshaft/arm64/lithium-arm64.cc
@@ -1507,12 +1507,7 @@
LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
LOperand* context = UseRegisterAtStart(instr->value());
- LInstruction* result =
- DefineAsRegister(new(zone()) LLoadContextSlot(context));
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return DefineAsRegister(new (zone()) LLoadContextSlot(context));
}
@@ -2098,11 +2093,7 @@
context = UseRegister(instr->context());
value = UseRegister(instr->value());
}
- LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp);
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return new (zone()) LStoreContextSlot(context, value, temp);
}
diff --git a/src/crankshaft/arm64/lithium-codegen-arm64.cc b/src/crankshaft/arm64/lithium-codegen-arm64.cc
index 141ac3f..07b8355 100644
--- a/src/crankshaft/arm64/lithium-codegen-arm64.cc
+++ b/src/crankshaft/arm64/lithium-codegen-arm64.cc
@@ -2969,17 +2969,6 @@
Register context = ToRegister(instr->context());
Register result = ToRegister(instr->result());
__ Ldr(result, ContextMemOperand(context, instr->slot_index()));
- if (instr->hydrogen()->RequiresHoleCheck()) {
- if (instr->hydrogen()->DeoptimizesOnHole()) {
- DeoptimizeIfRoot(result, Heap::kTheHoleValueRootIndex, instr,
- DeoptimizeReason::kHole);
- } else {
- Label not_the_hole;
- __ JumpIfNotRoot(result, Heap::kTheHoleValueRootIndex, ¬_the_hole);
- __ LoadRoot(result, Heap::kUndefinedValueRootIndex);
- __ Bind(¬_the_hole);
- }
- }
}
@@ -4683,18 +4672,6 @@
Register scratch = ToRegister(instr->temp());
MemOperand target = ContextMemOperand(context, instr->slot_index());
- Label skip_assignment;
-
- if (instr->hydrogen()->RequiresHoleCheck()) {
- __ Ldr(scratch, target);
- if (instr->hydrogen()->DeoptimizesOnHole()) {
- DeoptimizeIfRoot(scratch, Heap::kTheHoleValueRootIndex, instr,
- DeoptimizeReason::kHole);
- } else {
- __ JumpIfNotRoot(scratch, Heap::kTheHoleValueRootIndex, &skip_assignment);
- }
- }
-
__ Str(value, target);
if (instr->hydrogen()->NeedsWriteBarrier()) {
SmiCheck check_needed =
@@ -4704,7 +4681,6 @@
scratch, GetLinkRegisterState(), kSaveFPRegs,
EMIT_REMEMBERED_SET, check_needed);
}
- __ Bind(&skip_assignment);
}
diff --git a/src/crankshaft/hydrogen-instructions.h b/src/crankshaft/hydrogen-instructions.h
index 7ffb2a3..3b8a459 100644
--- a/src/crankshaft/hydrogen-instructions.h
+++ b/src/crankshaft/hydrogen-instructions.h
@@ -4947,33 +4947,14 @@
class HLoadContextSlot final : public HUnaryOperation {
public:
- enum Mode {
- // Perform a normal load of the context slot without checking its value.
- kNoCheck,
- // Load and check the value of the context slot. Deoptimize if it's the
- // hole value. This is used for checking for loading of uninitialized
- // harmony bindings where we deoptimize into full-codegen generated code
- // which will subsequently throw a reference error.
- kCheckDeoptimize
- };
-
- HLoadContextSlot(HValue* context, int slot_index, Mode mode)
- : HUnaryOperation(context), slot_index_(slot_index), mode_(mode) {
+ HLoadContextSlot(HValue* context, int slot_index)
+ : HUnaryOperation(context), slot_index_(slot_index) {
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
SetDependsOnFlag(kContextSlots);
}
int slot_index() const { return slot_index_; }
- Mode mode() const { return mode_; }
-
- bool DeoptimizesOnHole() {
- return mode_ == kCheckDeoptimize;
- }
-
- bool RequiresHoleCheck() const {
- return mode_ != kNoCheck;
- }
Representation RequiredInputRepresentation(int index) override {
return Representation::Tagged();
@@ -4990,46 +4971,24 @@
}
private:
- bool IsDeletable() const override { return !RequiresHoleCheck(); }
+ bool IsDeletable() const override { return true; }
int slot_index_;
- Mode mode_;
};
class HStoreContextSlot final : public HTemplateInstruction<2> {
public:
- enum Mode {
- // Perform a normal store to the context slot without checking its previous
- // value.
- kNoCheck,
- // Check the previous value of the context slot and deoptimize if it's the
- // hole value. This is used for checking for assignments to uninitialized
- // harmony bindings where we deoptimize into full-codegen generated code
- // which will subsequently throw a reference error.
- kCheckDeoptimize
- };
-
- DECLARE_INSTRUCTION_FACTORY_P4(HStoreContextSlot, HValue*, int,
- Mode, HValue*);
+ DECLARE_INSTRUCTION_FACTORY_P3(HStoreContextSlot, HValue*, int, HValue*);
HValue* context() const { return OperandAt(0); }
HValue* value() const { return OperandAt(1); }
int slot_index() const { return slot_index_; }
- Mode mode() const { return mode_; }
bool NeedsWriteBarrier() {
return StoringValueNeedsWriteBarrier(value());
}
- bool DeoptimizesOnHole() {
- return mode_ == kCheckDeoptimize;
- }
-
- bool RequiresHoleCheck() {
- return mode_ != kNoCheck;
- }
-
Representation RequiredInputRepresentation(int index) override {
return Representation::Tagged();
}
@@ -5039,15 +4998,14 @@
DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot)
private:
- HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value)
- : slot_index_(slot_index), mode_(mode) {
+ HStoreContextSlot(HValue* context, int slot_index, HValue* value)
+ : slot_index_(slot_index) {
SetOperandAt(0, context);
SetOperandAt(1, value);
SetChangesFlag(kContextSlots);
}
int slot_index_;
- Mode mode_;
};
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index b2c09d1..8f21f3c 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -4243,8 +4243,7 @@
if (declaration_scope->is_script_scope() ||
declaration_scope->is_eval_scope()) {
function = new (zone())
- HLoadContextSlot(outer_context, Context::CLOSURE_INDEX,
- HLoadContextSlot::kNoCheck);
+ HLoadContextSlot(outer_context, Context::CLOSURE_INDEX);
} else {
function = New<HThisFunction>();
}
@@ -5236,12 +5235,9 @@
DCHECK(current_block() != NULL);
DCHECK(current_block()->HasPredecessor());
Variable* variable = expr->var();
+ DCHECK(!variable->binding_needs_init());
switch (variable->location()) {
case VariableLocation::UNALLOCATED: {
- if (IsLexicalVariableMode(variable->mode())) {
- // TODO(rossberg): should this be an DCHECK?
- return Bailout(kReferenceToGlobalLexicalVariable);
- }
// Handle known global constants like 'undefined' specially to avoid a
// load from a global cell for them.
Handle<Object> constant_value =
@@ -5303,28 +5299,13 @@
case VariableLocation::PARAMETER:
case VariableLocation::LOCAL: {
HValue* value = LookupAndMakeLive(variable);
- if (value == graph()->GetConstantHole()) {
- DCHECK(IsDeclaredVariableMode(variable->mode()) &&
- variable->mode() != VAR);
- return Bailout(kReferenceToUninitializedVariable);
- }
return ast_context()->ReturnValue(value);
}
case VariableLocation::CONTEXT: {
HValue* context = BuildContextChainWalk(variable);
- HLoadContextSlot::Mode mode;
- switch (variable->mode()) {
- case LET:
- case CONST:
- mode = HLoadContextSlot::kCheckDeoptimize;
- break;
- default:
- mode = HLoadContextSlot::kNoCheck;
- break;
- }
HLoadContextSlot* instr =
- new(zone()) HLoadContextSlot(context, variable->index(), mode);
+ new (zone()) HLoadContextSlot(context, variable->index());
return ast_context()->ReturnInstruction(instr, expr->id());
}
@@ -6542,9 +6523,7 @@
if (proxy != NULL) {
Variable* var = proxy->var();
- if (var->mode() == LET) {
- return Bailout(kUnsupportedLetCompoundAssignment);
- }
+ DCHECK(!var->binding_needs_init());
CHECK_ALIVE(VisitForValue(operation));
@@ -6578,25 +6557,17 @@
}
}
- HStoreContextSlot::Mode mode;
-
- switch (var->mode()) {
- case LET:
- mode = HStoreContextSlot::kCheckDeoptimize;
- break;
- case CONST:
- if (var->throw_on_const_assignment(function_language_mode())) {
- return Bailout(kNonInitializerAssignmentToConst);
- } else {
- return ast_context()->ReturnValue(Pop());
- }
- default:
- mode = HStoreContextSlot::kNoCheck;
+ if (var->mode() == CONST) {
+ if (var->throw_on_const_assignment(function_language_mode())) {
+ return Bailout(kNonInitializerAssignmentToConst);
+ } else {
+ return ast_context()->ReturnValue(Pop());
+ }
}
HValue* context = BuildContextChainWalk(var);
- HStoreContextSlot* instr = Add<HStoreContextSlot>(
- context, var->index(), mode, Top());
+ HStoreContextSlot* instr =
+ Add<HStoreContextSlot>(context, var->index(), Top());
if (instr->HasObservableSideEffects()) {
Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE);
}
@@ -6654,15 +6625,14 @@
HandlePropertyAssignment(expr);
} else if (proxy != NULL) {
Variable* var = proxy->var();
+ DCHECK(!var->binding_needs_init());
- if (var->mode() == CONST) {
- if (expr->op() != Token::INIT) {
- if (var->throw_on_const_assignment(function_language_mode())) {
- return Bailout(kNonInitializerAssignmentToConst);
- } else {
- CHECK_ALIVE(VisitForValue(expr->value()));
- return ast_context()->ReturnValue(Pop());
- }
+ if (var->mode() == CONST && expr->op() != Token::INIT) {
+ if (var->throw_on_const_assignment(function_language_mode())) {
+ return Bailout(kNonInitializerAssignmentToConst);
+ } else {
+ CHECK_ALIVE(VisitForValue(expr->value()));
+ return ast_context()->ReturnValue(Pop());
}
}
@@ -6676,14 +6646,6 @@
case VariableLocation::PARAMETER:
case VariableLocation::LOCAL: {
- // Perform an initialization check for let declared variables
- // or parameters.
- if (var->mode() == LET && expr->op() == Token::ASSIGN) {
- HValue* env_value = environment()->Lookup(var);
- if (env_value == graph()->GetConstantHole()) {
- return Bailout(kAssignmentToLetVariableBeforeInitialization);
- }
- }
// We do not allow the arguments object to occur in a context where it
// may escape, but assignments to stack-allocated locals are
// permitted.
@@ -6709,29 +6671,9 @@
}
CHECK_ALIVE(VisitForValue(expr->value()));
- HStoreContextSlot::Mode mode;
- if (expr->op() == Token::ASSIGN) {
- switch (var->mode()) {
- case LET:
- mode = HStoreContextSlot::kCheckDeoptimize;
- break;
- case CONST:
- // If we reached this point, the only possibility
- // is a sloppy assignment to a function name.
- DCHECK(function_language_mode() == SLOPPY &&
- !var->throw_on_const_assignment(SLOPPY));
- return ast_context()->ReturnValue(Pop());
- default:
- mode = HStoreContextSlot::kNoCheck;
- }
- } else {
- DCHECK_EQ(Token::INIT, expr->op());
- mode = HStoreContextSlot::kNoCheck;
- }
-
HValue* context = BuildContextChainWalk(var);
- HStoreContextSlot* instr = Add<HStoreContextSlot>(
- context, var->index(), mode, Top());
+ HStoreContextSlot* instr =
+ Add<HStoreContextSlot>(context, var->index(), Top());
if (instr->HasObservableSideEffects()) {
Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE);
}
@@ -10461,6 +10403,7 @@
if (proxy != NULL) {
Variable* var = proxy->var();
+ DCHECK(!var->binding_needs_init());
if (var->mode() == CONST) {
return Bailout(kNonInitializerAssignmentToConst);
}
@@ -10485,10 +10428,8 @@
case VariableLocation::CONTEXT: {
HValue* context = BuildContextChainWalk(var);
- HStoreContextSlot::Mode mode = IsLexicalVariableMode(var->mode())
- ? HStoreContextSlot::kCheckDeoptimize : HStoreContextSlot::kNoCheck;
- HStoreContextSlot* instr = Add<HStoreContextSlot>(context, var->index(),
- mode, after);
+ HStoreContextSlot* instr =
+ Add<HStoreContextSlot>(context, var->index(), after);
if (instr->HasObservableSideEffects()) {
Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE);
}
@@ -11870,9 +11811,9 @@
VariableDeclaration* declaration) {
VariableProxy* proxy = declaration->proxy();
Variable* variable = proxy->var();
+ DCHECK(!variable->binding_needs_init());
switch (variable->location()) {
case VariableLocation::UNALLOCATED: {
- DCHECK(!variable->binding_needs_init());
globals_.Add(variable->name(), zone());
FeedbackVectorSlot slot = proxy->VariableFeedbackSlot();
DCHECK(!slot.IsInvalid());
@@ -11882,21 +11823,7 @@
}
case VariableLocation::PARAMETER:
case VariableLocation::LOCAL:
- if (variable->binding_needs_init()) {
- HValue* value = graph()->GetConstantHole();
- environment()->Bind(variable, value);
- }
- break;
case VariableLocation::CONTEXT:
- if (variable->binding_needs_init()) {
- HValue* value = graph()->GetConstantHole();
- HValue* context = environment()->context();
- HStoreContextSlot* store = Add<HStoreContextSlot>(
- context, variable->index(), HStoreContextSlot::kNoCheck, value);
- if (store->HasObservableSideEffects()) {
- Add<HSimulate>(proxy->id(), REMOVABLE_SIMULATE);
- }
- }
break;
case VariableLocation::LOOKUP:
return Bailout(kUnsupportedLookupSlotInDeclaration);
@@ -11934,8 +11861,8 @@
CHECK_ALIVE(VisitForValue(declaration->fun()));
HValue* value = Pop();
HValue* context = environment()->context();
- HStoreContextSlot* store = Add<HStoreContextSlot>(
- context, variable->index(), HStoreContextSlot::kNoCheck, value);
+ HStoreContextSlot* store =
+ Add<HStoreContextSlot>(context, variable->index(), value);
if (store->HasObservableSideEffects()) {
Add<HSimulate>(proxy->id(), REMOVABLE_SIMULATE);
}
diff --git a/src/crankshaft/ia32/lithium-codegen-ia32.cc b/src/crankshaft/ia32/lithium-codegen-ia32.cc
index 6401e56..d18ef4f 100644
--- a/src/crankshaft/ia32/lithium-codegen-ia32.cc
+++ b/src/crankshaft/ia32/lithium-codegen-ia32.cc
@@ -2364,36 +2364,13 @@
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()) {
@@ -2410,8 +2387,6 @@
EMIT_REMEMBERED_SET,
check_needed);
}
-
- __ bind(&skip_assignment);
}
diff --git a/src/crankshaft/ia32/lithium-ia32.cc b/src/crankshaft/ia32/lithium-ia32.cc
index 7272a91..ca47998 100644
--- a/src/crankshaft/ia32/lithium-ia32.cc
+++ b/src/crankshaft/ia32/lithium-ia32.cc
@@ -1985,12 +1985,7 @@
LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
LOperand* context = UseRegisterAtStart(instr->value());
- LInstruction* result =
- DefineAsRegister(new(zone()) LLoadContextSlot(context));
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return DefineAsRegister(new (zone()) LLoadContextSlot(context));
}
@@ -2005,11 +2000,7 @@
value = UseRegister(instr->value());
temp = NULL;
}
- LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp);
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return new (zone()) LStoreContextSlot(context, value, temp);
}
diff --git a/src/crankshaft/mips/lithium-codegen-mips.cc b/src/crankshaft/mips/lithium-codegen-mips.cc
index df2f371..c295ae1 100644
--- a/src/crankshaft/mips/lithium-codegen-mips.cc
+++ b/src/crankshaft/mips/lithium-codegen-mips.cc
@@ -2484,18 +2484,6 @@
Register result = ToRegister(instr->result());
__ lw(result, ContextMemOperand(context, instr->slot_index()));
- if (instr->hydrogen()->RequiresHoleCheck()) {
- __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
-
- if (instr->hydrogen()->DeoptimizesOnHole()) {
- DeoptimizeIf(eq, instr, DeoptimizeReason::kHole, result, Operand(at));
- } else {
- Label is_not_hole;
- __ Branch(&is_not_hole, ne, result, Operand(at));
- __ LoadRoot(result, Heap::kUndefinedValueRootIndex);
- __ bind(&is_not_hole);
- }
- }
}
@@ -2505,19 +2493,6 @@
Register scratch = scratch0();
MemOperand target = ContextMemOperand(context, instr->slot_index());
- Label skip_assignment;
-
- if (instr->hydrogen()->RequiresHoleCheck()) {
- __ lw(scratch, target);
- __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
-
- if (instr->hydrogen()->DeoptimizesOnHole()) {
- DeoptimizeIf(eq, instr, DeoptimizeReason::kHole, scratch, Operand(at));
- } else {
- __ Branch(&skip_assignment, ne, scratch, Operand(at));
- }
- }
-
__ sw(value, target);
if (instr->hydrogen()->NeedsWriteBarrier()) {
SmiCheck check_needed =
@@ -2532,8 +2507,6 @@
EMIT_REMEMBERED_SET,
check_needed);
}
-
- __ bind(&skip_assignment);
}
diff --git a/src/crankshaft/mips/lithium-mips.cc b/src/crankshaft/mips/lithium-mips.cc
index 26d422a..544b661 100644
--- a/src/crankshaft/mips/lithium-mips.cc
+++ b/src/crankshaft/mips/lithium-mips.cc
@@ -1922,12 +1922,7 @@
LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
LOperand* context = UseRegisterAtStart(instr->value());
- LInstruction* result =
- DefineAsRegister(new(zone()) LLoadContextSlot(context));
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return DefineAsRegister(new (zone()) LLoadContextSlot(context));
}
@@ -1941,11 +1936,7 @@
context = UseRegister(instr->context());
value = UseRegister(instr->value());
}
- LInstruction* result = new(zone()) LStoreContextSlot(context, value);
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return new (zone()) LStoreContextSlot(context, value);
}
diff --git a/src/crankshaft/mips64/lithium-codegen-mips64.cc b/src/crankshaft/mips64/lithium-codegen-mips64.cc
index 0730cb9..f1b7de5 100644
--- a/src/crankshaft/mips64/lithium-codegen-mips64.cc
+++ b/src/crankshaft/mips64/lithium-codegen-mips64.cc
@@ -2607,18 +2607,6 @@
Register result = ToRegister(instr->result());
__ ld(result, ContextMemOperand(context, instr->slot_index()));
- if (instr->hydrogen()->RequiresHoleCheck()) {
- __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
-
- if (instr->hydrogen()->DeoptimizesOnHole()) {
- DeoptimizeIf(eq, instr, DeoptimizeReason::kHole, result, Operand(at));
- } else {
- Label is_not_hole;
- __ Branch(&is_not_hole, ne, result, Operand(at));
- __ LoadRoot(result, Heap::kUndefinedValueRootIndex);
- __ bind(&is_not_hole);
- }
- }
}
@@ -2628,19 +2616,6 @@
Register scratch = scratch0();
MemOperand target = ContextMemOperand(context, instr->slot_index());
- Label skip_assignment;
-
- if (instr->hydrogen()->RequiresHoleCheck()) {
- __ ld(scratch, target);
- __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
-
- if (instr->hydrogen()->DeoptimizesOnHole()) {
- DeoptimizeIf(eq, instr, DeoptimizeReason::kHole, scratch, Operand(at));
- } else {
- __ Branch(&skip_assignment, ne, scratch, Operand(at));
- }
- }
-
__ sd(value, target);
if (instr->hydrogen()->NeedsWriteBarrier()) {
SmiCheck check_needed =
@@ -2655,8 +2630,6 @@
EMIT_REMEMBERED_SET,
check_needed);
}
-
- __ bind(&skip_assignment);
}
diff --git a/src/crankshaft/mips64/lithium-mips64.cc b/src/crankshaft/mips64/lithium-mips64.cc
index fd0ebc8..3ad0876 100644
--- a/src/crankshaft/mips64/lithium-mips64.cc
+++ b/src/crankshaft/mips64/lithium-mips64.cc
@@ -1925,12 +1925,7 @@
LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
LOperand* context = UseRegisterAtStart(instr->value());
- LInstruction* result =
- DefineAsRegister(new(zone()) LLoadContextSlot(context));
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return DefineAsRegister(new (zone()) LLoadContextSlot(context));
}
@@ -1944,11 +1939,7 @@
context = UseRegister(instr->context());
value = UseRegister(instr->value());
}
- LInstruction* result = new(zone()) LStoreContextSlot(context, value);
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return new (zone()) LStoreContextSlot(context, value);
}
diff --git a/src/crankshaft/ppc/lithium-codegen-ppc.cc b/src/crankshaft/ppc/lithium-codegen-ppc.cc
index f546dc2..2956fcc 100644
--- a/src/crankshaft/ppc/lithium-codegen-ppc.cc
+++ b/src/crankshaft/ppc/lithium-codegen-ppc.cc
@@ -2658,26 +2658,6 @@
Register context = ToRegister(instr->context());
Register result = ToRegister(instr->result());
__ LoadP(result, ContextMemOperand(context, instr->slot_index()));
- if (instr->hydrogen()->RequiresHoleCheck()) {
- __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
- if (instr->hydrogen()->DeoptimizesOnHole()) {
- __ cmp(result, ip);
- DeoptimizeIf(eq, instr, DeoptimizeReason::kHole);
- } else {
- if (CpuFeatures::IsSupported(ISELECT)) {
- Register scratch = scratch0();
- __ mov(scratch, Operand(factory()->undefined_value()));
- __ cmp(result, ip);
- __ isel(eq, result, scratch, result);
- } else {
- Label skip;
- __ cmp(result, ip);
- __ bne(&skip);
- __ mov(result, Operand(factory()->undefined_value()));
- __ bind(&skip);
- }
- }
- }
}
@@ -2687,19 +2667,6 @@
Register scratch = scratch0();
MemOperand target = ContextMemOperand(context, instr->slot_index());
- Label skip_assignment;
-
- if (instr->hydrogen()->RequiresHoleCheck()) {
- __ LoadP(scratch, target);
- __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
- __ cmp(scratch, ip);
- if (instr->hydrogen()->DeoptimizesOnHole()) {
- DeoptimizeIf(eq, instr, DeoptimizeReason::kHole);
- } else {
- __ bne(&skip_assignment);
- }
- }
-
__ StoreP(value, target, r0);
if (instr->hydrogen()->NeedsWriteBarrier()) {
SmiCheck check_needed = instr->hydrogen()->value()->type().IsHeapObject()
@@ -2709,8 +2676,6 @@
GetLinkRegisterState(), kSaveFPRegs,
EMIT_REMEMBERED_SET, check_needed);
}
-
- __ bind(&skip_assignment);
}
diff --git a/src/crankshaft/ppc/lithium-ppc.cc b/src/crankshaft/ppc/lithium-ppc.cc
index 75aec2f..f45c31c 100644
--- a/src/crankshaft/ppc/lithium-ppc.cc
+++ b/src/crankshaft/ppc/lithium-ppc.cc
@@ -1950,12 +1950,7 @@
LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
LOperand* context = UseRegisterAtStart(instr->value());
- LInstruction* result =
- DefineAsRegister(new (zone()) LLoadContextSlot(context));
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return DefineAsRegister(new (zone()) LLoadContextSlot(context));
}
@@ -1969,11 +1964,7 @@
context = UseRegister(instr->context());
value = UseRegister(instr->value());
}
- LInstruction* result = new (zone()) LStoreContextSlot(context, value);
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return new (zone()) LStoreContextSlot(context, value);
}
diff --git a/src/crankshaft/s390/lithium-codegen-s390.cc b/src/crankshaft/s390/lithium-codegen-s390.cc
index 7b287c9..bbc8f839 100644
--- a/src/crankshaft/s390/lithium-codegen-s390.cc
+++ b/src/crankshaft/s390/lithium-codegen-s390.cc
@@ -2634,17 +2634,6 @@
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) {
@@ -2653,18 +2642,6 @@
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()
@@ -2674,8 +2651,6 @@
GetLinkRegisterState(), kSaveFPRegs,
EMIT_REMEMBERED_SET, check_needed);
}
-
- __ bind(&skip_assignment);
}
void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
diff --git a/src/crankshaft/s390/lithium-s390.cc b/src/crankshaft/s390/lithium-s390.cc
index 79868f5..ae7e8db 100644
--- a/src/crankshaft/s390/lithium-s390.cc
+++ b/src/crankshaft/s390/lithium-s390.cc
@@ -1766,12 +1766,7 @@
LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
LOperand* context = UseRegisterAtStart(instr->value());
- LInstruction* result =
- DefineAsRegister(new (zone()) LLoadContextSlot(context));
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return DefineAsRegister(new (zone()) LLoadContextSlot(context));
}
LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
@@ -1784,11 +1779,7 @@
context = UseRegister(instr->context());
value = UseRegister(instr->value());
}
- LInstruction* result = new (zone()) LStoreContextSlot(context, value);
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return new (zone()) LStoreContextSlot(context, value);
}
LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
diff --git a/src/crankshaft/x64/lithium-codegen-x64.cc b/src/crankshaft/x64/lithium-codegen-x64.cc
index f09af713..4b36f96 100644
--- a/src/crankshaft/x64/lithium-codegen-x64.cc
+++ b/src/crankshaft/x64/lithium-codegen-x64.cc
@@ -2505,37 +2505,15 @@
Register context = ToRegister(instr->context());
Register result = ToRegister(instr->result());
__ movp(result, ContextOperand(context, instr->slot_index()));
- if (instr->hydrogen()->RequiresHoleCheck()) {
- __ CompareRoot(result, Heap::kTheHoleValueRootIndex);
- if (instr->hydrogen()->DeoptimizesOnHole()) {
- DeoptimizeIf(equal, instr, DeoptimizeReason::kHole);
- } else {
- Label is_not_hole;
- __ j(not_equal, &is_not_hole, Label::kNear);
- __ LoadRoot(result, Heap::kUndefinedValueRootIndex);
- __ bind(&is_not_hole);
- }
- }
}
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);
- if (instr->hydrogen()->DeoptimizesOnHole()) {
- DeoptimizeIf(equal, instr, DeoptimizeReason::kHole);
- } else {
- __ j(not_equal, &skip_assignment);
- }
- }
__ movp(target, value);
-
if (instr->hydrogen()->NeedsWriteBarrier()) {
SmiCheck check_needed =
instr->hydrogen()->value()->type().IsHeapObject()
@@ -2550,8 +2528,6 @@
EMIT_REMEMBERED_SET,
check_needed);
}
-
- __ bind(&skip_assignment);
}
diff --git a/src/crankshaft/x64/lithium-x64.cc b/src/crankshaft/x64/lithium-x64.cc
index bc9040b..318593e 100644
--- a/src/crankshaft/x64/lithium-x64.cc
+++ b/src/crankshaft/x64/lithium-x64.cc
@@ -1961,12 +1961,7 @@
LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
LOperand* context = UseRegisterAtStart(instr->value());
- LInstruction* result =
- DefineAsRegister(new(zone()) LLoadContextSlot(context));
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return DefineAsRegister(new (zone()) LLoadContextSlot(context));
}
@@ -1982,11 +1977,7 @@
value = UseRegister(instr->value());
temp = NULL;
}
- LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp);
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return new (zone()) LStoreContextSlot(context, value, temp);
}
diff --git a/src/crankshaft/x87/lithium-codegen-x87.cc b/src/crankshaft/x87/lithium-codegen-x87.cc
index 9c932bc..20df767 100644
--- a/src/crankshaft/x87/lithium-codegen-x87.cc
+++ b/src/crankshaft/x87/lithium-codegen-x87.cc
@@ -2648,36 +2648,13 @@
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()) {
@@ -2689,8 +2666,6 @@
__ RecordWriteContextSlot(context, offset, value, temp, kSaveFPRegs,
EMIT_REMEMBERED_SET, check_needed);
}
-
- __ bind(&skip_assignment);
}
diff --git a/src/crankshaft/x87/lithium-x87.cc b/src/crankshaft/x87/lithium-x87.cc
index 1844d24..2714f55 100644
--- a/src/crankshaft/x87/lithium-x87.cc
+++ b/src/crankshaft/x87/lithium-x87.cc
@@ -1981,12 +1981,7 @@
LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
LOperand* context = UseRegisterAtStart(instr->value());
- LInstruction* result =
- DefineAsRegister(new(zone()) LLoadContextSlot(context));
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return DefineAsRegister(new (zone()) LLoadContextSlot(context));
}
@@ -2001,11 +1996,7 @@
value = UseRegister(instr->value());
temp = NULL;
}
- LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp);
- if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
- result = AssignEnvironment(result);
- }
- return result;
+ return new (zone()) LStoreContextSlot(context, value, temp);
}
diff --git a/test/cctest/interpreter/bytecode_expectations/Generators.golden b/test/cctest/interpreter/bytecode_expectations/Generators.golden
index 19cfc86..4daf6e5 100644
--- a/test/cctest/interpreter/bytecode_expectations/Generators.golden
+++ b/test/cctest/interpreter/bytecode_expectations/Generators.golden
@@ -22,7 +22,7 @@
B(LdaZero),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrue), U8(53),
- B(LdaSmi), U8(78),
+ B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
@@ -135,7 +135,7 @@
B(LdaSmi), U8(1),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrueConstant), U8(0),
- B(LdaSmi), U8(78),
+ B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
@@ -289,7 +289,7 @@
B(LdaSmi), U8(1),
B(TestEqualStrict), R(3), U8(0),
B(JumpIfTrueConstant), U8(3),
- B(LdaSmi), U8(78),
+ B(LdaSmi), U8(77),
B(Star), R(4),
B(CallRuntime), U16(Runtime::kAbort), R(4), U8(1),
B(LdaSmi), U8(-2),
@@ -358,7 +358,7 @@
B(LdaSmi), U8(1),
B(TestEqualStrict), R(3), U8(0),
B(JumpIfTrueConstant), U8(8),
- B(LdaSmi), U8(78),
+ B(LdaSmi), U8(77),
B(Star), R(11),
B(CallRuntime), U16(Runtime::kAbort), R(11), U8(1),
/* 27 S> */ B(LdaContextSlot), R(1), U8(7), U8(0),
diff --git a/test/cctest/interpreter/bytecode_expectations/Modules.golden b/test/cctest/interpreter/bytecode_expectations/Modules.golden
index dff3a53..447a00a 100644
--- a/test/cctest/interpreter/bytecode_expectations/Modules.golden
+++ b/test/cctest/interpreter/bytecode_expectations/Modules.golden
@@ -22,7 +22,7 @@
B(LdaZero),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrue), U8(63),
- B(LdaSmi), U8(78),
+ B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
@@ -92,7 +92,7 @@
B(LdaZero),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrue), U8(63),
- B(LdaSmi), U8(78),
+ B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
@@ -164,7 +164,7 @@
B(LdaZero),
B(TestEqualStrict), R(2), U8(0),
B(JumpIfTrue), U8(63),
- B(LdaSmi), U8(78),
+ B(LdaSmi), U8(77),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1),
B(LdaSmi), U8(-2),
@@ -268,7 +268,7 @@
B(LdaZero),
B(TestEqualStrict), R(2), U8(0),
B(JumpIfTrue), U8(63),
- B(LdaSmi), U8(78),
+ B(LdaSmi), U8(77),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1),
B(LdaSmi), U8(-2),
@@ -357,7 +357,7 @@
B(LdaZero),
B(TestEqualStrict), R(2), U8(0),
B(JumpIfTrue), U8(67),
- B(LdaSmi), U8(78),
+ B(LdaSmi), U8(77),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1),
B(LdaSmi), U8(-2),
@@ -448,7 +448,7 @@
B(LdaZero),
B(TestEqualStrict), R(2), U8(0),
B(JumpIfTrue), U8(67),
- B(LdaSmi), U8(78),
+ B(LdaSmi), U8(77),
B(Star), R(3),
B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1),
B(LdaSmi), U8(-2),
@@ -537,7 +537,7 @@
B(LdaZero),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrue), U8(67),
- B(LdaSmi), U8(78),
+ B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
@@ -612,7 +612,7 @@
B(LdaZero),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrue), U8(67),
- B(LdaSmi), U8(78),
+ B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
@@ -701,7 +701,7 @@
B(LdaZero),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrue), U8(63),
- B(LdaSmi), U8(78),
+ B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
@@ -771,7 +771,7 @@
B(LdaZero),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrue), U8(63),
- B(LdaSmi), U8(78),
+ B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),
@@ -842,7 +842,7 @@
B(LdaZero),
B(TestEqualStrict), R(1), U8(0),
B(JumpIfTrue), U8(73),
- B(LdaSmi), U8(78),
+ B(LdaSmi), U8(77),
B(Star), R(2),
B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1),
B(LdaSmi), U8(-2),