| Index: src/interpreter/bytecode-generator.cc
|
| diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
|
| index 619ed89a942807cd3d55f7c5bb450452ea5e2392..38167f43f6e1dfed79db3c27bbc1ae2065cd154a 100644
|
| --- a/src/interpreter/bytecode-generator.cc
|
| +++ b/src/interpreter/bytecode-generator.cc
|
| @@ -1967,11 +1967,15 @@ void BytecodeGenerator::VisitVariableAssignment(Variable* variable,
|
| // Break here because the value should not be stored unconditionally.
|
| break;
|
| } else if (mode == CONST_LEGACY && op != Token::INIT) {
|
| - DCHECK(!is_strict(language_mode()));
|
| - // Ensure accumulator is in the correct state.
|
| - builder()->LoadAccumulatorWithRegister(value_temp);
|
| - // Break here, non-initializing assignments to legacy constants are
|
| - // ignored.
|
| + if (is_strict(language_mode())) {
|
| + builder()->CallRuntime(Runtime::kThrowConstAssignError, Register(),
|
| + 0);
|
| + } else {
|
| + // Ensure accumulator is in the correct state.
|
| + builder()->LoadAccumulatorWithRegister(value_temp);
|
| + }
|
| + // Non-initializing assignments to legacy constants are ignored
|
| + // in sloppy mode. Break here to avoid storing into variable.
|
| break;
|
| } else {
|
| BuildHoleCheckForVariableAssignment(variable, op);
|
| @@ -2034,11 +2038,15 @@ void BytecodeGenerator::VisitVariableAssignment(Variable* variable,
|
| // The above code performs the store conditionally.
|
| break;
|
| } else if (mode == CONST_LEGACY && op != Token::INIT) {
|
| - DCHECK(!is_strict(language_mode()));
|
| - // Ensure accumulator is in the correct state.
|
| - builder()->LoadAccumulatorWithRegister(value_temp);
|
| - // Break here, non-initializing assignments to legacy constants are
|
| - // ignored.
|
| + if (is_strict(language_mode())) {
|
| + builder()->CallRuntime(Runtime::kThrowConstAssignError, Register(),
|
| + 0);
|
| + } else {
|
| + // Ensure accumulator is in the correct state.
|
| + builder()->LoadAccumulatorWithRegister(value_temp);
|
| + }
|
| + // Non-initializing assignments to legacy constants are ignored
|
| + // in sloppy mode. Break here to avoid storing into variable.
|
| break;
|
| } else {
|
| BuildHoleCheckForVariableAssignment(variable, op);
|
| @@ -2065,9 +2073,6 @@ void BytecodeGenerator::VisitVariableAssignment(Variable* variable,
|
| .LoadLiteral(variable->name())
|
| .StoreAccumulatorInRegister(name)
|
| .CallRuntime(Runtime::kInitializeLegacyConstLookupSlot, value, 3);
|
| - } else if (mode == CONST_LEGACY && op != Token::INIT) {
|
| - // Non-intializing assignments to legacy constants are ignored.
|
| - DCHECK(!is_strict(language_mode()));
|
| } else {
|
| builder()->StoreLookupSlot(variable->name(), language_mode());
|
| }
|
|
|