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

Side by Side Diff: src/arm/code-stubs-arm.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
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | src/compiler/code-stub-assembler.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_ARM 5 #if V8_TARGET_ARCH_ARM
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 2832 matching lines...) Expand 10 before | Expand all | Expand 10 after
2843 __ bind(&loop); 2843 __ bind(&loop);
2844 __ ldrb(scratch1, MemOperand(left, index)); 2844 __ ldrb(scratch1, MemOperand(left, index));
2845 __ ldrb(scratch2, MemOperand(right, index)); 2845 __ ldrb(scratch2, MemOperand(right, index));
2846 __ cmp(scratch1, scratch2); 2846 __ cmp(scratch1, scratch2);
2847 __ b(ne, chars_not_equal); 2847 __ b(ne, chars_not_equal);
2848 __ add(index, index, Operand(1), SetCC); 2848 __ add(index, index, Operand(1), SetCC);
2849 __ b(ne, &loop); 2849 __ b(ne, &loop);
2850 } 2850 }
2851 2851
2852 2852
2853 void StringCompareStub::Generate(MacroAssembler* masm) {
2854 // ----------- S t a t e -------------
2855 // -- r1 : left
2856 // -- r0 : right
2857 // -- lr : return address
2858 // -----------------------------------
2859 __ AssertString(r1);
2860 __ AssertString(r0);
2861
2862 Label not_same;
2863 __ cmp(r0, r1);
2864 __ b(ne, &not_same);
2865 __ mov(r0, Operand(Smi::FromInt(EQUAL)));
2866 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1, r1,
2867 r2);
2868 __ Ret();
2869
2870 __ bind(&not_same);
2871
2872 // Check that both objects are sequential one-byte strings.
2873 Label runtime;
2874 __ JumpIfNotBothSequentialOneByteStrings(r1, r0, r2, r3, &runtime);
2875
2876 // Compare flat one-byte strings natively.
2877 __ IncrementCounter(isolate()->counters()->string_compare_native(), 1, r2,
2878 r3);
2879 StringHelper::GenerateCompareFlatOneByteStrings(masm, r1, r0, r2, r3, r4, r5);
2880
2881 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
2882 // tagged as a small integer.
2883 __ bind(&runtime);
2884 __ Push(r1, r0);
2885 __ TailCallRuntime(Runtime::kStringCompare);
2886 }
2887
2888
2889 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { 2853 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) {
2890 // ----------- S t a t e ------------- 2854 // ----------- S t a t e -------------
2891 // -- r1 : left 2855 // -- r1 : left
2892 // -- r0 : right 2856 // -- r0 : right
2893 // -- lr : return address 2857 // -- lr : return address
2894 // ----------------------------------- 2858 // -----------------------------------
2895 2859
2896 // Load r2 with the allocation site. We stick an undefined dummy value here 2860 // Load r2 with the allocation site. We stick an undefined dummy value here
2897 // and replace it with the real allocation site later when we instantiate this 2861 // and replace it with the real allocation site later when we instantiate this
2898 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). 2862 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate().
(...skipping 2728 matching lines...) Expand 10 before | Expand all | Expand 10 after
5627 kStackUnwindSpace, NULL, return_value_operand, NULL); 5591 kStackUnwindSpace, NULL, return_value_operand, NULL);
5628 } 5592 }
5629 5593
5630 5594
5631 #undef __ 5595 #undef __
5632 5596
5633 } // namespace internal 5597 } // namespace internal
5634 } // namespace v8 5598 } // namespace v8
5635 5599
5636 #endif // V8_TARGET_ARCH_ARM 5600 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | src/compiler/code-stub-assembler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698