Commit 5dbc0e30 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

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

  port 5912e0f0(r34485)

  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.).

BUG=

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

Cr-Commit-Position: refs/heads/master@{#34516}
parent f24dffea
......@@ -2452,17 +2452,10 @@ void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
DCHECK(ToRegister(instr->left()).is(edx));
DCHECK(ToRegister(instr->right()).is(eax));
if (Token::IsOrderedRelationalCompareOp(instr->op())) {
Handle<Code> code = CodeFactory::StringCompare(isolate()).code();
CallCode(code, RelocInfo::CODE_TARGET, instr);
__ test(eax, eax);
} else {
Handle<Code> code = CodeFactory::StringEqual(isolate()).code();
CallCode(code, RelocInfo::CODE_TARGET, instr);
__ CompareRoot(eax, Heap::kTrueValueRootIndex);
}
EmitBranch(instr, ComputeCompareCondition(instr->op()));
Handle<Code> code = CodeFactory::StringCompare(isolate(), instr->op()).code();
CallCode(code, RelocInfo::CODE_TARGET, instr);
__ CompareRoot(eax, Heap::kTrueValueRootIndex);
EmitBranch(instr, equal);
}
......
......@@ -2587,44 +2587,6 @@ void StringHelper::GenerateOneByteCharsCompareLoop(
}
void StringCompareStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- edx : left string
// -- eax : right string
// -- esp[0] : return address
// -----------------------------------
__ AssertString(edx);
__ AssertString(eax);
Label not_same;
__ cmp(edx, eax);
__ j(not_equal, &not_same, Label::kNear);
__ Move(eax, Immediate(Smi::FromInt(EQUAL)));
__ IncrementCounter(isolate()->counters()->string_compare_native(), 1);
__ Ret();
__ bind(&not_same);
// Check that both objects are sequential one-byte strings.
Label runtime;
__ JumpIfNotBothSequentialOneByteStrings(edx, eax, ecx, ebx, &runtime);
// Compare flat one-byte strings.
__ IncrementCounter(isolate()->counters()->string_compare_native(), 1);
StringHelper::GenerateCompareFlatOneByteStrings(masm, edx, eax, ecx, ebx,
edi);
// Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
// tagged as a small integer.
__ bind(&runtime);
__ PopReturnAddressTo(ecx);
__ Push(edx);
__ Push(eax);
__ PushReturnAddressFrom(ecx);
__ TailCallRuntime(Runtime::kStringCompare);
}
void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- edx : 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