Commit d1068b4f authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

Revert "[Interpreter] Ensure Test*Handler don't allocate a frame for fast-path."

This reverts commit d6121fd1.

Reason for revert: Fails cctest/test-cpu-profiler/Inlining2 on arm64-sim: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux%20-%20arm64%20-%20sim/17702

Original change's description:
> [Interpreter] Ensure Test*Handler don't allocate a frame for fast-path.
> 
> Avoids allocating a frame for the fast-path in TestEqual, TestEqualStrict and
> TestLess/GreaterThan bytecode handlers. Also changes how feedback is tracked
> to try and avoid needing to keep feedback to "combine" with if it's unecessary
> which reduces the liveranges of the registers holding this data.
> 
> This reduces the time needed for a tight loop in Ignition (e.g.,
> while (i < 1000000000) ++i;) from 12.8s to 10.8s.
> 
> BUG=v8:9133
> 
> Change-Id: I686b9da89541d15d233635db3276de3dad2fa282
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1570020
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#60906}

TBR=rmcilroy@chromium.org,jgruber@chromium.org

Change-Id: I5e53138929bf1fae9f57f9dd023d258bb7d557ac
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:9133
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1571418Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60907}
parent d6121fd1
...@@ -11373,8 +11373,7 @@ Node* CodeStubAssembler::RelationalComparison(Operation op, Node* left, ...@@ -11373,8 +11373,7 @@ Node* CodeStubAssembler::RelationalComparison(Operation op, Node* left,
Node* right_map = LoadMap(right); Node* right_map = LoadMap(right);
Label if_left_heapnumber(this), if_left_bigint(this, Label::kDeferred), Label if_left_heapnumber(this), if_left_bigint(this, Label::kDeferred),
if_left_string(this, Label::kDeferred), if_left_string(this), if_left_other(this, Label::kDeferred);
if_left_other(this, Label::kDeferred);
GotoIf(IsHeapNumberMap(left_map), &if_left_heapnumber); GotoIf(IsHeapNumberMap(left_map), &if_left_heapnumber);
Node* left_instance_type = LoadMapInstanceType(left_map); Node* left_instance_type = LoadMapInstanceType(left_map);
GotoIf(IsBigIntInstanceType(left_instance_type), &if_left_bigint); GotoIf(IsBigIntInstanceType(left_instance_type), &if_left_bigint);
...@@ -11862,8 +11861,7 @@ Node* CodeStubAssembler::Equal(Node* left, Node* right, Node* context, ...@@ -11862,8 +11861,7 @@ Node* CodeStubAssembler::Equal(Node* left, Node* right, Node* context,
{ {
GotoIf(TaggedIsSmi(right), &use_symmetry); GotoIf(TaggedIsSmi(right), &use_symmetry);
Label if_left_symbol(this), if_left_number(this), Label if_left_symbol(this), if_left_number(this), if_left_string(this),
if_left_string(this, Label::kDeferred),
if_left_bigint(this, Label::kDeferred), if_left_oddball(this), if_left_bigint(this, Label::kDeferred), if_left_oddball(this),
if_left_receiver(this); if_left_receiver(this);
...@@ -12199,12 +12197,9 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs, ...@@ -12199,12 +12197,9 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
// } // }
// } // }
Label if_equal(this), if_notequal(this), if_not_equivalent_types(this), Label if_equal(this), if_notequal(this), end(this);
end(this);
VARIABLE(result, MachineRepresentation::kTagged); VARIABLE(result, MachineRepresentation::kTagged);
OverwriteFeedback(var_type_feedback, CompareOperationFeedback::kNone);
// Check if {lhs} and {rhs} refer to the same object. // Check if {lhs} and {rhs} refer to the same object.
Label if_same(this), if_notsame(this); Label if_same(this), if_notsame(this);
Branch(WordEqual(lhs, rhs), &if_same, &if_notsame); Branch(WordEqual(lhs, rhs), &if_same, &if_notsame);
...@@ -12213,6 +12208,9 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs, ...@@ -12213,6 +12208,9 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
{ {
// The {lhs} and {rhs} reference the exact same value, yet we need special // The {lhs} and {rhs} reference the exact same value, yet we need special
// treatment for HeapNumber, as NaN is not equal to NaN. // treatment for HeapNumber, as NaN is not equal to NaN.
if (var_type_feedback != nullptr) {
var_type_feedback->Bind(SmiConstant(CompareOperationFeedback::kNone));
}
GenerateEqual_Same(lhs, &if_equal, &if_notequal, var_type_feedback); GenerateEqual_Same(lhs, &if_equal, &if_notequal, var_type_feedback);
} }
...@@ -12221,6 +12219,10 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs, ...@@ -12221,6 +12219,10 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
// The {lhs} and {rhs} reference different objects, yet for Smi, HeapNumber, // The {lhs} and {rhs} reference different objects, yet for Smi, HeapNumber,
// BigInt and String they can still be considered equal. // BigInt and String they can still be considered equal.
if (var_type_feedback != nullptr) {
var_type_feedback->Bind(SmiConstant(CompareOperationFeedback::kAny));
}
// Check if {lhs} is a Smi or a HeapObject. // Check if {lhs} is a Smi or a HeapObject.
Label if_lhsissmi(this), if_lhsisnotsmi(this); Label if_lhsissmi(this), if_lhsisnotsmi(this);
Branch(TaggedIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi); Branch(TaggedIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi);
...@@ -12246,7 +12248,10 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs, ...@@ -12246,7 +12248,10 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
Node* lhs_value = LoadHeapNumberValue(lhs); Node* lhs_value = LoadHeapNumberValue(lhs);
Node* rhs_value = SmiToFloat64(rhs); Node* rhs_value = SmiToFloat64(rhs);
CombineFeedback(var_type_feedback, CompareOperationFeedback::kNumber); if (var_type_feedback != nullptr) {
var_type_feedback->Bind(
SmiConstant(CompareOperationFeedback::kNumber));
}
// Perform a floating point comparison of {lhs} and {rhs}. // Perform a floating point comparison of {lhs} and {rhs}.
Branch(Float64Equal(lhs_value, rhs_value), &if_equal, &if_notequal); Branch(Float64Equal(lhs_value, rhs_value), &if_equal, &if_notequal);
...@@ -12267,15 +12272,17 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs, ...@@ -12267,15 +12272,17 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
Node* lhs_value = LoadHeapNumberValue(lhs); Node* lhs_value = LoadHeapNumberValue(lhs);
Node* rhs_value = LoadHeapNumberValue(rhs); Node* rhs_value = LoadHeapNumberValue(rhs);
CombineFeedback(var_type_feedback, if (var_type_feedback != nullptr) {
CompareOperationFeedback::kNumber); var_type_feedback->Bind(
SmiConstant(CompareOperationFeedback::kNumber));
}
// Perform a floating point comparison of {lhs} and {rhs}. // Perform a floating point comparison of {lhs} and {rhs}.
Branch(Float64Equal(lhs_value, rhs_value), &if_equal, &if_notequal); Branch(Float64Equal(lhs_value, rhs_value), &if_equal, &if_notequal);
} }
BIND(&if_rhsisnotnumber); BIND(&if_rhsisnotnumber);
Goto(&if_not_equivalent_types); Goto(&if_notequal);
} }
} }
...@@ -12286,7 +12293,7 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs, ...@@ -12286,7 +12293,7 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
Branch(TaggedIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi); Branch(TaggedIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi);
BIND(&if_rhsissmi); BIND(&if_rhsissmi);
Goto(&if_not_equivalent_types); Goto(&if_notequal);
BIND(&if_rhsisnotsmi); BIND(&if_rhsisnotsmi);
{ {
...@@ -12294,7 +12301,7 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs, ...@@ -12294,7 +12301,7 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
Node* lhs_instance_type = LoadMapInstanceType(lhs_map); Node* lhs_instance_type = LoadMapInstanceType(lhs_map);
// Check if {lhs} is a String. // Check if {lhs} is a String.
Label if_lhsisstring(this, Label::kDeferred), if_lhsisnotstring(this); Label if_lhsisstring(this), if_lhsisnotstring(this);
Branch(IsStringInstanceType(lhs_instance_type), &if_lhsisstring, Branch(IsStringInstanceType(lhs_instance_type), &if_lhsisstring,
&if_lhsisnotstring); &if_lhsisnotstring);
...@@ -12324,94 +12331,92 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs, ...@@ -12324,94 +12331,92 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
} }
BIND(&if_rhsisnotstring); BIND(&if_rhsisnotstring);
Goto(&if_not_equivalent_types); Goto(&if_notequal);
} }
BIND(&if_lhsisnotstring); BIND(&if_lhsisnotstring);
// Check if {lhs} is a BigInt.
Label if_lhsisbigint(this), if_lhsisnotbigint(this);
Branch(IsBigIntInstanceType(lhs_instance_type), &if_lhsisbigint,
&if_lhsisnotbigint);
BIND(&if_lhsisbigint);
{ {
// Check if {lhs} is a BigInt. // Load the instance type of {rhs}.
Label if_lhsisbigint(this), if_lhsisnotbigint(this); Node* rhs_instance_type = LoadInstanceType(rhs);
Branch(IsBigIntInstanceType(lhs_instance_type), &if_lhsisbigint,
&if_lhsisnotbigint); // Check if {rhs} is also a BigInt.
Label if_rhsisbigint(this, Label::kDeferred),
if_rhsisnotbigint(this);
Branch(IsBigIntInstanceType(rhs_instance_type), &if_rhsisbigint,
&if_rhsisnotbigint);
BIND(&if_lhsisbigint); BIND(&if_rhsisbigint);
{ {
// Load the instance type of {rhs}. if (var_type_feedback != nullptr) {
Node* rhs_instance_type = LoadInstanceType(rhs); var_type_feedback->Bind(
SmiConstant(CompareOperationFeedback::kBigInt));
// Check if {rhs} is also a BigInt.
Label if_rhsisbigint(this, Label::kDeferred),
if_rhsisnotbigint(this);
Branch(IsBigIntInstanceType(rhs_instance_type), &if_rhsisbigint,
&if_rhsisnotbigint);
BIND(&if_rhsisbigint);
{
CombineFeedback(var_type_feedback,
CompareOperationFeedback::kBigInt);
result.Bind(CallRuntime(Runtime::kBigIntEqualToBigInt,
NoContextConstant(), lhs, rhs));
Goto(&end);
} }
result.Bind(CallRuntime(Runtime::kBigIntEqualToBigInt,
BIND(&if_rhsisnotbigint); NoContextConstant(), lhs, rhs));
Goto(&if_not_equivalent_types); Goto(&end);
} }
BIND(&if_lhsisnotbigint); BIND(&if_rhsisnotbigint);
if (var_type_feedback != nullptr) { Goto(&if_notequal);
// Load the instance type of {rhs}. }
Node* rhs_map = LoadMap(rhs);
Node* rhs_instance_type = LoadMapInstanceType(rhs_map);
Label if_lhsissymbol(this), if_lhsisreceiver(this),
if_lhsisoddball(this);
GotoIf(IsJSReceiverInstanceType(lhs_instance_type),
&if_lhsisreceiver);
GotoIf(IsBooleanMap(lhs_map), &if_not_equivalent_types);
GotoIf(IsOddballInstanceType(lhs_instance_type),
&if_lhsisoddball);
Branch(IsSymbolInstanceType(lhs_instance_type), &if_lhsissymbol,
&if_not_equivalent_types);
BIND(&if_lhsisreceiver);
{
GotoIf(IsBooleanMap(rhs_map), &if_not_equivalent_types);
OverwriteFeedback(var_type_feedback,
CompareOperationFeedback::kReceiver);
GotoIf(IsJSReceiverInstanceType(rhs_instance_type),
&if_notequal);
OverwriteFeedback(
var_type_feedback,
CompareOperationFeedback::kReceiverOrNullOrUndefined);
GotoIf(IsOddballInstanceType(rhs_instance_type), &if_notequal);
Goto(&if_not_equivalent_types);
}
BIND(&if_lhsisoddball); BIND(&if_lhsisnotbigint);
{ if (var_type_feedback != nullptr) {
STATIC_ASSERT(LAST_PRIMITIVE_TYPE == ODDBALL_TYPE); // Load the instance type of {rhs}.
GotoIf(IsBooleanMap(rhs_map), &if_not_equivalent_types); Node* rhs_map = LoadMap(rhs);
GotoIf(Int32LessThan(rhs_instance_type, Node* rhs_instance_type = LoadMapInstanceType(rhs_map);
Int32Constant(ODDBALL_TYPE)),
&if_not_equivalent_types); Label if_lhsissymbol(this), if_lhsisreceiver(this),
OverwriteFeedback( if_lhsisoddball(this);
var_type_feedback, GotoIf(IsJSReceiverInstanceType(lhs_instance_type),
CompareOperationFeedback::kReceiverOrNullOrUndefined); &if_lhsisreceiver);
Goto(&if_notequal); GotoIf(IsBooleanMap(lhs_map), &if_notequal);
} GotoIf(IsOddballInstanceType(lhs_instance_type), &if_lhsisoddball);
Branch(IsSymbolInstanceType(lhs_instance_type), &if_lhsissymbol,
&if_notequal);
BIND(&if_lhsisreceiver);
{
GotoIf(IsBooleanMap(rhs_map), &if_notequal);
var_type_feedback->Bind(
SmiConstant(CompareOperationFeedback::kReceiver));
GotoIf(IsJSReceiverInstanceType(rhs_instance_type), &if_notequal);
var_type_feedback->Bind(SmiConstant(
CompareOperationFeedback::kReceiverOrNullOrUndefined));
GotoIf(IsOddballInstanceType(rhs_instance_type), &if_notequal);
var_type_feedback->Bind(
SmiConstant(CompareOperationFeedback::kAny));
Goto(&if_notequal);
}
BIND(&if_lhsissymbol); BIND(&if_lhsisoddball);
{ {
GotoIfNot(IsSymbolInstanceType(rhs_instance_type), STATIC_ASSERT(LAST_PRIMITIVE_TYPE == ODDBALL_TYPE);
&if_not_equivalent_types); GotoIf(IsBooleanMap(rhs_map), &if_notequal);
OverwriteFeedback(var_type_feedback, GotoIf(
CompareOperationFeedback::kSymbol); Int32LessThan(rhs_instance_type, Int32Constant(ODDBALL_TYPE)),
Goto(&if_notequal); &if_notequal);
} var_type_feedback->Bind(SmiConstant(
} else { CompareOperationFeedback::kReceiverOrNullOrUndefined));
Goto(&if_notequal); Goto(&if_notequal);
} }
BIND(&if_lhsissymbol);
{
GotoIfNot(IsSymbolInstanceType(rhs_instance_type), &if_notequal);
var_type_feedback->Bind(
SmiConstant(CompareOperationFeedback::kSymbol));
Goto(&if_notequal);
}
} else {
Goto(&if_notequal);
} }
} }
} }
...@@ -12428,8 +12433,10 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs, ...@@ -12428,8 +12433,10 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
Branch(TaggedIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi); Branch(TaggedIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi);
BIND(&if_rhsissmi); BIND(&if_rhsissmi);
CombineFeedback(var_type_feedback, if (var_type_feedback != nullptr) {
CompareOperationFeedback::kSignedSmall); var_type_feedback->Bind(
SmiConstant(CompareOperationFeedback::kSignedSmall));
}
Goto(&if_notequal); Goto(&if_notequal);
BIND(&if_rhsisnotsmi); BIND(&if_rhsisnotsmi);
...@@ -12447,14 +12454,17 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs, ...@@ -12447,14 +12454,17 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
Node* lhs_value = SmiToFloat64(lhs); Node* lhs_value = SmiToFloat64(lhs);
Node* rhs_value = LoadHeapNumberValue(rhs); Node* rhs_value = LoadHeapNumberValue(rhs);
CombineFeedback(var_type_feedback, CompareOperationFeedback::kNumber); if (var_type_feedback != nullptr) {
var_type_feedback->Bind(
SmiConstant(CompareOperationFeedback::kNumber));
}
// Perform a floating point comparison of {lhs} and {rhs}. // Perform a floating point comparison of {lhs} and {rhs}.
Branch(Float64Equal(lhs_value, rhs_value), &if_equal, &if_notequal); Branch(Float64Equal(lhs_value, rhs_value), &if_equal, &if_notequal);
} }
BIND(&if_rhsisnotnumber); BIND(&if_rhsisnotnumber);
Goto(&if_not_equivalent_types); Goto(&if_notequal);
} }
} }
} }
...@@ -12465,12 +12475,6 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs, ...@@ -12465,12 +12475,6 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
Goto(&end); Goto(&end);
} }
BIND(&if_not_equivalent_types);
{
OverwriteFeedback(var_type_feedback, CompareOperationFeedback::kAny);
Goto(&if_notequal);
}
BIND(&if_notequal); BIND(&if_notequal);
{ {
result.Bind(FalseConstant()); result.Bind(FalseConstant());
......
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