| 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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
| 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 3058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3069 __ Addu(src, src, Operand(1)); | 3069 __ Addu(src, src, Operand(1)); |
| 3070 __ sb(scratch, MemOperand(dest)); | 3070 __ sb(scratch, MemOperand(dest)); |
| 3071 __ Addu(dest, dest, Operand(1)); | 3071 __ Addu(dest, dest, Operand(1)); |
| 3072 __ bind(&loop_entry); | 3072 __ bind(&loop_entry); |
| 3073 __ Branch(&loop, lt, dest, Operand(limit)); | 3073 __ Branch(&loop, lt, dest, Operand(limit)); |
| 3074 | 3074 |
| 3075 __ bind(&done); | 3075 __ bind(&done); |
| 3076 } | 3076 } |
| 3077 | 3077 |
| 3078 | 3078 |
| 3079 void StringHelper::GenerateHashInit(MacroAssembler* masm, | |
| 3080 Register hash, | |
| 3081 Register character) { | |
| 3082 // hash = seed + character + ((seed + character) << 10); | |
| 3083 __ LoadRoot(hash, Heap::kHashSeedRootIndex); | |
| 3084 // Untag smi seed and add the character. | |
| 3085 __ SmiUntag(hash); | |
| 3086 __ addu(hash, hash, character); | |
| 3087 __ sll(at, hash, 10); | |
| 3088 __ addu(hash, hash, at); | |
| 3089 // hash ^= hash >> 6; | |
| 3090 __ srl(at, hash, 6); | |
| 3091 __ xor_(hash, hash, at); | |
| 3092 } | |
| 3093 | |
| 3094 | |
| 3095 void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm, | |
| 3096 Register hash, | |
| 3097 Register character) { | |
| 3098 // hash += character; | |
| 3099 __ addu(hash, hash, character); | |
| 3100 // hash += hash << 10; | |
| 3101 __ sll(at, hash, 10); | |
| 3102 __ addu(hash, hash, at); | |
| 3103 // hash ^= hash >> 6; | |
| 3104 __ srl(at, hash, 6); | |
| 3105 __ xor_(hash, hash, at); | |
| 3106 } | |
| 3107 | |
| 3108 | |
| 3109 void StringHelper::GenerateHashGetHash(MacroAssembler* masm, | |
| 3110 Register hash) { | |
| 3111 // hash += hash << 3; | |
| 3112 __ sll(at, hash, 3); | |
| 3113 __ addu(hash, hash, at); | |
| 3114 // hash ^= hash >> 11; | |
| 3115 __ srl(at, hash, 11); | |
| 3116 __ xor_(hash, hash, at); | |
| 3117 // hash += hash << 15; | |
| 3118 __ sll(at, hash, 15); | |
| 3119 __ addu(hash, hash, at); | |
| 3120 | |
| 3121 __ li(at, Operand(String::kHashBitMask)); | |
| 3122 __ and_(hash, hash, at); | |
| 3123 | |
| 3124 // if (hash == 0) hash = 27; | |
| 3125 __ ori(at, zero_reg, StringHasher::kZeroHash); | |
| 3126 __ Movz(hash, at, hash); | |
| 3127 } | |
| 3128 | |
| 3129 | |
| 3130 void SubStringStub::Generate(MacroAssembler* masm) { | 3079 void SubStringStub::Generate(MacroAssembler* masm) { |
| 3131 Label runtime; | 3080 Label runtime; |
| 3132 // Stack frame on entry. | 3081 // Stack frame on entry. |
| 3133 // ra: return address | 3082 // ra: return address |
| 3134 // sp[0]: to | 3083 // sp[0]: to |
| 3135 // sp[4]: from | 3084 // sp[4]: from |
| 3136 // sp[8]: string | 3085 // sp[8]: string |
| 3137 | 3086 |
| 3138 // This stub is called from the native-call %_SubString(...), so | 3087 // This stub is called from the native-call %_SubString(...), so |
| 3139 // nothing can be assumed about the arguments. It is tested that: | 3088 // nothing can be assumed about the arguments. It is tested that: |
| (...skipping 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4938 MemOperand(fp, 6 * kPointerSize), | 4887 MemOperand(fp, 6 * kPointerSize), |
| 4939 NULL); | 4888 NULL); |
| 4940 } | 4889 } |
| 4941 | 4890 |
| 4942 | 4891 |
| 4943 #undef __ | 4892 #undef __ |
| 4944 | 4893 |
| 4945 } } // namespace v8::internal | 4894 } } // namespace v8::internal |
| 4946 | 4895 |
| 4947 #endif // V8_TARGET_ARCH_MIPS | 4896 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |