OLD | NEW |
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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 2901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2912 __ ldrb(scratch, MemOperand(src, 1, PostIndex), lt); | 2912 __ ldrb(scratch, MemOperand(src, 1, PostIndex), lt); |
2913 __ strb(scratch, MemOperand(dest, 1, PostIndex)); | 2913 __ strb(scratch, MemOperand(dest, 1, PostIndex)); |
2914 __ bind(&loop_entry); | 2914 __ bind(&loop_entry); |
2915 __ cmp(dest, Operand(limit)); | 2915 __ cmp(dest, Operand(limit)); |
2916 __ b(lt, &loop); | 2916 __ b(lt, &loop); |
2917 | 2917 |
2918 __ bind(&done); | 2918 __ bind(&done); |
2919 } | 2919 } |
2920 | 2920 |
2921 | 2921 |
2922 void StringHelper::GenerateHashInit(MacroAssembler* masm, | |
2923 Register hash, | |
2924 Register character) { | |
2925 // hash = character + (character << 10); | |
2926 __ LoadRoot(hash, Heap::kHashSeedRootIndex); | |
2927 // Untag smi seed and add the character. | |
2928 __ add(hash, character, Operand(hash, LSR, kSmiTagSize)); | |
2929 // hash += hash << 10; | |
2930 __ add(hash, hash, Operand(hash, LSL, 10)); | |
2931 // hash ^= hash >> 6; | |
2932 __ eor(hash, hash, Operand(hash, LSR, 6)); | |
2933 } | |
2934 | |
2935 | |
2936 void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm, | |
2937 Register hash, | |
2938 Register character) { | |
2939 // hash += character; | |
2940 __ add(hash, hash, Operand(character)); | |
2941 // hash += hash << 10; | |
2942 __ add(hash, hash, Operand(hash, LSL, 10)); | |
2943 // hash ^= hash >> 6; | |
2944 __ eor(hash, hash, Operand(hash, LSR, 6)); | |
2945 } | |
2946 | |
2947 | |
2948 void StringHelper::GenerateHashGetHash(MacroAssembler* masm, | |
2949 Register hash) { | |
2950 // hash += hash << 3; | |
2951 __ add(hash, hash, Operand(hash, LSL, 3)); | |
2952 // hash ^= hash >> 11; | |
2953 __ eor(hash, hash, Operand(hash, LSR, 11)); | |
2954 // hash += hash << 15; | |
2955 __ add(hash, hash, Operand(hash, LSL, 15)); | |
2956 | |
2957 __ and_(hash, hash, Operand(String::kHashBitMask), SetCC); | |
2958 | |
2959 // if (hash == 0) hash = 27; | |
2960 __ mov(hash, Operand(StringHasher::kZeroHash), LeaveCC, eq); | |
2961 } | |
2962 | |
2963 | |
2964 void SubStringStub::Generate(MacroAssembler* masm) { | 2922 void SubStringStub::Generate(MacroAssembler* masm) { |
2965 Label runtime; | 2923 Label runtime; |
2966 | 2924 |
2967 // Stack frame on entry. | 2925 // Stack frame on entry. |
2968 // lr: return address | 2926 // lr: return address |
2969 // sp[0]: to | 2927 // sp[0]: to |
2970 // sp[4]: from | 2928 // sp[4]: from |
2971 // sp[8]: string | 2929 // sp[8]: string |
2972 | 2930 |
2973 // This stub is called from the native-call %_SubString(...), so | 2931 // This stub is called from the native-call %_SubString(...), so |
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4721 MemOperand(fp, 6 * kPointerSize), | 4679 MemOperand(fp, 6 * kPointerSize), |
4722 NULL); | 4680 NULL); |
4723 } | 4681 } |
4724 | 4682 |
4725 | 4683 |
4726 #undef __ | 4684 #undef __ |
4727 | 4685 |
4728 } } // namespace v8::internal | 4686 } } // namespace v8::internal |
4729 | 4687 |
4730 #endif // V8_TARGET_ARCH_ARM | 4688 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |