Index: src/compiler/ast-graph-builder.cc |
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc |
index 26d078a322c0be84dca74699ba889bcf109e13f1..e45b615888d9647fe0ff9892c35a80d7f32fd679 100644 |
--- a/src/compiler/ast-graph-builder.cc |
+++ b/src/compiler/ast-graph-builder.cc |
@@ -1083,7 +1083,7 @@ void AstGraphBuilder::Visit(Expression* expr) { |
void AstGraphBuilder::VisitVariableDeclaration(VariableDeclaration* decl) { |
Variable* variable = decl->proxy()->var(); |
VariableMode mode = decl->mode(); |
- bool hole_init = mode == CONST || mode == CONST_LEGACY || mode == LET; |
+ bool hole_init = mode == CONST || mode == LET; |
switch (variable->location()) { |
case VariableLocation::GLOBAL: |
case VariableLocation::UNALLOCATED: { |
@@ -3293,16 +3293,6 @@ Node* AstGraphBuilder::BuildNewTargetVariable(Variable* new_target_var) { |
} |
-Node* AstGraphBuilder::BuildHoleCheckSilent(Node* value, Node* for_hole, |
- Node* not_hole) { |
- Node* the_hole = jsgraph()->TheHoleConstant(); |
- Node* check = NewNode(javascript()->StrictEqual(), value, the_hole); |
- return NewNode( |
- common()->Select(MachineRepresentation::kTagged, BranchHint::kFalse), |
- check, for_hole, not_hole); |
-} |
- |
- |
Node* AstGraphBuilder::BuildHoleCheckThenThrow(Node* value, Variable* variable, |
Node* not_hole, |
BailoutId bailout_id) { |
@@ -3376,15 +3366,7 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable, |
case VariableLocation::LOCAL: { |
// Local var, const, or let variable. |
Node* value = environment()->Lookup(variable); |
- if (mode == CONST_LEGACY) { |
- // Perform check for uninitialized legacy const variables. |
- if (value->op() == the_hole->op()) { |
- value = jsgraph()->UndefinedConstant(); |
- } else if (value->opcode() == IrOpcode::kPhi) { |
- Node* undefined = jsgraph()->UndefinedConstant(); |
- value = BuildHoleCheckSilent(value, undefined, value); |
- } |
- } else if (mode == LET || mode == CONST) { |
+ if (mode == LET || mode == CONST) { |
// Perform check for uninitialized let/const variables. |
if (value->op() == the_hole->op()) { |
value = BuildThrowReferenceError(variable, bailout_id); |
@@ -3404,11 +3386,7 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable, |
// TODO(titzer): initialization checks are redundant for already |
// initialized immutable context loads, but only specialization knows. |
// Maybe specializer should be a parameter to the graph builder? |
- if (mode == CONST_LEGACY) { |
- // Perform check for uninitialized legacy const variables. |
- Node* undefined = jsgraph()->UndefinedConstant(); |
- value = BuildHoleCheckSilent(value, undefined, value); |
- } else if (mode == LET || mode == CONST) { |
+ if (mode == LET || mode == CONST) { |
// Perform check for uninitialized let/const variables. |
value = BuildHoleCheckThenThrow(value, variable, value, bailout_id); |
} |
@@ -3485,13 +3463,7 @@ Node* AstGraphBuilder::BuildVariableAssignment( |
case VariableLocation::PARAMETER: |
case VariableLocation::LOCAL: |
// Local var, const, or let variable. |
- if (mode == CONST_LEGACY && op == Token::INIT) { |
- // Perform an initialization check for legacy const variables. |
- Node* current = environment()->Lookup(variable); |
- if (current->op() != the_hole->op()) { |
- value = BuildHoleCheckSilent(current, value, current); |
- } |
- } else if (mode == CONST_LEGACY && op != Token::INIT) { |
+ if (mode == CONST_LEGACY && op != Token::INIT) { |
// Non-initializing assignment to legacy const is |
// - exception in strict mode. |
// - ignored in sloppy mode. |
@@ -3536,13 +3508,7 @@ Node* AstGraphBuilder::BuildVariableAssignment( |
case VariableLocation::CONTEXT: { |
// Context variable (potentially up the context chain). |
int depth = current_scope()->ContextChainLength(variable->scope()); |
- if (mode == CONST_LEGACY && op == Token::INIT) { |
- // Perform an initialization check for legacy const variables. |
- const Operator* op = |
- javascript()->LoadContext(depth, variable->index(), false); |
- Node* current = NewNode(op, current_context()); |
- value = BuildHoleCheckSilent(current, value, current); |
- } else if (mode == CONST_LEGACY && op != Token::INIT) { |
+ if (mode == CONST_LEGACY && op != Token::INIT) { |
// Non-initializing assignment to legacy const is |
// - exception in strict mode. |
// - ignored in sloppy mode. |
@@ -3580,8 +3546,6 @@ Node* AstGraphBuilder::BuildVariableAssignment( |
case VariableLocation::LOOKUP: { |
// Dynamic lookup of context variable (anywhere in the chain). |
Handle<Name> name = variable->name(); |
- // TODO(mstarzinger): Use Runtime::kInitializeLegacyConstLookupSlot for |
- // initializations of const declarations. |
Node* store = BuildDynamicStore(name, value); |
PrepareFrameState(store, bailout_id, combine); |
return store; |