Commit 165e42c2 authored by yangguo@chromium.org's avatar yangguo@chromium.org

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
parent 9de66b9f
...@@ -6895,6 +6895,8 @@ void ICCompareStub::GenerateStrings(MacroAssembler* masm) { ...@@ -6895,6 +6895,8 @@ void ICCompareStub::GenerateStrings(MacroAssembler* masm) {
ASSERT(state_ == CompareIC::STRINGS); ASSERT(state_ == CompareIC::STRINGS);
Label miss; Label miss;
bool equality = Token::IsEqualityOp(op_);
// Registers containing left and right operands respectively. // Registers containing left and right operands respectively.
Register left = a1; Register left = a1;
Register right = a0; Register right = a0;
...@@ -6931,32 +6933,43 @@ void ICCompareStub::GenerateStrings(MacroAssembler* masm) { ...@@ -6931,32 +6933,43 @@ void ICCompareStub::GenerateStrings(MacroAssembler* masm) {
// Check that both strings are symbols. If they are, we're done // Check that both strings are symbols. If they are, we're done
// because we already know they are not identical. // because we already know they are not identical.
ASSERT(GetCondition() == eq); if (equality) {
STATIC_ASSERT(kSymbolTag != 0); ASSERT(GetCondition() == eq);
__ And(tmp3, tmp1, Operand(tmp2)); STATIC_ASSERT(kSymbolTag != 0);
__ And(tmp5, tmp3, Operand(kIsSymbolMask)); __ And(tmp3, tmp1, Operand(tmp2));
Label is_symbol; __ And(tmp5, tmp3, Operand(kIsSymbolMask));
__ Branch(&is_symbol, eq, tmp5, Operand(zero_reg), USE_DELAY_SLOT); Label is_symbol;
__ mov(v0, a0); // In the delay slot. __ Branch(&is_symbol, eq, tmp5, Operand(zero_reg), USE_DELAY_SLOT);
// Make sure a0 is non-zero. At this point input operands are __ mov(v0, a0); // In the delay slot.
// guaranteed to be non-zero. // Make sure a0 is non-zero. At this point input operands are
ASSERT(right.is(a0)); // guaranteed to be non-zero.
__ Ret(); ASSERT(right.is(a0));
__ bind(&is_symbol); __ Ret();
__ bind(&is_symbol);
}
// Check that both strings are sequential ASCII. // Check that both strings are sequential ASCII.
Label runtime; Label runtime;
__ JumpIfBothInstanceTypesAreNotSequentialAscii(tmp1, tmp2, tmp3, tmp4, __ JumpIfBothInstanceTypesAreNotSequentialAscii(
&runtime); tmp1, tmp2, tmp3, tmp4, &runtime);
// Compare flat ASCII strings. Returns when done. // Compare flat ASCII strings. Returns when done.
StringCompareStub::GenerateFlatAsciiStringEquals( if (equality) {
masm, left, right, tmp1, tmp2, tmp3); StringCompareStub::GenerateFlatAsciiStringEquals(
masm, left, right, tmp1, tmp2, tmp3);
} else {
StringCompareStub::GenerateCompareFlatAsciiStrings(
masm, left, right, tmp1, tmp2, tmp3, tmp4);
}
// Handle more complex cases in runtime. // Handle more complex cases in runtime.
__ bind(&runtime); __ bind(&runtime);
__ Push(left, right); __ Push(left, right);
__ TailCallRuntime(Runtime::kStringEquals, 2, 1); if (equality) {
__ TailCallRuntime(Runtime::kStringEquals, 2, 1);
} else {
__ TailCallRuntime(Runtime::kStringCompare, 2, 1);
}
__ bind(&miss); __ bind(&miss);
GenerateMiss(masm); GenerateMiss(masm);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment