Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: src/interpreter/bytecode-generator.cc

Issue 2233673003: Remove CONST_LEGACY VariableMode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/globals.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « src/globals.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698