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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 3091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3102 __ daddiu(src, src, 1); | 3102 __ daddiu(src, src, 1); |
3103 __ sb(scratch, MemOperand(dest)); | 3103 __ sb(scratch, MemOperand(dest)); |
3104 __ daddiu(dest, dest, 1); | 3104 __ daddiu(dest, dest, 1); |
3105 __ bind(&loop_entry); | 3105 __ bind(&loop_entry); |
3106 __ Branch(&loop, lt, dest, Operand(limit)); | 3106 __ Branch(&loop, lt, dest, Operand(limit)); |
3107 | 3107 |
3108 __ bind(&done); | 3108 __ bind(&done); |
3109 } | 3109 } |
3110 | 3110 |
3111 | 3111 |
3112 void StringHelper::GenerateHashInit(MacroAssembler* masm, | |
3113 Register hash, | |
3114 Register character) { | |
3115 // hash = seed + character + ((seed + character) << 10); | |
3116 __ LoadRoot(hash, Heap::kHashSeedRootIndex); | |
3117 // Untag smi seed and add the character. | |
3118 __ SmiUntag(hash); | |
3119 __ addu(hash, hash, character); | |
3120 __ sll(at, hash, 10); | |
3121 __ addu(hash, hash, at); | |
3122 // hash ^= hash >> 6; | |
3123 __ srl(at, hash, 6); | |
3124 __ xor_(hash, hash, at); | |
3125 } | |
3126 | |
3127 | |
3128 void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm, | |
3129 Register hash, | |
3130 Register character) { | |
3131 // hash += character; | |
3132 __ addu(hash, hash, character); | |
3133 // hash += hash << 10; | |
3134 __ sll(at, hash, 10); | |
3135 __ addu(hash, hash, at); | |
3136 // hash ^= hash >> 6; | |
3137 __ srl(at, hash, 6); | |
3138 __ xor_(hash, hash, at); | |
3139 } | |
3140 | |
3141 | |
3142 void StringHelper::GenerateHashGetHash(MacroAssembler* masm, | |
3143 Register hash) { | |
3144 // hash += hash << 3; | |
3145 __ sll(at, hash, 3); | |
3146 __ addu(hash, hash, at); | |
3147 // hash ^= hash >> 11; | |
3148 __ srl(at, hash, 11); | |
3149 __ xor_(hash, hash, at); | |
3150 // hash += hash << 15; | |
3151 __ sll(at, hash, 15); | |
3152 __ addu(hash, hash, at); | |
3153 | |
3154 __ li(at, Operand(String::kHashBitMask)); | |
3155 __ and_(hash, hash, at); | |
3156 | |
3157 // if (hash == 0) hash = 27; | |
3158 __ ori(at, zero_reg, StringHasher::kZeroHash); | |
3159 __ Movz(hash, at, hash); | |
3160 } | |
3161 | |
3162 | |
3163 void SubStringStub::Generate(MacroAssembler* masm) { | 3112 void SubStringStub::Generate(MacroAssembler* masm) { |
3164 Label runtime; | 3113 Label runtime; |
3165 // Stack frame on entry. | 3114 // Stack frame on entry. |
3166 // ra: return address | 3115 // ra: return address |
3167 // sp[0]: to | 3116 // sp[0]: to |
3168 // sp[4]: from | 3117 // sp[4]: from |
3169 // sp[8]: string | 3118 // sp[8]: string |
3170 | 3119 |
3171 // This stub is called from the native-call %_SubString(...), so | 3120 // This stub is called from the native-call %_SubString(...), so |
3172 // nothing can be assumed about the arguments. It is tested that: | 3121 // nothing can be assumed about the arguments. It is tested that: |
(...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4975 MemOperand(fp, 6 * kPointerSize), | 4924 MemOperand(fp, 6 * kPointerSize), |
4976 NULL); | 4925 NULL); |
4977 } | 4926 } |
4978 | 4927 |
4979 | 4928 |
4980 #undef __ | 4929 #undef __ |
4981 | 4930 |
4982 } } // namespace v8::internal | 4931 } } // namespace v8::internal |
4983 | 4932 |
4984 #endif // V8_TARGET_ARCH_MIPS64 | 4933 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |