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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 1420573002: [turbofan] Fix liveness analysis for let variable in TDZ. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Relax check. Created 5 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/compiler/regress-variable-liveness-let.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index f80cc2e0a316bfba39a641bea8dfbcb363b3ce3b..ce7e1e5c6ad1bb27156ca3460d4962e3f9776fe2 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -3492,13 +3492,19 @@ Node* AstGraphBuilder::BuildVariableAssignment(
return BuildThrowConstAssignError(bailout_id);
}
return value;
+ } else if (mode == LET && op == Token::INIT_LET) {
+ // 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.
+ Node* current = environment()->Lookup(variable);
+ CHECK_NOT_NULL(current);
} else if (mode == LET && op != Token::INIT_LET) {
// Perform an initialization check for let declared variables.
Node* current = environment()->Lookup(variable);
if (current->op() == the_hole->op()) {
- value = BuildThrowReferenceError(variable, bailout_id);
+ return BuildThrowReferenceError(variable, bailout_id);
} else if (current->opcode() == IrOpcode::kPhi) {
- value = BuildHoleCheckThenThrow(current, variable, value, bailout_id);
+ BuildHoleCheckThenThrow(current, variable, value, bailout_id);
}
} else if (mode == CONST && op == Token::INIT_CONST) {
// Perform an initialization check for const {this} variables.
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-variable-liveness-let.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698