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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 1765823002: [compiler] Introduce code stubs for string relational comparisons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 2846 matching lines...) Expand 10 before | Expand all | Expand 10 after
2857 Label loop; 2857 Label loop;
2858 __ bind(&loop); 2858 __ bind(&loop);
2859 __ mov_b(scratch, Operand(left, index, times_1, 0)); 2859 __ mov_b(scratch, Operand(left, index, times_1, 0));
2860 __ cmpb(scratch, Operand(right, index, times_1, 0)); 2860 __ cmpb(scratch, Operand(right, index, times_1, 0));
2861 __ j(not_equal, chars_not_equal, chars_not_equal_near); 2861 __ j(not_equal, chars_not_equal, chars_not_equal_near);
2862 __ inc(index); 2862 __ inc(index);
2863 __ j(not_zero, &loop); 2863 __ j(not_zero, &loop);
2864 } 2864 }
2865 2865
2866 2866
2867 void StringCompareStub::Generate(MacroAssembler* masm) {
2868 // ----------- S t a t e -------------
2869 // -- edx : left string
2870 // -- eax : right string
2871 // -- esp[0] : return address
2872 // -----------------------------------
2873 __ AssertString(edx);
2874 __ AssertString(eax);
2875
2876 Label not_same;
2877 __ cmp(edx, eax);
2878 __ j(not_equal, &not_same, Label::kNear);
2879 __ Move(eax, Immediate(Smi::FromInt(EQUAL)));
2880 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1);
2881 __ Ret();
2882
2883 __ bind(&not_same);
2884
2885 // Check that both objects are sequential one-byte strings.
2886 Label runtime;
2887 __ JumpIfNotBothSequentialOneByteStrings(edx, eax, ecx, ebx, &runtime);
2888
2889 // Compare flat one-byte strings.
2890 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1);
2891 StringHelper::GenerateCompareFlatOneByteStrings(masm, edx, eax, ecx, ebx,
2892 edi);
2893
2894 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
2895 // tagged as a small integer.
2896 __ bind(&runtime);
2897 __ PopReturnAddressTo(ecx);
2898 __ Push(edx);
2899 __ Push(eax);
2900 __ PushReturnAddressFrom(ecx);
2901 __ TailCallRuntime(Runtime::kStringCompare);
2902 }
2903
2904
2905 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { 2867 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) {
2906 // ----------- S t a t e ------------- 2868 // ----------- S t a t e -------------
2907 // -- edx : left 2869 // -- edx : left
2908 // -- eax : right 2870 // -- eax : right
2909 // -- esp[0] : return address 2871 // -- esp[0] : return address
2910 // ----------------------------------- 2872 // -----------------------------------
2911 2873
2912 // Load ecx with the allocation site. We stick an undefined dummy value here 2874 // Load ecx with the allocation site. We stick an undefined dummy value here
2913 // and replace it with the real allocation site later when we instantiate this 2875 // and replace it with the real allocation site later when we instantiate this
2914 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). 2876 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate().
(...skipping 3014 matching lines...) Expand 10 before | Expand all | Expand 10 after
5929 return_value_operand, NULL); 5891 return_value_operand, NULL);
5930 } 5892 }
5931 5893
5932 5894
5933 #undef __ 5895 #undef __
5934 5896
5935 } // namespace internal 5897 } // namespace internal
5936 } // namespace v8 5898 } // namespace v8
5937 5899
5938 #endif // V8_TARGET_ARCH_IA32 5900 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698