Skip to content

Commit 50c3dab

Browse files
targosMylesBorins
authored andcommitted
deps: backport 4af8029 from upstream V8
Original commit message: [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} Refs: v8/v8@4af8029 PR-URL: #17290 Fixes: #14326 Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent ae3ad55 commit 50c3dab

13 files changed

+41
-4
lines changed

deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 5
1212
#define V8_MINOR_VERSION 1
1313
#define V8_BUILD_NUMBER 281
14-
#define V8_PATCH_LEVEL 108
14+
#define V8_PATCH_LEVEL 109
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

deps/v8/src/compiler/ast-graph-builder.cc

+4-2
Original file line numberDiff line numberDiff line change
@@ -1620,7 +1620,8 @@ void AstGraphBuilder::VisitClassLiteralContents(ClassLiteral* expr) {
16201620
jsgraph()->Constant(property->NeedsSetFunctionName());
16211621
const Operator* op =
16221622
javascript()->CallRuntime(Runtime::kDefineDataPropertyInLiteral);
1623-
NewNode(op, receiver, key, value, attr, set_function_name);
1623+
Node* call = NewNode(op, receiver, key, value, attr, set_function_name);
1624+
PrepareFrameState(call, BailoutId::None());
16241625
break;
16251626
}
16261627
case ObjectLiteral::Property::GETTER: {
@@ -1870,7 +1871,8 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
18701871
jsgraph()->Constant(property->NeedsSetFunctionName());
18711872
const Operator* op =
18721873
javascript()->CallRuntime(Runtime::kDefineDataPropertyInLiteral);
1873-
NewNode(op, receiver, key, value, attr, set_function_name);
1874+
Node* call = NewNode(op, receiver, key, value, attr, set_function_name);
1875+
PrepareFrameState(call, expr->GetIdForPropertySet(property_index));
18741876
break;
18751877
}
18761878
case ObjectLiteral::Property::PROTOTYPE:

deps/v8/src/compiler/linkage.cc

-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ int Linkage::FrameStateInputCount(Runtime::FunctionId function) {
145145
switch (function) {
146146
case Runtime::kAllocateInTargetSpace:
147147
case Runtime::kCreateIterResultObject:
148-
case Runtime::kDefineDataPropertyInLiteral:
149148
case Runtime::kDefineGetterPropertyUnchecked: // TODO(jarin): Is it safe?
150149
case Runtime::kDefineSetterPropertyUnchecked: // TODO(jarin): Is it safe?
151150
case Runtime::kFinalizeClassDefinition: // TODO(conradw): Is it safe?

deps/v8/src/full-codegen/arm/full-codegen-arm.cc

+2
Original file line numberDiff line numberDiff line change
@@ -1572,6 +1572,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
15721572
PushOperand(Smi::FromInt(NONE));
15731573
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
15741574
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
1575+
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
1576+
NO_REGISTERS);
15751577
} else {
15761578
DropOperands(3);
15771579
}

deps/v8/src/full-codegen/arm64/full-codegen-arm64.cc

+2
Original file line numberDiff line numberDiff line change
@@ -1557,6 +1557,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
15571557
PushOperand(Smi::FromInt(NONE));
15581558
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
15591559
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
1560+
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
1561+
NO_REGISTERS);
15601562
} else {
15611563
DropOperands(3);
15621564
}

deps/v8/src/full-codegen/ia32/full-codegen-ia32.cc

+2
Original file line numberDiff line numberDiff line change
@@ -1493,6 +1493,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
14931493
PushOperand(Smi::FromInt(NONE));
14941494
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
14951495
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
1496+
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
1497+
NO_REGISTERS);
14961498
} else {
14971499
DropOperands(3);
14981500
}

deps/v8/src/full-codegen/mips/full-codegen-mips.cc

+2
Original file line numberDiff line numberDiff line change
@@ -1569,6 +1569,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
15691569
PushOperand(Smi::FromInt(NONE));
15701570
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
15711571
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
1572+
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
1573+
NO_REGISTERS);
15721574
} else {
15731575
DropOperands(3);
15741576
}

deps/v8/src/full-codegen/mips64/full-codegen-mips64.cc

+2
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
15701570
PushOperand(Smi::FromInt(NONE));
15711571
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
15721572
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
1573+
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
1574+
NO_REGISTERS);
15731575
} else {
15741576
DropOperands(3);
15751577
}

deps/v8/src/full-codegen/ppc/full-codegen-ppc.cc

+2
Original file line numberDiff line numberDiff line change
@@ -1532,6 +1532,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
15321532
PushOperand(Smi::FromInt(NONE));
15331533
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
15341534
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
1535+
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
1536+
NO_REGISTERS);
15351537
} else {
15361538
DropOperands(3);
15371539
}

deps/v8/src/full-codegen/s390/full-codegen-s390.cc

+2
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
14911491
PushOperand(Smi::FromInt(NONE));
14921492
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
14931493
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
1494+
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
1495+
NO_REGISTERS);
14941496
} else {
14951497
DropOperands(3);
14961498
}

deps/v8/src/full-codegen/x64/full-codegen-x64.cc

+2
Original file line numberDiff line numberDiff line change
@@ -1518,6 +1518,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
15181518
PushOperand(Smi::FromInt(NONE));
15191519
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
15201520
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
1521+
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
1522+
NO_REGISTERS);
15211523
} else {
15221524
DropOperands(3);
15231525
}

deps/v8/src/full-codegen/x87/full-codegen-x87.cc

+2
Original file line numberDiff line numberDiff line change
@@ -1485,6 +1485,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
14851485
PushOperand(Smi::FromInt(NONE));
14861486
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
14871487
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
1488+
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
1489+
NO_REGISTERS);
14881490
} else {
14891491
DropOperands(3);
14901492
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2016 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// Flags: --allow-natives-syntax --turbo
6+
7+
function f() {
8+
var o = {};
9+
o.a = 1;
10+
}
11+
function g() {
12+
var o = { ['a']: function(){} };
13+
f();
14+
}
15+
f();
16+
f();
17+
%OptimizeFunctionOnNextCall(g);
18+
g();

0 commit comments

Comments
 (0)