Skip to content

Commit 6ee0c87

Browse files
rmcilroyCommit Bot
authored andcommitted
Reland "[Interpreter] Ensure Test*Handler don't allocate a frame for fast-path."
This is a reland of d6121fd 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=jgruber@chromium.org Bug: v8:9133 Change-Id: Ie9940d029d412986e6713438630565a98fe3c51c Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1582401 Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Commit-Queue: Ross McIlroy <rmcilroy@chromium.org> Cr-Commit-Position: refs/heads/master@{#60989}
1 parent 2019664 commit 6ee0c87

1 file changed

Lines changed: 99 additions & 103 deletions

File tree

src/code-stub-assembler.cc

Lines changed: 99 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -11315,7 +11315,8 @@ Node* CodeStubAssembler::RelationalComparison(Operation op, Node* left,
1131511315
Node* right_map = LoadMap(right);
1131611316

1131711317
Label if_left_heapnumber(this), if_left_bigint(this, Label::kDeferred),
11318-
if_left_string(this), if_left_other(this, Label::kDeferred);
11318+
if_left_string(this, Label::kDeferred),
11319+
if_left_other(this, Label::kDeferred);
1131911320
GotoIf(IsHeapNumberMap(left_map), &if_left_heapnumber);
1132011321
Node* left_instance_type = LoadMapInstanceType(left_map);
1132111322
GotoIf(IsBigIntInstanceType(left_instance_type), &if_left_bigint);
@@ -11803,7 +11804,8 @@ Node* CodeStubAssembler::Equal(Node* left, Node* right, Node* context,
1180311804
{
1180411805
GotoIf(TaggedIsSmi(right), &use_symmetry);
1180511806

11806-
Label if_left_symbol(this), if_left_number(this), if_left_string(this),
11807+
Label if_left_symbol(this), if_left_number(this),
11808+
if_left_string(this, Label::kDeferred),
1180711809
if_left_bigint(this, Label::kDeferred), if_left_oddball(this),
1180811810
if_left_receiver(this);
1180911811

@@ -12139,9 +12141,12 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
1213912141
// }
1214012142
// }
1214112143

12142-
Label if_equal(this), if_notequal(this), end(this);
12144+
Label if_equal(this), if_notequal(this), if_not_equivalent_types(this),
12145+
end(this);
1214312146
VARIABLE(result, MachineRepresentation::kTagged);
1214412147

12148+
OverwriteFeedback(var_type_feedback, CompareOperationFeedback::kNone);
12149+
1214512150
// Check if {lhs} and {rhs} refer to the same object.
1214612151
Label if_same(this), if_notsame(this);
1214712152
Branch(WordEqual(lhs, rhs), &if_same, &if_notsame);
@@ -12150,9 +12155,6 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
1215012155
{
1215112156
// The {lhs} and {rhs} reference the exact same value, yet we need special
1215212157
// treatment for HeapNumber, as NaN is not equal to NaN.
12153-
if (var_type_feedback != nullptr) {
12154-
var_type_feedback->Bind(SmiConstant(CompareOperationFeedback::kNone));
12155-
}
1215612158
GenerateEqual_Same(lhs, &if_equal, &if_notequal, var_type_feedback);
1215712159
}
1215812160

@@ -12161,10 +12163,6 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
1216112163
// The {lhs} and {rhs} reference different objects, yet for Smi, HeapNumber,
1216212164
// BigInt and String they can still be considered equal.
1216312165

12164-
if (var_type_feedback != nullptr) {
12165-
var_type_feedback->Bind(SmiConstant(CompareOperationFeedback::kAny));
12166-
}
12167-
1216812166
// Check if {lhs} is a Smi or a HeapObject.
1216912167
Label if_lhsissmi(this), if_lhsisnotsmi(this);
1217012168
Branch(TaggedIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi);
@@ -12190,10 +12188,7 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
1219012188
Node* lhs_value = LoadHeapNumberValue(lhs);
1219112189
Node* rhs_value = SmiToFloat64(rhs);
1219212190

12193-
if (var_type_feedback != nullptr) {
12194-
var_type_feedback->Bind(
12195-
SmiConstant(CompareOperationFeedback::kNumber));
12196-
}
12191+
CombineFeedback(var_type_feedback, CompareOperationFeedback::kNumber);
1219712192

1219812193
// Perform a floating point comparison of {lhs} and {rhs}.
1219912194
Branch(Float64Equal(lhs_value, rhs_value), &if_equal, &if_notequal);
@@ -12214,17 +12209,15 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
1221412209
Node* lhs_value = LoadHeapNumberValue(lhs);
1221512210
Node* rhs_value = LoadHeapNumberValue(rhs);
1221612211

12217-
if (var_type_feedback != nullptr) {
12218-
var_type_feedback->Bind(
12219-
SmiConstant(CompareOperationFeedback::kNumber));
12220-
}
12212+
CombineFeedback(var_type_feedback,
12213+
CompareOperationFeedback::kNumber);
1222112214

1222212215
// Perform a floating point comparison of {lhs} and {rhs}.
1222312216
Branch(Float64Equal(lhs_value, rhs_value), &if_equal, &if_notequal);
1222412217
}
1222512218

1222612219
BIND(&if_rhsisnotnumber);
12227-
Goto(&if_notequal);
12220+
Goto(&if_not_equivalent_types);
1222812221
}
1222912222
}
1223012223

@@ -12235,15 +12228,15 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
1223512228
Branch(TaggedIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi);
1223612229

1223712230
BIND(&if_rhsissmi);
12238-
Goto(&if_notequal);
12231+
Goto(&if_not_equivalent_types);
1223912232

1224012233
BIND(&if_rhsisnotsmi);
1224112234
{
1224212235
// Load the instance type of {lhs}.
1224312236
Node* lhs_instance_type = LoadMapInstanceType(lhs_map);
1224412237

1224512238
// Check if {lhs} is a String.
12246-
Label if_lhsisstring(this), if_lhsisnotstring(this);
12239+
Label if_lhsisstring(this, Label::kDeferred), if_lhsisnotstring(this);
1224712240
Branch(IsStringInstanceType(lhs_instance_type), &if_lhsisstring,
1224812241
&if_lhsisnotstring);
1224912242

@@ -12273,92 +12266,94 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
1227312266
}
1227412267

1227512268
BIND(&if_rhsisnotstring);
12276-
Goto(&if_notequal);
12269+
Goto(&if_not_equivalent_types);
1227712270
}
1227812271

1227912272
BIND(&if_lhsisnotstring);
12280-
12281-
// Check if {lhs} is a BigInt.
12282-
Label if_lhsisbigint(this), if_lhsisnotbigint(this);
12283-
Branch(IsBigIntInstanceType(lhs_instance_type), &if_lhsisbigint,
12284-
&if_lhsisnotbigint);
12285-
12286-
BIND(&if_lhsisbigint);
1228712273
{
12288-
// Load the instance type of {rhs}.
12289-
Node* rhs_instance_type = LoadInstanceType(rhs);
12290-
12291-
// Check if {rhs} is also a BigInt.
12292-
Label if_rhsisbigint(this, Label::kDeferred),
12293-
if_rhsisnotbigint(this);
12294-
Branch(IsBigIntInstanceType(rhs_instance_type), &if_rhsisbigint,
12295-
&if_rhsisnotbigint);
12274+
// Check if {lhs} is a BigInt.
12275+
Label if_lhsisbigint(this), if_lhsisnotbigint(this);
12276+
Branch(IsBigIntInstanceType(lhs_instance_type), &if_lhsisbigint,
12277+
&if_lhsisnotbigint);
1229612278

12297-
BIND(&if_rhsisbigint);
12279+
BIND(&if_lhsisbigint);
1229812280
{
12299-
if (var_type_feedback != nullptr) {
12300-
var_type_feedback->Bind(
12301-
SmiConstant(CompareOperationFeedback::kBigInt));
12281+
// Load the instance type of {rhs}.
12282+
Node* rhs_instance_type = LoadInstanceType(rhs);
12283+
12284+
// Check if {rhs} is also a BigInt.
12285+
Label if_rhsisbigint(this, Label::kDeferred),
12286+
if_rhsisnotbigint(this);
12287+
Branch(IsBigIntInstanceType(rhs_instance_type), &if_rhsisbigint,
12288+
&if_rhsisnotbigint);
12289+
12290+
BIND(&if_rhsisbigint);
12291+
{
12292+
CombineFeedback(var_type_feedback,
12293+
CompareOperationFeedback::kBigInt);
12294+
result.Bind(CallRuntime(Runtime::kBigIntEqualToBigInt,
12295+
NoContextConstant(), lhs, rhs));
12296+
Goto(&end);
1230212297
}
12303-
result.Bind(CallRuntime(Runtime::kBigIntEqualToBigInt,
12304-
NoContextConstant(), lhs, rhs));
12305-
Goto(&end);
12306-
}
12307-
12308-
BIND(&if_rhsisnotbigint);
12309-
Goto(&if_notequal);
12310-
}
1231112298

12312-
BIND(&if_lhsisnotbigint);
12313-
if (var_type_feedback != nullptr) {
12314-
// Load the instance type of {rhs}.
12315-
Node* rhs_map = LoadMap(rhs);
12316-
Node* rhs_instance_type = LoadMapInstanceType(rhs_map);
12317-
12318-
Label if_lhsissymbol(this), if_lhsisreceiver(this),
12319-
if_lhsisoddball(this);
12320-
GotoIf(IsJSReceiverInstanceType(lhs_instance_type),
12321-
&if_lhsisreceiver);
12322-
GotoIf(IsBooleanMap(lhs_map), &if_notequal);
12323-
GotoIf(IsOddballInstanceType(lhs_instance_type), &if_lhsisoddball);
12324-
Branch(IsSymbolInstanceType(lhs_instance_type), &if_lhsissymbol,
12325-
&if_notequal);
12326-
12327-
BIND(&if_lhsisreceiver);
12328-
{
12329-
GotoIf(IsBooleanMap(rhs_map), &if_notequal);
12330-
var_type_feedback->Bind(
12331-
SmiConstant(CompareOperationFeedback::kReceiver));
12332-
GotoIf(IsJSReceiverInstanceType(rhs_instance_type), &if_notequal);
12333-
var_type_feedback->Bind(SmiConstant(
12334-
CompareOperationFeedback::kReceiverOrNullOrUndefined));
12335-
GotoIf(IsOddballInstanceType(rhs_instance_type), &if_notequal);
12336-
var_type_feedback->Bind(
12337-
SmiConstant(CompareOperationFeedback::kAny));
12338-
Goto(&if_notequal);
12299+
BIND(&if_rhsisnotbigint);
12300+
Goto(&if_not_equivalent_types);
1233912301
}
1234012302

12341-
BIND(&if_lhsisoddball);
12342-
{
12343-
STATIC_ASSERT(LAST_PRIMITIVE_TYPE == ODDBALL_TYPE);
12344-
GotoIf(IsBooleanMap(rhs_map), &if_notequal);
12345-
GotoIf(
12346-
Int32LessThan(rhs_instance_type, Int32Constant(ODDBALL_TYPE)),
12347-
&if_notequal);
12348-
var_type_feedback->Bind(SmiConstant(
12349-
CompareOperationFeedback::kReceiverOrNullOrUndefined));
12350-
Goto(&if_notequal);
12351-
}
12303+
BIND(&if_lhsisnotbigint);
12304+
if (var_type_feedback != nullptr) {
12305+
// Load the instance type of {rhs}.
12306+
Node* rhs_map = LoadMap(rhs);
12307+
Node* rhs_instance_type = LoadMapInstanceType(rhs_map);
12308+
12309+
Label if_lhsissymbol(this), if_lhsisreceiver(this),
12310+
if_lhsisoddball(this);
12311+
GotoIf(IsJSReceiverInstanceType(lhs_instance_type),
12312+
&if_lhsisreceiver);
12313+
GotoIf(IsBooleanMap(lhs_map), &if_not_equivalent_types);
12314+
GotoIf(IsOddballInstanceType(lhs_instance_type),
12315+
&if_lhsisoddball);
12316+
Branch(IsSymbolInstanceType(lhs_instance_type), &if_lhsissymbol,
12317+
&if_not_equivalent_types);
12318+
12319+
BIND(&if_lhsisreceiver);
12320+
{
12321+
GotoIf(IsBooleanMap(rhs_map), &if_not_equivalent_types);
12322+
OverwriteFeedback(var_type_feedback,
12323+
CompareOperationFeedback::kReceiver);
12324+
GotoIf(IsJSReceiverInstanceType(rhs_instance_type),
12325+
&if_notequal);
12326+
OverwriteFeedback(
12327+
var_type_feedback,
12328+
CompareOperationFeedback::kReceiverOrNullOrUndefined);
12329+
GotoIf(IsOddballInstanceType(rhs_instance_type), &if_notequal);
12330+
Goto(&if_not_equivalent_types);
12331+
}
1235212332

12353-
BIND(&if_lhsissymbol);
12354-
{
12355-
GotoIfNot(IsSymbolInstanceType(rhs_instance_type), &if_notequal);
12356-
var_type_feedback->Bind(
12357-
SmiConstant(CompareOperationFeedback::kSymbol));
12333+
BIND(&if_lhsisoddball);
12334+
{
12335+
STATIC_ASSERT(LAST_PRIMITIVE_TYPE == ODDBALL_TYPE);
12336+
GotoIf(IsBooleanMap(rhs_map), &if_not_equivalent_types);
12337+
GotoIf(Int32LessThan(rhs_instance_type,
12338+
Int32Constant(ODDBALL_TYPE)),
12339+
&if_not_equivalent_types);
12340+
OverwriteFeedback(
12341+
var_type_feedback,
12342+
CompareOperationFeedback::kReceiverOrNullOrUndefined);
12343+
Goto(&if_notequal);
12344+
}
12345+
12346+
BIND(&if_lhsissymbol);
12347+
{
12348+
GotoIfNot(IsSymbolInstanceType(rhs_instance_type),
12349+
&if_not_equivalent_types);
12350+
OverwriteFeedback(var_type_feedback,
12351+
CompareOperationFeedback::kSymbol);
12352+
Goto(&if_notequal);
12353+
}
12354+
} else {
1235812355
Goto(&if_notequal);
1235912356
}
12360-
} else {
12361-
Goto(&if_notequal);
1236212357
}
1236312358
}
1236412359
}
@@ -12375,10 +12370,8 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
1237512370
Branch(TaggedIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi);
1237612371

1237712372
BIND(&if_rhsissmi);
12378-
if (var_type_feedback != nullptr) {
12379-
var_type_feedback->Bind(
12380-
SmiConstant(CompareOperationFeedback::kSignedSmall));
12381-
}
12373+
CombineFeedback(var_type_feedback,
12374+
CompareOperationFeedback::kSignedSmall);
1238212375
Goto(&if_notequal);
1238312376

1238412377
BIND(&if_rhsisnotsmi);
@@ -12396,17 +12389,14 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
1239612389
Node* lhs_value = SmiToFloat64(lhs);
1239712390
Node* rhs_value = LoadHeapNumberValue(rhs);
1239812391

12399-
if (var_type_feedback != nullptr) {
12400-
var_type_feedback->Bind(
12401-
SmiConstant(CompareOperationFeedback::kNumber));
12402-
}
12392+
CombineFeedback(var_type_feedback, CompareOperationFeedback::kNumber);
1240312393

1240412394
// Perform a floating point comparison of {lhs} and {rhs}.
1240512395
Branch(Float64Equal(lhs_value, rhs_value), &if_equal, &if_notequal);
1240612396
}
1240712397

1240812398
BIND(&if_rhsisnotnumber);
12409-
Goto(&if_notequal);
12399+
Goto(&if_not_equivalent_types);
1241012400
}
1241112401
}
1241212402
}
@@ -12417,6 +12407,12 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
1241712407
Goto(&end);
1241812408
}
1241912409

12410+
BIND(&if_not_equivalent_types);
12411+
{
12412+
OverwriteFeedback(var_type_feedback, CompareOperationFeedback::kAny);
12413+
Goto(&if_notequal);
12414+
}
12415+
1242012416
BIND(&if_notequal);
1242112417
{
1242212418
result.Bind(FalseConstant());

0 commit comments

Comments
 (0)