Index: src/ppc/code-stubs-ppc.cc |
diff --git a/src/ppc/code-stubs-ppc.cc b/src/ppc/code-stubs-ppc.cc |
index 2b848b29f3eaafa38e922ed0d53d40d591d0cfbd..088c5eed58371009ac9c664da38c2393e4813cc1 100644 |
--- a/src/ppc/code-stubs-ppc.cc |
+++ b/src/ppc/code-stubs-ppc.cc |
@@ -94,7 +94,7 @@ void InternalArrayNArgumentsConstructorStub::InitializeDescriptor( |
static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, |
- Condition cond); |
+ Condition cond, bool strong); |
static void EmitSmiNonsmiComparison(MacroAssembler* masm, Register lhs, |
Register rhs, Label* lhs_not_nan, |
Label* slow, bool strict); |
@@ -249,7 +249,7 @@ void DoubleToIStub::Generate(MacroAssembler* masm) { |
// Equality is almost reflexive (everything but NaN), so this is a test |
// for "identity and not NaN". |
static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, |
- Condition cond) { |
+ Condition cond, bool strong) { |
Label not_identical; |
Label heap_number, return_equal; |
__ cmp(r3, r4); |
@@ -260,10 +260,20 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, |
// They are both equal and they are not both Smis so both of them are not |
// Smis. If it's not a heap number, then return equal. |
if (cond == lt || cond == gt) { |
+ // Call runtime on identical JSObjects. |
__ CompareObjectType(r3, r7, r7, FIRST_SPEC_OBJECT_TYPE); |
__ bge(slow); |
+ // Call runtime on identical symbols since we need to throw a TypeError. |
__ cmpi(r7, Operand(SYMBOL_TYPE)); |
__ beq(slow); |
+ if (strong) { |
+ // Call the runtime on anything that is converted in the semantics, since |
+ // we need to throw a TypeError. Smis have already been ruled out. |
+ __ cmpi(r7, Operand(HEAP_NUMBER_TYPE)); |
+ __ beq(&return_equal); |
+ __ andi(r7, r7, Operand(kIsNotStringMask)); |
+ __ bne(slow, cr0); |
+ } |
} else { |
__ CompareObjectType(r3, r7, r7, HEAP_NUMBER_TYPE); |
__ beq(&heap_number); |
@@ -271,8 +281,16 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, |
if (cond != eq) { |
__ cmpi(r7, Operand(FIRST_SPEC_OBJECT_TYPE)); |
__ bge(slow); |
+ // Call runtime on identical symbols since we need to throw a TypeError. |
__ cmpi(r7, Operand(SYMBOL_TYPE)); |
__ beq(slow); |
+ if (strong) { |
+ // Call the runtime on anything that is converted in the semantics, |
+ // since we need to throw a TypeError. Smis and heap numbers have |
+ // already been ruled out. |
+ __ andi(r7, r7, Operand(kIsNotStringMask)); |
+ __ bne(slow, cr0); |
+ } |
// Normally here we fall through to return_equal, but undefined is |
// special: (undefined == undefined) == true, but |
// (undefined <= undefined) == false! See ECMAScript 11.8.5. |
@@ -687,7 +705,7 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { |
if (cc == eq) { |
native = strict() ? Builtins::STRICT_EQUALS : Builtins::EQUALS; |
} else { |
- native = Builtins::COMPARE; |
+ native = strong() ? Builtins::COMPARE_STRONG : Builtins::COMPARE; |
int ncr; // NaN compare result |
if (cc == lt || cc == le) { |
ncr = GREATER; |
@@ -3780,7 +3798,7 @@ void CompareICStub::GenerateNumbers(MacroAssembler* masm) { |
__ bind(&unordered); |
__ bind(&generic_stub); |
- CompareICStub stub(isolate(), op(), CompareICState::GENERIC, |
+ CompareICStub stub(isolate(), op(), strong(), CompareICState::GENERIC, |
CompareICState::GENERIC, CompareICState::GENERIC); |
__ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |