Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1700)

Unified Diff: src/x64/code-stubs-x64.cc

Issue 1347913003: [stubs] Refactor StringCompareStub and use it for HStringCompareAndBranch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips64/lithium-codegen-mips64.cc ('k') | src/x64/interface-descriptors-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/code-stubs-x64.cc
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
index dde834f8e8373c68fd92352f5fa60c8cf688ee09..86cca8979afba13066d41a671c04d22bc737f54b 100644
--- a/src/x64/code-stubs-x64.cc
+++ b/src/x64/code-stubs-x64.cc
@@ -3316,43 +3316,40 @@ void StringHelper::GenerateOneByteCharsCompareLoop(
void StringCompareStub::Generate(MacroAssembler* masm) {
- Label runtime;
-
- // Stack frame on entry.
- // rsp[0] : return address
- // rsp[8] : right string
- // rsp[16] : left string
-
- StackArgumentsAccessor args(rsp, 2, ARGUMENTS_DONT_CONTAIN_RECEIVER);
- __ movp(rdx, args.GetArgumentOperand(0)); // left
- __ movp(rax, args.GetArgumentOperand(1)); // right
+ // ----------- S t a t e -------------
+ // -- rdx : left string
+ // -- rax : right string
+ // -- rsp[0] : return address
+ // -----------------------------------
+ __ AssertString(rdx);
+ __ AssertString(rax);
// Check for identity.
Label not_same;
__ cmpp(rdx, rax);
__ j(not_equal, &not_same, Label::kNear);
__ Move(rax, Smi::FromInt(EQUAL));
- Counters* counters = isolate()->counters();
- __ IncrementCounter(counters->string_compare_native(), 1);
- __ ret(2 * kPointerSize);
+ __ IncrementCounter(isolate()->counters()->string_compare_native(), 1);
+ __ Ret();
__ bind(&not_same);
// Check that both are sequential one-byte strings.
+ Label runtime;
__ JumpIfNotBothSequentialOneByteStrings(rdx, rax, rcx, rbx, &runtime);
// Inline comparison of one-byte strings.
- __ IncrementCounter(counters->string_compare_native(), 1);
- // Drop arguments from the stack
- __ PopReturnAddressTo(rcx);
- __ addp(rsp, Immediate(2 * kPointerSize));
- __ PushReturnAddressFrom(rcx);
+ __ IncrementCounter(isolate()->counters()->string_compare_native(), 1);
StringHelper::GenerateCompareFlatOneByteStrings(masm, rdx, rax, rcx, rbx, rdi,
r8);
// Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
// tagged as a small integer.
__ bind(&runtime);
+ __ PopReturnAddressTo(rcx);
+ __ Push(rdx);
+ __ Push(rax);
+ __ PushReturnAddressFrom(rcx);
__ TailCallRuntime(Runtime::kStringCompare, 2, 1);
}
« no previous file with comments | « src/mips64/lithium-codegen-mips64.cc ('k') | src/x64/interface-descriptors-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698