| Index: src/code-stub-assembler.cc
|
| diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc
|
| index edfe2de86c1c0c00140ce58d81a4395bd6ef3167..4ff0254f5af67f9ab2d984bd47c51f4023728068 100644
|
| --- a/src/code-stub-assembler.cc
|
| +++ b/src/code-stub-assembler.cc
|
| @@ -3283,6 +3283,10 @@ Node* CodeStubAssembler::IsString(Node* object) {
|
| Int32Constant(FIRST_NONSTRING_TYPE));
|
| }
|
|
|
| +Node* CodeStubAssembler::IsSymbolInstanceType(Node* instance_type) {
|
| + return Word32Equal(instance_type, Int32Constant(SYMBOL_TYPE));
|
| +}
|
| +
|
| Node* CodeStubAssembler::IsSymbol(Node* object) {
|
| return IsSymbolMap(LoadMap(object));
|
| }
|
| @@ -7434,9 +7438,12 @@ void CodeStubAssembler::GenerateEqual_Same(Node* value, Label* if_equal,
|
| // Collect type feedback.
|
| Node* instance_type = LoadMapInstanceType(value_map);
|
|
|
| - Label if_valueisstring(this), if_valueisnotstring(this);
|
| - Branch(IsStringInstanceType(instance_type), &if_valueisstring,
|
| - &if_valueisnotstring);
|
| + Label if_valueisstring(this), if_valueisreceiver(this),
|
| + if_valueissymbol(this), if_valueisother(this, Label::kDeferred);
|
| + GotoIf(IsStringInstanceType(instance_type), &if_valueisstring);
|
| + GotoIf(IsJSReceiverInstanceType(instance_type), &if_valueisreceiver);
|
| + Branch(IsSymbolInstanceType(instance_type), &if_valueissymbol,
|
| + &if_valueisother);
|
|
|
| BIND(&if_valueisstring);
|
| {
|
| @@ -7445,15 +7452,26 @@ void CodeStubAssembler::GenerateEqual_Same(Node* value, Label* if_equal,
|
| Goto(if_equal);
|
| }
|
|
|
| - BIND(&if_valueisnotstring);
|
| + BIND(&if_valueissymbol);
|
| {
|
| - var_type_feedback->Bind(SmiConstant(CompareOperationFeedback::kAny));
|
| - GotoIfNot(IsJSReceiverInstanceType(instance_type), if_equal);
|
| + CombineFeedback(var_type_feedback,
|
| + SmiConstant(CompareOperationFeedback::kSymbol));
|
| + Goto(if_equal);
|
| + }
|
|
|
| + BIND(&if_valueisreceiver);
|
| + {
|
| CombineFeedback(var_type_feedback,
|
| SmiConstant(CompareOperationFeedback::kReceiver));
|
| Goto(if_equal);
|
| }
|
| +
|
| + BIND(&if_valueisother);
|
| + {
|
| + CombineFeedback(var_type_feedback,
|
| + SmiConstant(CompareOperationFeedback::kAny));
|
| + Goto(if_equal);
|
| + }
|
| } else {
|
| Goto(if_equal);
|
| }
|
| @@ -7851,14 +7869,8 @@ Node* CodeStubAssembler::Equal(Node* lhs, Node* rhs, Node* context,
|
|
|
| BIND(&if_lhsissymbol);
|
| {
|
| - if (var_type_feedback != nullptr) {
|
| - var_type_feedback->Bind(
|
| - SmiConstant(CompareOperationFeedback::kAny));
|
| - }
|
| -
|
| // Check if the {rhs} is a JSReceiver.
|
| Label if_rhsisreceiver(this), if_rhsisnotreceiver(this);
|
| - STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE);
|
| Branch(IsJSReceiverInstanceType(rhs_instance_type),
|
| &if_rhsisreceiver, &if_rhsisnotreceiver);
|
|
|
| @@ -7868,6 +7880,10 @@ Node* CodeStubAssembler::Equal(Node* lhs, Node* rhs, Node* context,
|
| // Swapping {lhs} and {rhs} is not observable and doesn't
|
| // matter for the result, so we can just swap them and use
|
| // the JSReceiver handling below (for {lhs} being a JSReceiver).
|
| + if (var_type_feedback != nullptr) {
|
| + var_type_feedback->Bind(
|
| + SmiConstant(CompareOperationFeedback::kAny));
|
| + }
|
| var_lhs.Bind(rhs);
|
| var_rhs.Bind(lhs);
|
| Goto(&loop);
|
| @@ -7877,7 +7893,27 @@ Node* CodeStubAssembler::Equal(Node* lhs, Node* rhs, Node* context,
|
| {
|
| // The {rhs} is not a JSReceiver and also not the same Symbol
|
| // as the {lhs}, so this is equality check is considered false.
|
| - Goto(&if_notequal);
|
| + if (var_type_feedback != nullptr) {
|
| + Label if_rhsissymbol(this), if_rhsisnotsymbol(this);
|
| + Branch(IsSymbolInstanceType(rhs_instance_type), &if_rhsissymbol,
|
| + &if_rhsisnotsymbol);
|
| +
|
| + BIND(&if_rhsissymbol);
|
| + {
|
| + var_type_feedback->Bind(
|
| + SmiConstant(CompareOperationFeedback::kSymbol));
|
| + Goto(&if_notequal);
|
| + }
|
| +
|
| + BIND(&if_rhsisnotsymbol);
|
| + {
|
| + var_type_feedback->Bind(
|
| + SmiConstant(CompareOperationFeedback::kAny));
|
| + Goto(&if_notequal);
|
| + }
|
| + } else {
|
| + Goto(&if_notequal);
|
| + }
|
| }
|
| }
|
|
|
| @@ -8167,14 +8203,31 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs,
|
|
|
| BIND(&if_lhsisnotstring);
|
| if (var_type_feedback != nullptr) {
|
| - GotoIfNot(IsJSReceiverInstanceType(lhs_instance_type),
|
| - &if_notequal);
|
| - GotoIfNot(IsJSReceiverInstanceType(rhs_instance_type),
|
| - &if_notequal);
|
| - var_type_feedback->Bind(
|
| - SmiConstant(CompareOperationFeedback::kReceiver));
|
| + Label if_lhsissymbol(this), if_lhsisreceiver(this);
|
| + GotoIf(IsJSReceiverInstanceType(lhs_instance_type),
|
| + &if_lhsisreceiver);
|
| + Branch(IsSymbolInstanceType(lhs_instance_type), &if_lhsissymbol,
|
| + &if_notequal);
|
| +
|
| + BIND(&if_lhsisreceiver);
|
| + {
|
| + GotoIfNot(IsJSReceiverInstanceType(rhs_instance_type),
|
| + &if_notequal);
|
| + var_type_feedback->Bind(
|
| + SmiConstant(CompareOperationFeedback::kReceiver));
|
| + 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);
|
| }
|
| - Goto(&if_notequal);
|
| }
|
| }
|
| }
|
|
|