mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
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: https://github.com/v8/v8/commit/4af80298b66f6dc0abd7fbab93f377755388d065
PR-URL: https://github.com/nodejs/node/pull/17290
Fixes: https://github.com/nodejs/node/issues/14326
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
1 parent
ae3ad5502b
commit
50c3dabc0f
13 files changed
+41
-4
No files matched your search
Vendored
+1
-1
@@ -11,7 +11,7 @@
|
||||
#define V8_MAJOR_VERSION 5
|
||||
#define V8_MINOR_VERSION 1
|
||||
#define V8_BUILD_NUMBER 281
|
||||
#define V8_PATCH_LEVEL 108
|
||||
#define V8_PATCH_LEVEL 109
|
||||
|
||||
// Use 1 for candidates and 0 otherwise.
|
||||
// (Boolean macro values are not supported by all preprocessors.)
|
||||
|
||||
+4
-2
@@ -1620,7 +1620,8 @@ void AstGraphBuilder::VisitClassLiteralContents(ClassLiteral* expr) {
|
||||
jsgraph()->Constant(property->NeedsSetFunctionName());
|
||||
const Operator* op =
|
||||
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;
|
||||
}
|
||||
case ObjectLiteral::Property::GETTER: {
|
||||
@@ -1870,7 +1871,8 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
jsgraph()->Constant(property->NeedsSetFunctionName());
|
||||
const Operator* op =
|
||||
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;
|
||||
}
|
||||
case ObjectLiteral::Property::PROTOTYPE:
|
||||
|
||||
Vendored
-1
@@ -145,7 +145,6 @@ int Linkage::FrameStateInputCount(Runtime::FunctionId function) {
|
||||
switch (function) {
|
||||
case Runtime::kAllocateInTargetSpace:
|
||||
case Runtime::kCreateIterResultObject:
|
||||
case Runtime::kDefineDataPropertyInLiteral:
|
||||
case Runtime::kDefineGetterPropertyUnchecked: // TODO(jarin): Is it safe?
|
||||
case Runtime::kDefineSetterPropertyUnchecked: // TODO(jarin): Is it safe?
|
||||
case Runtime::kFinalizeClassDefinition: // TODO(conradw): Is it safe?
|
||||
|
||||
@@ -1572,6 +1572,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
PushOperand(Smi::FromInt(NONE));
|
||||
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
|
||||
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
|
||||
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
|
||||
NO_REGISTERS);
|
||||
} else {
|
||||
DropOperands(3);
|
||||
}
|
||||
|
||||
@@ -1557,6 +1557,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
PushOperand(Smi::FromInt(NONE));
|
||||
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
|
||||
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
|
||||
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
|
||||
NO_REGISTERS);
|
||||
} else {
|
||||
DropOperands(3);
|
||||
}
|
||||
|
||||
@@ -1493,6 +1493,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
PushOperand(Smi::FromInt(NONE));
|
||||
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
|
||||
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
|
||||
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
|
||||
NO_REGISTERS);
|
||||
} else {
|
||||
DropOperands(3);
|
||||
}
|
||||
|
||||
@@ -1569,6 +1569,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
PushOperand(Smi::FromInt(NONE));
|
||||
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
|
||||
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
|
||||
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
|
||||
NO_REGISTERS);
|
||||
} else {
|
||||
DropOperands(3);
|
||||
}
|
||||
|
||||
@@ -1570,6 +1570,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
PushOperand(Smi::FromInt(NONE));
|
||||
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
|
||||
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
|
||||
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
|
||||
NO_REGISTERS);
|
||||
} else {
|
||||
DropOperands(3);
|
||||
}
|
||||
|
||||
@@ -1532,6 +1532,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
PushOperand(Smi::FromInt(NONE));
|
||||
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
|
||||
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
|
||||
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
|
||||
NO_REGISTERS);
|
||||
} else {
|
||||
DropOperands(3);
|
||||
}
|
||||
|
||||
@@ -1491,6 +1491,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
PushOperand(Smi::FromInt(NONE));
|
||||
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
|
||||
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
|
||||
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
|
||||
NO_REGISTERS);
|
||||
} else {
|
||||
DropOperands(3);
|
||||
}
|
||||
|
||||
@@ -1518,6 +1518,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
PushOperand(Smi::FromInt(NONE));
|
||||
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
|
||||
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
|
||||
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
|
||||
NO_REGISTERS);
|
||||
} else {
|
||||
DropOperands(3);
|
||||
}
|
||||
|
||||
@@ -1485,6 +1485,8 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
PushOperand(Smi::FromInt(NONE));
|
||||
PushOperand(Smi::FromInt(property->NeedsSetFunctionName()));
|
||||
CallRuntimeWithOperands(Runtime::kDefineDataPropertyInLiteral);
|
||||
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
|
||||
NO_REGISTERS);
|
||||
} else {
|
||||
DropOperands(3);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// 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();
|
||||
Reference in new issue
Block a user