Reviewers: Michael Starzinger,
Message:
Could you take a look, please?
Description:
[turbofan] Add missing deopt for the assignment in the for-in statement.
BUG=chromium:416359
LOG=n
[email protected]
Please review this at https://codereview.chromium.org/881303002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+18, -10 lines):
M src/arm/full-codegen-arm.cc
M src/arm64/full-codegen-arm64.cc
M src/ast.h
M src/compiler/ast-graph-builder.h
M src/compiler/ast-graph-builder.cc
M src/ia32/full-codegen-ia32.cc
M src/mips/full-codegen-mips.cc
M src/mips64/full-codegen-mips64.cc
M src/ppc/full-codegen-ppc.cc
M src/x64/full-codegen-x64.cc
M src/x87/full-codegen-x87.cc
Index: src/arm/full-codegen-arm.cc
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
index
dc663d941681584f728d5907300c6b5fb70b4117..1ab7f3cf674b6d68bc32871439e1fd6e4d0fe651
100644
--- a/src/arm/full-codegen-arm.cc
+++ b/src/arm/full-codegen-arm.cc
@@ -1260,6 +1260,7 @@ void
FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// Perform the assignment as if via '='.
{ EffectContext context(this);
EmitAssignment(stmt->each());
+ PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS);
}
// Generate code for the body of the loop.
Index: src/arm64/full-codegen-arm64.cc
diff --git a/src/arm64/full-codegen-arm64.cc
b/src/arm64/full-codegen-arm64.cc
index
802179b687ea4bd2007a375a372a86402b7149cd..a7b06aab12a8a9b9dde0556630e0175439c6555b
100644
--- a/src/arm64/full-codegen-arm64.cc
+++ b/src/arm64/full-codegen-arm64.cc
@@ -1247,6 +1247,7 @@ void
FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// Perform the assignment as if via '='.
{ EffectContext context(this);
EmitAssignment(stmt->each());
+ PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS);
}
// Generate code for the body of the loop.
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index
6da9a5f57bee1393b83985601b37e9c07112dbfd..4b5f0bda4196d1e6e0c051e633e25007e6871ae3
100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -933,11 +933,12 @@ class ForInStatement FINAL : public ForEachStatement {
ForInType for_in_type() const { return for_in_type_; }
void set_for_in_type(ForInType type) { for_in_type_ = type; }
- static int num_ids() { return parent_num_ids() + 4; }
+ static int num_ids() { return parent_num_ids() + 5; }
BailoutId BodyId() const { return BailoutId(local_id(0)); }
BailoutId PrepareId() const { return BailoutId(local_id(1)); }
BailoutId EnumId() const { return BailoutId(local_id(2)); }
BailoutId ToObjectId() const { return BailoutId(local_id(3)); }
+ BailoutId AssignmentId() const { return BailoutId(local_id(4)); }
BailoutId ContinueId() const OVERRIDE { return EntryId(); }
BailoutId StackCheckId() const OVERRIDE { return BodyId(); }
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc
b/src/compiler/ast-graph-builder.cc
index
d37ca7eab2183fa1d97298f3ca764e680af9d2b1..1390eeb07c1bcee069719fb10861d888ee38d752
100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -774,7 +774,7 @@ void
AstGraphBuilder::VisitForInStatement(ForInStatement* stmt) {
}
value = environment()->Pop();
// Bind value and do loop body.
- VisitForInAssignment(stmt->each(), value);
+ VisitForInAssignment(stmt->each(), value, stmt->AssignmentId());
VisitIterationBody(stmt, &for_loop, 5);
for_loop.EndBody();
// Inc counter and continue.
@@ -1228,7 +1228,8 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral*
expr) {
}
-void AstGraphBuilder::VisitForInAssignment(Expression* expr, Node* value) {
+void AstGraphBuilder::VisitForInAssignment(Expression* expr, Node* value,
+ BailoutId bailout_id) {
DCHECK(expr->IsValidReferenceExpression());
// Left-hand side can only be a property, a global or a variable slot.
@@ -1239,8 +1240,7 @@ void
AstGraphBuilder::VisitForInAssignment(Expression* expr, Node* value) {
switch (assign_type) {
case VARIABLE: {
Variable* var = expr->AsVariableProxy()->var();
- // TODO(jarin) Fill in the correct bailout id.
- BuildVariableAssignment(var, value, Token::ASSIGN,
BailoutId::None());
+ BuildVariableAssignment(var, value, Token::ASSIGN, bailout_id);
break;
}
case NAMED_PROPERTY: {
@@ -1252,8 +1252,7 @@ void
AstGraphBuilder::VisitForInAssignment(Expression* expr, Node* value) {
MakeUnique(property->key()->AsLiteral()->AsPropertyName());
Node* store =
NewNode(javascript()->StoreNamed(strict_mode(), name), object,
value);
- // TODO(jarin) Fill in the correct bailout id.
- PrepareFrameState(store, BailoutId::None());
+ PrepareFrameState(store, bailout_id);
break;
}
case KEYED_PROPERTY: {
@@ -1265,8 +1264,7 @@ void
AstGraphBuilder::VisitForInAssignment(Expression* expr, Node* value) {
value = environment()->Pop();
Node* store = NewNode(javascript()->StoreProperty(strict_mode()),
object,
key, value);
- // TODO(jarin) Fill in the correct bailout id.
- PrepareFrameState(store, BailoutId::None());
+ PrepareFrameState(store, bailout_id);
break;
}
}
Index: src/compiler/ast-graph-builder.h
diff --git a/src/compiler/ast-graph-builder.h
b/src/compiler/ast-graph-builder.h
index
6830c984461cf35f68dab8f0e17c283d79c29757..ce133745170375dd5636681f479f31b68bc052fc
100644
--- a/src/compiler/ast-graph-builder.h
+++ b/src/compiler/ast-graph-builder.h
@@ -197,7 +197,8 @@ class AstGraphBuilder : public StructuredGraphBuilder,
public AstVisitor {
void VisitArithmeticExpression(BinaryOperation* expr);
// Dispatched from VisitForInStatement.
- void VisitForInAssignment(Expression* expr, Node* value);
+ void VisitForInAssignment(Expression* expr, Node* value,
+ BailoutId bailout_id);
// Dispatched from VisitClassLiteral.
void VisitClassLiteralContents(ClassLiteral* expr);
Index: src/ia32/full-codegen-ia32.cc
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
index
3873c5592d69862ef71a15db095fbdfa115b4724..985cffc2b7d8bc110692a50190f7262954c57f95
100644
--- a/src/ia32/full-codegen-ia32.cc
+++ b/src/ia32/full-codegen-ia32.cc
@@ -1184,6 +1184,7 @@ void
FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// Perform the assignment as if via '='.
{ EffectContext context(this);
EmitAssignment(stmt->each());
+ PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS);
}
// Generate code for the body of the loop.
Index: src/mips/full-codegen-mips.cc
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
index
2aebbba1d338b007562a4ffee9026feaaa88f74b..3b054c6a1b32d7e8a3d6957bc85764d8a8306fb0
100644
--- a/src/mips/full-codegen-mips.cc
+++ b/src/mips/full-codegen-mips.cc
@@ -1247,6 +1247,7 @@ void
FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// Perform the assignment as if via '='.
{ EffectContext context(this);
EmitAssignment(stmt->each());
+ PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS);
}
// Generate code for the body of the loop.
Index: src/mips64/full-codegen-mips64.cc
diff --git a/src/mips64/full-codegen-mips64.cc
b/src/mips64/full-codegen-mips64.cc
index
733ff81f8e759f7ea560755f3229e1645911383a..83bcf0356edf1b2f8ea17a9be4ba2933a68dd235
100644
--- a/src/mips64/full-codegen-mips64.cc
+++ b/src/mips64/full-codegen-mips64.cc
@@ -1242,6 +1242,7 @@ void
FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// Perform the assignment as if via '='.
{ EffectContext context(this);
EmitAssignment(stmt->each());
+ PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS);
}
// Generate code for the body of the loop.
Index: src/ppc/full-codegen-ppc.cc
diff --git a/src/ppc/full-codegen-ppc.cc b/src/ppc/full-codegen-ppc.cc
index
faf011faac8dd4a046c1d5fa52af72f437637a06..b9870bbcc5a28866b00f9261de222ac73a265b02
100644
--- a/src/ppc/full-codegen-ppc.cc
+++ b/src/ppc/full-codegen-ppc.cc
@@ -1217,6 +1217,7 @@ void
FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
{
EffectContext context(this);
EmitAssignment(stmt->each());
+ PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS);
}
// Generate code for the body of the loop.
Index: src/x64/full-codegen-x64.cc
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
index
2fce910cc049de37e8667aaf4a6ae2377ebb8bd3..6de2fc3f3b2cac1f3551eff01f4300d00a2d07ef
100644
--- a/src/x64/full-codegen-x64.cc
+++ b/src/x64/full-codegen-x64.cc
@@ -1218,6 +1218,7 @@ void
FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// Perform the assignment as if via '='.
{ EffectContext context(this);
EmitAssignment(stmt->each());
+ PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS);
}
// Generate code for the body of the loop.
Index: src/x87/full-codegen-x87.cc
diff --git a/src/x87/full-codegen-x87.cc b/src/x87/full-codegen-x87.cc
index
ed917433a69e4a3d568d10a042ebbfbc0c20a816..cf4dd40a262df0b6b954016b31406f262069da20
100644
--- a/src/x87/full-codegen-x87.cc
+++ b/src/x87/full-codegen-x87.cc
@@ -1173,6 +1173,7 @@ void
FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
// Perform the assignment as if via '='.
{ EffectContext context(this);
EmitAssignment(stmt->each());
+ PrepareForBailoutForId(stmt->AssignmentId(), NO_REGISTERS);
}
// Generate code for the body of the loop.
--
--
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.