Commit 4af80298 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[turbofan] Fix missing lazy deopt in object literals.

This adds a missing lazy bailout point when defining data properties
with computed property names in object literals. The runtime call to
Runtime::kDefineDataPropertyInLiteral can trigger deopts. The necessary
bailout ID already exists and is now properly used.

R=jarin@chromium.org
TEST=mjsunit/regress/regress-crbug-621816
BUG=chromium:621816

Review-Url: https://codereview.chromium.org/2099133003
Cr-Commit-Position: refs/heads/master@{#37294}
parent e89d8b6a
...@@ -1668,7 +1668,8 @@ void AstGraphBuilder::VisitClassLiteralContents(ClassLiteral* expr) { ...@@ -1668,7 +1668,8 @@ void AstGraphBuilder::VisitClassLiteralContents(ClassLiteral* expr) {
jsgraph()->Constant(property->NeedsSetFunctionName()); jsgraph()->Constant(property->NeedsSetFunctionName());
const Operator* op = const Operator* op =
javascript()->CallRuntime(Runtime::kDefineDataPropertyInLiteral); javascript()->CallRuntime(Runtime::kDefineDataPropertyInLiteral);
NewNode(op, receiver, key, value, attr, set_function_name); Node* call = NewNode(op, receiver, key, value, attr, set_function_name);
PrepareFrameState(call, BailoutId::None());
break; break;
} }
case ObjectLiteral::Property::GETTER: { case ObjectLiteral::Property::GETTER: {
...@@ -1916,7 +1917,8 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { ...@@ -1916,7 +1917,8 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
jsgraph()->Constant(property->NeedsSetFunctionName()); jsgraph()->Constant(property->NeedsSetFunctionName());
const Operator* op = const Operator* op =
javascript()->CallRuntime(Runtime::kDefineDataPropertyInLiteral); javascript()->CallRuntime(Runtime::kDefineDataPropertyInLiteral);
NewNode(op, receiver, key, value, attr, set_function_name); Node* call = NewNode(op, receiver, key, value, attr, set_function_name);
PrepareFrameState(call, expr->GetIdForPropertySet(property_index));
break; break;
} }
case ObjectLiteral::Property::PROTOTYPE: case ObjectLiteral::Property::PROTOTYPE:
......
...@@ -139,7 +139,6 @@ bool Linkage::NeedsFrameStateInput(Runtime::FunctionId function) { ...@@ -139,7 +139,6 @@ bool Linkage::NeedsFrameStateInput(Runtime::FunctionId function) {
case Runtime::kAbort: case Runtime::kAbort:
case Runtime::kAllocateInTargetSpace: case Runtime::kAllocateInTargetSpace:
case Runtime::kCreateIterResultObject: case Runtime::kCreateIterResultObject:
case Runtime::kDefineDataPropertyInLiteral:
case Runtime::kDefineGetterPropertyUnchecked: // TODO(jarin): Is it safe? case Runtime::kDefineGetterPropertyUnchecked: // TODO(jarin): Is it safe?
case Runtime::kDefineSetterPropertyUnchecked: // TODO(jarin): Is it safe? case Runtime::kDefineSetterPropertyUnchecked: // TODO(jarin): Is it safe?
case Runtime::kForInDone: case Runtime::kForInDone:
......
...@@ -1548,6 +1548,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { ...@@ -1548,6 +1548,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PushOperand(Smi::FromInt(NONE)); PushOperand(Smi::FromInt(NONE));
PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else { } else {
DropOperands(3); DropOperands(3);
} }
......
...@@ -1531,6 +1531,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { ...@@ -1531,6 +1531,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PushOperand(Smi::FromInt(NONE)); PushOperand(Smi::FromInt(NONE));
PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else { } else {
DropOperands(3); DropOperands(3);
} }
......
...@@ -1466,6 +1466,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { ...@@ -1466,6 +1466,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PushOperand(Smi::FromInt(NONE)); PushOperand(Smi::FromInt(NONE));
PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else { } else {
DropOperands(3); DropOperands(3);
} }
......
...@@ -1542,6 +1542,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { ...@@ -1542,6 +1542,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PushOperand(Smi::FromInt(NONE)); PushOperand(Smi::FromInt(NONE));
PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else { } else {
DropOperands(3); DropOperands(3);
} }
......
...@@ -1543,6 +1543,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { ...@@ -1543,6 +1543,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PushOperand(Smi::FromInt(NONE)); PushOperand(Smi::FromInt(NONE));
PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else { } else {
DropOperands(3); DropOperands(3);
} }
......
...@@ -1508,6 +1508,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { ...@@ -1508,6 +1508,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PushOperand(Smi::FromInt(NONE)); PushOperand(Smi::FromInt(NONE));
PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else { } else {
DropOperands(3); DropOperands(3);
} }
......
...@@ -1469,6 +1469,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { ...@@ -1469,6 +1469,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PushOperand(Smi::FromInt(NONE)); PushOperand(Smi::FromInt(NONE));
PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else { } else {
DropOperands(3); DropOperands(3);
} }
......
...@@ -1494,6 +1494,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { ...@@ -1494,6 +1494,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PushOperand(Smi::FromInt(NONE)); PushOperand(Smi::FromInt(NONE));
PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else { } else {
DropOperands(3); DropOperands(3);
} }
......
...@@ -1463,6 +1463,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { ...@@ -1463,6 +1463,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PushOperand(Smi::FromInt(NONE)); PushOperand(Smi::FromInt(NONE));
PushOperand(Smi::FromInt(property->NeedsSetFunctionName())); PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral); CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else { } else {
DropOperands(3); DropOperands(3);
} }
......
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --turbo
function f() {
var o = {};
o.a = 1;
}
function g() {
var o = { ['a']: function(){} };
f();
}
f();
f();
%OptimizeFunctionOnNextCall(g);
g();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment