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, ¬_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(¬_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); |
} |