| Index: src/interpreter/bytecode-generator.cc
|
| diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
|
| index 704f4e91e33d16c9d1a4b08158d2a3207a7dfa47..fff48e0c7a0c01185f87e36ffb2ccfb11f3271b9 100644
|
| --- a/src/interpreter/bytecode-generator.cc
|
| +++ b/src/interpreter/bytecode-generator.cc
|
| @@ -2082,7 +2082,6 @@ void BytecodeGenerator::BuildThrowIfNotHole(Handle<String> name) {
|
|
|
| void BytecodeGenerator::BuildHoleCheckForVariableAssignment(Variable* variable,
|
| Token::Value op) {
|
| - DCHECK(variable->mode() != CONST_LEGACY);
|
| if (op != Token::INIT) {
|
| // Perform an initialization check for let/const declared variables.
|
| // E.g. let x = (x = 20); is not allowed.
|
| @@ -2127,17 +2126,11 @@ void BytecodeGenerator::VisitVariableAssignment(Variable* variable,
|
| builder()->LoadAccumulatorWithRegister(value_temp);
|
| }
|
|
|
| - if ((mode == CONST || mode == CONST_LEGACY) && op != Token::INIT) {
|
| - if (mode == CONST || is_strict(language_mode())) {
|
| - builder()->CallRuntime(Runtime::kThrowConstAssignError, Register(),
|
| - 0);
|
| - }
|
| - // Non-initializing assignments to legacy constants are ignored
|
| - // in sloppy mode. Break here to avoid storing into variable.
|
| - break;
|
| + if (mode != CONST || op == Token::INIT) {
|
| + builder()->StoreAccumulatorInRegister(destination);
|
| + } else if (variable->throw_on_const_assignment(language_mode())) {
|
| + builder()->CallRuntime(Runtime::kThrowConstAssignError, Register(), 0);
|
| }
|
| -
|
| - builder()->StoreAccumulatorInRegister(destination);
|
| break;
|
| }
|
| case VariableLocation::GLOBAL:
|
| @@ -2184,21 +2177,14 @@ void BytecodeGenerator::VisitVariableAssignment(Variable* variable,
|
| builder()->LoadAccumulatorWithRegister(value_temp);
|
| }
|
|
|
| - if ((mode == CONST || mode == CONST_LEGACY) && op != Token::INIT) {
|
| - if (mode == CONST || is_strict(language_mode())) {
|
| - builder()->CallRuntime(Runtime::kThrowConstAssignError, Register(),
|
| - 0);
|
| - }
|
| - // Non-initializing assignments to legacy constants are ignored
|
| - // in sloppy mode. Break here to avoid storing into variable.
|
| - break;
|
| + if (mode != CONST || op == Token::INIT) {
|
| + builder()->StoreContextSlot(context_reg, variable->index());
|
| + } else if (variable->throw_on_const_assignment(language_mode())) {
|
| + builder()->CallRuntime(Runtime::kThrowConstAssignError, Register(), 0);
|
| }
|
| -
|
| - builder()->StoreContextSlot(context_reg, variable->index());
|
| break;
|
| }
|
| case VariableLocation::LOOKUP: {
|
| - DCHECK_NE(CONST_LEGACY, variable->mode());
|
| builder()->StoreLookupSlot(variable->name(), language_mode());
|
| break;
|
| }
|
|
|