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

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

Issue 1245653002: [turbofan] Move workaround with TDZ of 'this' variable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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 | no next file » | 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 d6e1ceba30c4dc733404a6a102f425612cae2ae7..7d3bab21c10fc951c3377418a3bc7fb4571abcb8 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -520,6 +520,13 @@ bool AstGraphBuilder::CreateGraph(bool stack_check) {
// Initialize control scope.
ControlScope control(this);
+ // TODO(mstarzinger): For now we cannot assume that the {this} parameter is
+ // not {the_hole}, because for derived classes {this} has a TDZ and the
+ // JSConstructStubForDerived magically passes {the_hole} as a receiver.
+ if (scope->has_this_declaration() && scope->receiver()->is_const_mode()) {
+ env.RawParameterBind(0, jsgraph()->TheHoleConstant());
+ }
+
// Build receiver check for sloppy mode if necessary.
// TODO(mstarzinger/verwaest): Should this be moved back into the CallIC?
if (scope->has_this_declaration()) {
@@ -3352,12 +3359,9 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
}
} else if (mode == LET || mode == CONST) {
// Perform check for uninitialized let/const variables.
- // TODO(mstarzinger): For now we cannot use the below optimization for
- // the {this} parameter, because JSConstructStubForDerived magically
- // passes {the_hole} as a receiver.
if (value->op() == the_hole->op()) {
value = BuildThrowReferenceError(variable, bailout_id);
- } else if (value->opcode() == IrOpcode::kPhi || variable->is_this()) {
+ } else if (value->opcode() == IrOpcode::kPhi) {
value = BuildHoleCheckThenThrow(value, variable, value, bailout_id);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698