Commit 35bce027 authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: [compiler] Introduce code stubs for string relational comparisons.

Port 5912e0f0

Original commit message:
    Add StringLessThanStub, StringLessThanOrEqualStub, StringGreaterThanStub
    and StringGreaterThanOrEqualStub, based on the CodeStubAssembler, and
    hook them up with TurboFan (and Ignition). The stubs are currently
    essentially comparable with the StringCompareStub, which is now
    obsolete. We can later extend these stubs to cover more interesting
    cases (i.e. two byte sequential string comparisons, etc.).

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

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

Cr-Commit-Position: refs/heads/master@{#34508}
parent b9bfe33e
...@@ -2424,17 +2424,10 @@ void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { ...@@ -2424,17 +2424,10 @@ void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
DCHECK(ToRegister(instr->left()).is(r4)); DCHECK(ToRegister(instr->left()).is(r4));
DCHECK(ToRegister(instr->right()).is(r3)); DCHECK(ToRegister(instr->right()).is(r3));
if (Token::IsOrderedRelationalCompareOp(instr->op())) { Handle<Code> code = CodeFactory::StringCompare(isolate(), instr->op()).code();
Handle<Code> code = CodeFactory::StringCompare(isolate()).code(); CallCode(code, RelocInfo::CODE_TARGET, instr);
CallCode(code, RelocInfo::CODE_TARGET, instr); __ CompareRoot(r3, Heap::kTrueValueRootIndex);
__ cmpi(r3, Operand::Zero()); EmitBranch(instr, eq);
} else {
Handle<Code> code = CodeFactory::StringEqual(isolate()).code();
CallCode(code, RelocInfo::CODE_TARGET, instr);
__ CompareRoot(r3, Heap::kTrueValueRootIndex);
}
EmitBranch(instr, ComputeCompareCondition(instr->op()));
} }
......
...@@ -2943,42 +2943,6 @@ void StringHelper::GenerateOneByteCharsCompareLoop( ...@@ -2943,42 +2943,6 @@ void StringHelper::GenerateOneByteCharsCompareLoop(
} }
void StringCompareStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r4 : left
// -- r3 : right
// -- lr : return address
// -----------------------------------
__ AssertString(r4);
__ AssertString(r3);
Label not_same;
__ cmp(r3, r4);
__ bne(&not_same);
__ LoadSmiLiteral(r3, Smi::FromInt(EQUAL));
__ IncrementCounter(isolate()->counters()->string_compare_native(), 1, r4,
r5);
__ Ret();
__ bind(&not_same);
// Check that both objects are sequential one-byte strings.
Label runtime;
__ JumpIfNotBothSequentialOneByteStrings(r4, r3, r5, r6, &runtime);
// Compare flat one-byte strings natively.
__ IncrementCounter(isolate()->counters()->string_compare_native(), 1, r5,
r6);
StringHelper::GenerateCompareFlatOneByteStrings(masm, r4, r3, r5, r6, r7);
// Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
// tagged as a small integer.
__ bind(&runtime);
__ Push(r4, r3);
__ TailCallRuntime(Runtime::kStringCompare);
}
void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- r4 : left // -- r4 : left
......
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