PPC: [undetectable] Really get comparisons of document.all right now.

Port 679d9503cf

Original commit message:
    According to https://www.w3.org/TR/html5/obsolete.html#dom-document-all,
    comparisons of document.all to other values such as strings or objects,
    are unaffected. In fact document.all only gets special treatment in
    comparisons with null or undefined according to HTML. Especially setting
    the undetectable doesn't make two distinct JSReceivers equal.

R=bmeurer@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=

Review URL: https://codereview.chromium.org/1785503002

Cr-Commit-Position: refs/heads/master@{#34645}
This commit is contained in:
mbrandy 2016-03-09 15:12:53 -08:00 committed by Commit bot
parent 209c215244
commit eaa38ad177

View File

@ -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();
}