Reviewers: rossberg,
Message:
Ugly workaround is being ugly (but optimized). :)
Description:
[turbofan] Move workaround with TDZ of 'this' variable.
Note that this just narrows the existing workaround for any 'this' in
derived constructors (having a temporal dead zone) so that we can still
recognize static cases correctly (i.e. when 'this' is provably outside
or inside the temporal dead zone).
[email protected]
Please review this at https://codereview.chromium.org/1245653002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+8, -4 lines):
M src/compiler/ast-graph-builder.cc
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);
}
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.