OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 __ Mov(x10, Operand(string.at(0))); | 107 __ Mov(x10, Operand(string.at(0))); |
108 StringHelper::GenerateHashInit(masm, x0, x10); | 108 StringHelper::GenerateHashInit(masm, x0, x10); |
109 for (int i = 1; i < string.length(); i++) { | 109 for (int i = 1; i < string.length(); i++) { |
110 __ Mov(x10, Operand(string.at(i))); | 110 __ Mov(x10, Operand(string.at(i))); |
111 StringHelper::GenerateHashAddCharacter(masm, x0, x10); | 111 StringHelper::GenerateHashAddCharacter(masm, x0, x10); |
112 } | 112 } |
113 StringHelper::GenerateHashGetHash(masm, x0, x10); | 113 StringHelper::GenerateHashGetHash(masm, x0, x10); |
114 __ Pop(xzr, root); | 114 __ Pop(xzr, root); |
115 __ Ret(); | 115 __ Ret(); |
116 __ SetStackPointer(old_stack_pointer); | 116 __ SetStackPointer(old_stack_pointer); |
117 #elif V8_TARGET_ARCH_MIPS | 117 #elif V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
118 __ push(kRootRegister); | 118 __ push(kRootRegister); |
119 __ InitializeRootRegister(); | 119 __ InitializeRootRegister(); |
120 | 120 |
121 __ li(v0, Operand(0)); | 121 __ mov(v0, zero_reg); |
122 __ li(t1, Operand(string.at(0))); | 122 __ li(t1, Operand(string.at(0))); |
123 StringHelper::GenerateHashInit(masm, v0, t1); | 123 StringHelper::GenerateHashInit(masm, v0, t1); |
124 for (int i = 1; i < string.length(); i++) { | 124 for (int i = 1; i < string.length(); i++) { |
125 __ li(t1, Operand(string.at(i))); | 125 __ li(t1, Operand(string.at(i))); |
126 StringHelper::GenerateHashAddCharacter(masm, v0, t1); | 126 StringHelper::GenerateHashAddCharacter(masm, v0, t1); |
127 } | 127 } |
128 StringHelper::GenerateHashGetHash(masm, v0); | 128 StringHelper::GenerateHashGetHash(masm, v0); |
129 __ pop(kRootRegister); | 129 __ pop(kRootRegister); |
130 __ jr(ra); | 130 __ jr(ra); |
131 __ nop(); | 131 __ nop(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // csp is initialized by the calling (C++) code. | 163 // csp is initialized by the calling (C++) code. |
164 Register old_stack_pointer = __ StackPointer(); | 164 Register old_stack_pointer = __ StackPointer(); |
165 __ SetStackPointer(csp); | 165 __ SetStackPointer(csp); |
166 __ Push(root, xzr); | 166 __ Push(root, xzr); |
167 __ InitializeRootRegister(); | 167 __ InitializeRootRegister(); |
168 __ Mov(x0, key); | 168 __ Mov(x0, key); |
169 __ GetNumberHash(x0, x10); | 169 __ GetNumberHash(x0, x10); |
170 __ Pop(xzr, root); | 170 __ Pop(xzr, root); |
171 __ Ret(); | 171 __ Ret(); |
172 __ SetStackPointer(old_stack_pointer); | 172 __ SetStackPointer(old_stack_pointer); |
173 #elif V8_TARGET_ARCH_MIPS | 173 #elif V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
174 __ push(kRootRegister); | 174 __ push(kRootRegister); |
175 __ InitializeRootRegister(); | 175 __ InitializeRootRegister(); |
176 __ li(v0, Operand(key)); | 176 __ li(v0, Operand(key)); |
177 __ GetNumberHash(v0, t1); | 177 __ GetNumberHash(v0, t1); |
178 __ pop(kRootRegister); | 178 __ pop(kRootRegister); |
179 __ jr(ra); | 179 __ jr(ra); |
180 __ nop(); | 180 __ nop(); |
181 #else | 181 #else |
182 #error Unsupported architecture. | 182 #error Unsupported architecture. |
183 #endif | 183 #endif |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 // Some pseudo-random numbers | 298 // Some pseudo-random numbers |
299 static const uint32_t kLimit = 1000; | 299 static const uint32_t kLimit = 1000; |
300 for (uint32_t i = 0; i < 5; i++) { | 300 for (uint32_t i = 0; i < 5; i++) { |
301 for (uint32_t j = 0; j < 5; j++) { | 301 for (uint32_t j = 0; j < 5; j++) { |
302 check(PseudoRandom(i, j) % kLimit); | 302 check(PseudoRandom(i, j) % kLimit); |
303 } | 303 } |
304 } | 304 } |
305 } | 305 } |
306 | 306 |
307 #undef __ | 307 #undef __ |
OLD | NEW |