Index: src/ppc/code-stubs-ppc.cc |
diff --git a/src/ppc/code-stubs-ppc.cc b/src/ppc/code-stubs-ppc.cc |
index 0ff2beaa10d0523b6f3d222484e987d9d6532816..2457d763bad46c643d2032575b2905cf7ad8683a 100644 |
--- a/src/ppc/code-stubs-ppc.cc |
+++ b/src/ppc/code-stubs-ppc.cc |
@@ -494,8 +494,9 @@ static void EmitCheckForTwoHeapNumbers(MacroAssembler* masm, Register lhs, |
__ b(both_loaded_as_doubles); |
} |
- |
-// Fast negative check for internalized-to-internalized equality. |
+// Fast negative check for internalized-to-internalized equality or receiver |
+// equality. Also handles the undetectable receiver to null/undefined |
+// comparison. |
static void EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm, |
Register lhs, Register rhs, |
Label* possible_strings, |
@@ -503,7 +504,7 @@ static void EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm, |
DCHECK((lhs.is(r3) && rhs.is(r4)) || (lhs.is(r4) && rhs.is(r3))); |
// r5 is object type of rhs. |
- Label object_test, return_unequal, undetectable; |
+ Label object_test, return_equal, return_unequal, undetectable; |
STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); |
__ andi(r0, r5, Operand(kIsNotStringMask)); |
__ bne(&object_test, cr0); |
@@ -541,6 +542,16 @@ static void EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm, |
__ bind(&undetectable); |
__ andi(r0, r8, Operand(1 << Map::kIsUndetectable)); |
__ beq(&return_unequal, cr0); |
+ |
+ // If both sides are JSReceivers, then the result is false according to |
+ // the HTML specification, which says that only comparisons with null or |
+ // undefined are affected by special casing for document.all. |
+ __ CompareInstanceType(r5, r5, ODDBALL_TYPE); |
+ __ beq(&return_equal); |
+ __ CompareInstanceType(r6, r6, ODDBALL_TYPE); |
+ __ bne(&return_unequal); |
+ |
+ __ bind(&return_equal); |
__ li(r3, Operand(EQUAL)); |
__ Ret(); |
} |