MIPS: Inline inequality compares of strings into CompareICStub
Port r10988 (c6c9ebb5). Original commit message: Inline inequality compares of strings into CompareICStub instead of jumping into the CompareStub that handles the generic case. BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/9669026 Patch from Daniel Kalmar <kalmard@homejinni.com>. git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11002 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
9de66b9f3a
commit
165e42c291
@ -6895,6 +6895,8 @@ void ICCompareStub::GenerateStrings(MacroAssembler* masm) {
|
||||
ASSERT(state_ == CompareIC::STRINGS);
|
||||
Label miss;
|
||||
|
||||
bool equality = Token::IsEqualityOp(op_);
|
||||
|
||||
// Registers containing left and right operands respectively.
|
||||
Register left = a1;
|
||||
Register right = a0;
|
||||
@ -6931,32 +6933,43 @@ void ICCompareStub::GenerateStrings(MacroAssembler* masm) {
|
||||
|
||||
// Check that both strings are symbols. If they are, we're done
|
||||
// because we already know they are not identical.
|
||||
ASSERT(GetCondition() == eq);
|
||||
STATIC_ASSERT(kSymbolTag != 0);
|
||||
__ And(tmp3, tmp1, Operand(tmp2));
|
||||
__ And(tmp5, tmp3, Operand(kIsSymbolMask));
|
||||
Label is_symbol;
|
||||
__ Branch(&is_symbol, eq, tmp5, Operand(zero_reg), USE_DELAY_SLOT);
|
||||
__ mov(v0, a0); // In the delay slot.
|
||||
// Make sure a0 is non-zero. At this point input operands are
|
||||
// guaranteed to be non-zero.
|
||||
ASSERT(right.is(a0));
|
||||
__ Ret();
|
||||
__ bind(&is_symbol);
|
||||
if (equality) {
|
||||
ASSERT(GetCondition() == eq);
|
||||
STATIC_ASSERT(kSymbolTag != 0);
|
||||
__ And(tmp3, tmp1, Operand(tmp2));
|
||||
__ And(tmp5, tmp3, Operand(kIsSymbolMask));
|
||||
Label is_symbol;
|
||||
__ Branch(&is_symbol, eq, tmp5, Operand(zero_reg), USE_DELAY_SLOT);
|
||||
__ mov(v0, a0); // In the delay slot.
|
||||
// Make sure a0 is non-zero. At this point input operands are
|
||||
// guaranteed to be non-zero.
|
||||
ASSERT(right.is(a0));
|
||||
__ Ret();
|
||||
__ bind(&is_symbol);
|
||||
}
|
||||
|
||||
// Check that both strings are sequential ASCII.
|
||||
Label runtime;
|
||||
__ JumpIfBothInstanceTypesAreNotSequentialAscii(tmp1, tmp2, tmp3, tmp4,
|
||||
&runtime);
|
||||
__ JumpIfBothInstanceTypesAreNotSequentialAscii(
|
||||
tmp1, tmp2, tmp3, tmp4, &runtime);
|
||||
|
||||
// Compare flat ASCII strings. Returns when done.
|
||||
StringCompareStub::GenerateFlatAsciiStringEquals(
|
||||
masm, left, right, tmp1, tmp2, tmp3);
|
||||
if (equality) {
|
||||
StringCompareStub::GenerateFlatAsciiStringEquals(
|
||||
masm, left, right, tmp1, tmp2, tmp3);
|
||||
} else {
|
||||
StringCompareStub::GenerateCompareFlatAsciiStrings(
|
||||
masm, left, right, tmp1, tmp2, tmp3, tmp4);
|
||||
}
|
||||
|
||||
// Handle more complex cases in runtime.
|
||||
__ bind(&runtime);
|
||||
__ Push(left, right);
|
||||
__ TailCallRuntime(Runtime::kStringEquals, 2, 1);
|
||||
if (equality) {
|
||||
__ TailCallRuntime(Runtime::kStringEquals, 2, 1);
|
||||
} else {
|
||||
__ TailCallRuntime(Runtime::kStringCompare, 2, 1);
|
||||
}
|
||||
|
||||
__ bind(&miss);
|
||||
GenerateMiss(masm);
|
||||
|
Loading…
Reference in New Issue
Block a user