Commit 8e8d8623 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[turbofan] Add feedback to CheckString node

This CL allows deopts from CheckString to disable
speculation.

Bug: v8:7127, v8:6270
Change-Id: I029caeb61c509e5eb51b169ac42596d632f7c75a
Reviewed-on: https://chromium-review.googlesource.com/831866
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50172}
parent 1103d4cf
......@@ -1483,6 +1483,7 @@ Node* EffectControlLinearizer::LowerCheckSymbol(Node* node, Node* frame_state) {
Node* EffectControlLinearizer::LowerCheckString(Node* node, Node* frame_state) {
Node* value = node->InputAt(0);
const CheckParameters& params = CheckParametersOf(node->op());
Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
Node* value_instance_type =
......@@ -1490,7 +1491,7 @@ Node* EffectControlLinearizer::LowerCheckString(Node* node, Node* frame_state) {
Node* check = __ Uint32LessThan(value_instance_type,
__ Uint32Constant(FIRST_NONSTRING_TYPE));
__ DeoptimizeIfNot(DeoptimizeReason::kWrongInstanceType, VectorSlotPair(),
__ DeoptimizeIfNot(DeoptimizeReason::kWrongInstanceType, params.feedback(),
check, frame_state);
return value;
}
......
......@@ -1062,8 +1062,8 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
if (access_mode == AccessMode::kStore) return NoChange();
// Ensure that the {receiver} is actually a String.
receiver = effect = graph()->NewNode(simplified()->CheckString(), receiver,
effect, control);
receiver = effect = graph()->NewNode(
simplified()->CheckString(VectorSlotPair()), receiver, effect, control);
// Determine the {receiver} length.
Node* length = graph()->NewNode(simplified()->StringLength(), receiver);
......
......@@ -157,14 +157,16 @@ class JSBinopReduction final {
// CheckString node.
void CheckInputsToString() {
if (!left_type()->Is(Type::String())) {
Node* left_input = graph()->NewNode(simplified()->CheckString(), left(),
effect(), control());
Node* left_input =
graph()->NewNode(simplified()->CheckString(VectorSlotPair()), left(),
effect(), control());
node_->ReplaceInput(0, left_input);
update_effect(left_input);
}
if (!right_type()->Is(Type::String())) {
Node* right_input = graph()->NewNode(simplified()->CheckString(), right(),
effect(), control());
Node* right_input =
graph()->NewNode(simplified()->CheckString(VectorSlotPair()), right(),
effect(), control());
node_->ReplaceInput(1, right_input);
update_effect(right_input);
}
......@@ -541,13 +543,15 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) {
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
if (r.LeftInputIs(empty_string_type_)) {
Node* value = effect = graph()->NewNode(simplified()->CheckString(),
r.right(), effect, control);
Node* value = effect =
graph()->NewNode(simplified()->CheckString(VectorSlotPair()),
r.right(), effect, control);
ReplaceWithValue(node, value, effect, control);
return Replace(value);
} else if (r.RightInputIs(empty_string_type_)) {
Node* value = effect = graph()->NewNode(simplified()->CheckString(),
r.left(), effect, control);
Node* value = effect =
graph()->NewNode(simplified()->CheckString(VectorSlotPair()),
r.left(), effect, control);
ReplaceWithValue(node, value, effect, control);
return Replace(value);
}
......@@ -639,16 +643,16 @@ Reduction JSTypedLowering::ReduceCreateConsString(Node* node) {
// Make sure {first} is actually a String.
Type* first_type = NodeProperties::GetType(first);
if (!first_type->Is(Type::String())) {
first = effect =
graph()->NewNode(simplified()->CheckString(), first, effect, control);
first = effect = graph()->NewNode(
simplified()->CheckString(VectorSlotPair()), first, effect, control);
first_type = NodeProperties::GetType(first);
}
// Make sure {second} is actually a String.
Type* second_type = NodeProperties::GetType(second);
if (!second_type->Is(Type::String())) {
second = effect =
graph()->NewNode(simplified()->CheckString(), second, effect, control);
second = effect = graph()->NewNode(
simplified()->CheckString(VectorSlotPair()), second, effect, control);
second_type = NodeProperties::GetType(second);
}
......
......@@ -69,8 +69,9 @@ bool PropertyAccessBuilder::TryBuildStringCheck(MapHandles const& maps,
} else {
// Monormorphic string access (ignoring the fact that there are multiple
// String maps).
*receiver = *effect = graph()->NewNode(simplified()->CheckString(),
*receiver, *effect, control);
*receiver = *effect =
graph()->NewNode(simplified()->CheckString(VectorSlotPair()),
*receiver, *effect, control);
}
return true;
}
......
......@@ -715,7 +715,6 @@ bool operator==(CheckMinusZeroParameters const& lhs,
V(CheckHeapObject, 1, 1) \
V(CheckInternalizedString, 1, 1) \
V(CheckReceiver, 1, 1) \
V(CheckString, 1, 1) \
V(CheckSeqString, 1, 1) \
V(CheckSymbol, 1, 1) \
V(CheckNotTaggedHole, 1, 1) \
......@@ -731,6 +730,7 @@ bool operator==(CheckMinusZeroParameters const& lhs,
#define CHECKED_WITH_FEEDBACK_OP_LIST(V) \
V(CheckBounds, 2, 1) \
V(CheckSmi, 1, 1) \
V(CheckString, 1, 1) \
V(CheckedTaggedSignedToInt32, 1, 1) \
V(CheckedTaggedToTaggedSigned, 1, 1) \
V(CheckedUint32ToInt32, 1, 1) \
......
......@@ -546,7 +546,7 @@ class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final
const Operator* CheckInternalizedString();
const Operator* CheckNumber(const VectorSlotPair& feedback);
const Operator* CheckSmi(const VectorSlotPair& feedback);
const Operator* CheckString();
const Operator* CheckString(const VectorSlotPair& feedback);
const Operator* CheckSeqString();
const Operator* CheckSymbol();
const Operator* CheckReceiver();
......
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