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

port 5912e0f014bd7b7d52cdc293145a912a4ecf2cf3(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}
This commit is contained in:
zhengxing.li 2016-03-06 18:38:53 -08:00 committed by Commit bot
parent f24dffea4c
commit 5dbc0e30cb
2 changed files with 4 additions and 49 deletions

View File

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

View File

@ -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