OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 2799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2810 Label loop; | 2810 Label loop; |
2811 __ bind(&loop); | 2811 __ bind(&loop); |
2812 __ movb(scratch, Operand(left, index, times_1, 0)); | 2812 __ movb(scratch, Operand(left, index, times_1, 0)); |
2813 __ cmpb(scratch, Operand(right, index, times_1, 0)); | 2813 __ cmpb(scratch, Operand(right, index, times_1, 0)); |
2814 __ j(not_equal, chars_not_equal, near_jump); | 2814 __ j(not_equal, chars_not_equal, near_jump); |
2815 __ incq(index); | 2815 __ incq(index); |
2816 __ j(not_zero, &loop); | 2816 __ j(not_zero, &loop); |
2817 } | 2817 } |
2818 | 2818 |
2819 | 2819 |
2820 void StringCompareStub::Generate(MacroAssembler* masm) { | |
2821 // ----------- S t a t e ------------- | |
2822 // -- rdx : left string | |
2823 // -- rax : right string | |
2824 // -- rsp[0] : return address | |
2825 // ----------------------------------- | |
2826 __ AssertString(rdx); | |
2827 __ AssertString(rax); | |
2828 | |
2829 // Check for identity. | |
2830 Label not_same; | |
2831 __ cmpp(rdx, rax); | |
2832 __ j(not_equal, ¬_same, Label::kNear); | |
2833 __ Move(rax, Smi::FromInt(EQUAL)); | |
2834 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1); | |
2835 __ Ret(); | |
2836 | |
2837 __ bind(¬_same); | |
2838 | |
2839 // Check that both are sequential one-byte strings. | |
2840 Label runtime; | |
2841 __ JumpIfNotBothSequentialOneByteStrings(rdx, rax, rcx, rbx, &runtime); | |
2842 | |
2843 // Inline comparison of one-byte strings. | |
2844 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1); | |
2845 StringHelper::GenerateCompareFlatOneByteStrings(masm, rdx, rax, rcx, rbx, rdi, | |
2846 r8); | |
2847 | |
2848 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | |
2849 // tagged as a small integer. | |
2850 __ bind(&runtime); | |
2851 __ PopReturnAddressTo(rcx); | |
2852 __ Push(rdx); | |
2853 __ Push(rax); | |
2854 __ PushReturnAddressFrom(rcx); | |
2855 __ TailCallRuntime(Runtime::kStringCompare); | |
2856 } | |
2857 | |
2858 | |
2859 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { | 2820 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { |
2860 // ----------- S t a t e ------------- | 2821 // ----------- S t a t e ------------- |
2861 // -- rdx : left | 2822 // -- rdx : left |
2862 // -- rax : right | 2823 // -- rax : right |
2863 // -- rsp[0] : return address | 2824 // -- rsp[0] : return address |
2864 // ----------------------------------- | 2825 // ----------------------------------- |
2865 | 2826 |
2866 // Load rcx with the allocation site. We stick an undefined dummy value here | 2827 // Load rcx with the allocation site. We stick an undefined dummy value here |
2867 // and replace it with the real allocation site later when we instantiate this | 2828 // and replace it with the real allocation site later when we instantiate this |
2868 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). | 2829 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). |
(...skipping 2782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5651 NULL); | 5612 NULL); |
5652 } | 5613 } |
5653 | 5614 |
5654 | 5615 |
5655 #undef __ | 5616 #undef __ |
5656 | 5617 |
5657 } // namespace internal | 5618 } // namespace internal |
5658 } // namespace v8 | 5619 } // namespace v8 |
5659 | 5620 |
5660 #endif // V8_TARGET_ARCH_X64 | 5621 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |