Index: src/compiler/ast-graph-builder.cc |
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc |
index c71d24fe8c2694937eb80158dc7f669c55f099ec..08864d2c860e700347b9ab9468231d8a1062825a 100644 |
--- a/src/compiler/ast-graph-builder.cc |
+++ b/src/compiler/ast-graph-builder.cc |
@@ -535,7 +535,7 @@ bool AstGraphBuilder::CreateGraph(bool stack_check) { |
// TODO(mstarzinger): For now we cannot assume that the {this} parameter is |
// not {the_hole}, because for derived classes {this} has a TDZ and the |
// JSConstructStubForDerived magically passes {the_hole} as a receiver. |
- if (scope->has_this_declaration() && scope->receiver()->is_const_mode()) { |
+ if (scope->has_this_declaration() && scope->receiver()->mode() == CONST) { |
env.RawParameterBind(0, jsgraph()->TheHoleConstant()); |
} |
@@ -3441,15 +3441,7 @@ Node* AstGraphBuilder::BuildVariableAssignment( |
case VariableLocation::PARAMETER: |
case VariableLocation::LOCAL: |
// Local var, const, or let variable. |
- if (mode == CONST_LEGACY && op != Token::INIT) { |
- // Non-initializing assignment to legacy const is |
- // - exception in strict mode. |
- // - ignored in sloppy mode. |
- if (is_strict(language_mode())) { |
- return BuildThrowConstAssignError(bailout_id); |
- } |
- return value; |
- } else if (mode == LET && op == Token::INIT) { |
+ if (mode == LET && op == Token::INIT) { |
// No initialization check needed because scoping guarantees it. Note |
// that we still perform a lookup to keep the variable live, because |
// baseline code might contain debug code that inspects the variable. |
@@ -3472,6 +3464,16 @@ Node* AstGraphBuilder::BuildVariableAssignment( |
if (current->op() != the_hole->op() && variable->is_this()) { |
value = BuildHoleCheckElseThrow(current, variable, value, bailout_id); |
} |
+ } else if (mode == CONST && op != Token::INIT && |
+ variable->is_sloppy_function_name()) { |
+ // Non-initializing assignment to sloppy function names is |
+ // - exception in strict mode. |
+ // - ignored in sloppy mode. |
+ DCHECK(!variable->binding_needs_init()); |
+ if (variable->throw_on_const_assignment(language_mode())) { |
+ return BuildThrowConstAssignError(bailout_id); |
+ } |
+ return value; |
} else if (mode == CONST && op != Token::INIT) { |
if (variable->binding_needs_init()) { |
Node* current = environment()->Lookup(variable); |
@@ -3489,16 +3491,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) { |
- // Non-initializing assignment to legacy const is |
- // - exception in strict mode. |
- // - ignored in sloppy mode. |
- if (is_strict(language_mode())) { |
- return BuildThrowConstAssignError(bailout_id); |
- } |
- return value; |
- } else if (mode == LET && op != Token::INIT && |
- variable->binding_needs_init()) { |
+ if (mode == LET && op != Token::INIT && variable->binding_needs_init()) { |
// Perform an initialization check for let declared variables. |
const Operator* op = |
javascript()->LoadContext(depth, variable->index(), false); |
@@ -3514,6 +3507,16 @@ Node* AstGraphBuilder::BuildVariableAssignment( |
Node* current = NewNode(op, current_context()); |
value = BuildHoleCheckElseThrow(current, variable, value, bailout_id); |
} |
+ } else if (mode == CONST && op != Token::INIT && |
+ variable->is_sloppy_function_name()) { |
+ // Non-initializing assignment to sloppy function names is |
+ // - exception in strict mode. |
+ // - ignored in sloppy mode. |
+ DCHECK(!variable->binding_needs_init()); |
+ if (variable->throw_on_const_assignment(language_mode())) { |
+ return BuildThrowConstAssignError(bailout_id); |
+ } |
+ return value; |
} else if (mode == CONST && op != Token::INIT) { |
if (variable->binding_needs_init()) { |
const Operator* op = |