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

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

Issue 2447783002: [ignition] Use more-targeted check for CONST-this-initialization hole check (Closed)
Patch Set: Fix the interpreter instead of the parser Created 4 years, 2 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 | « no previous file | test/mjsunit/regress/regress-crbug-658528.js » ('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 9ef9160582a27150fa1cda359dc9adc60a9e8c69..697b13ed83c26d54d3bbd5943a431a7657685b43 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -1945,17 +1945,16 @@ void BytecodeGenerator::BuildThrowIfNotHole(Handle<String> name) {
void BytecodeGenerator::BuildHoleCheckForVariableAssignment(Variable* variable,
Token::Value op) {
- if (op != Token::INIT) {
- // Perform an initialization check for let/const declared variables.
- // E.g. let x = (x = 20); is not allowed.
- BuildThrowIfHole(variable->name());
- } else {
- DCHECK(variable->is_this() && variable->mode() == CONST &&
- op == Token::INIT);
+ if (variable->is_this() && variable->mode() == CONST && op == Token::INIT) {
// Perform an initialization check for 'this'. 'this' variable is the
// only variable able to trigger bind operations outside the TDZ
// via 'super' calls.
BuildThrowIfNotHole(variable->name());
+ } else {
+ // Perform an initialization check for let/const declared variables.
+ // E.g. let x = (x = 20); is not allowed.
+ DCHECK(IsLexicalVariableMode(variable->mode()));
+ BuildThrowIfHole(variable->name());
}
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-658528.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698