| 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 6019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6030 | 6030 |
| 6031 | 6031 |
| 6032 void StringHelper::GenerateHashInit(MacroAssembler* masm, | 6032 void StringHelper::GenerateHashInit(MacroAssembler* masm, |
| 6033 Register hash, | 6033 Register hash, |
| 6034 Register character, | 6034 Register character, |
| 6035 Register scratch) { | 6035 Register scratch) { |
| 6036 // hash = (seed + character) + ((seed + character) << 10); | 6036 // hash = (seed + character) + ((seed + character) << 10); |
| 6037 if (Serializer::enabled()) { | 6037 if (Serializer::enabled()) { |
| 6038 ExternalReference roots_array_start = | 6038 ExternalReference roots_array_start = |
| 6039 ExternalReference::roots_array_start(masm->isolate()); | 6039 ExternalReference::roots_array_start(masm->isolate()); |
| 6040 __ mov(scratch, Immediate(Heap::kStringHashSeedRootIndex)); | 6040 __ mov(scratch, Immediate(Heap::kHashSeedRootIndex)); |
| 6041 __ mov(scratch, Operand::StaticArray(scratch, | 6041 __ mov(scratch, Operand::StaticArray(scratch, |
| 6042 times_pointer_size, | 6042 times_pointer_size, |
| 6043 roots_array_start)); | 6043 roots_array_start)); |
| 6044 __ add(scratch, character); | 6044 __ add(scratch, character); |
| 6045 __ mov(hash, scratch); | 6045 __ mov(hash, scratch); |
| 6046 __ shl(scratch, 10); | 6046 __ shl(scratch, 10); |
| 6047 __ add(hash, scratch); | 6047 __ add(hash, scratch); |
| 6048 } else { | 6048 } else { |
| 6049 int32_t seed = masm->isolate()->heap()->StringHashSeed(); | 6049 int32_t seed = masm->isolate()->heap()->HashSeed(); |
| 6050 __ lea(scratch, Operand(character, seed)); | 6050 __ lea(scratch, Operand(character, seed)); |
| 6051 __ shl(scratch, 10); | 6051 __ shl(scratch, 10); |
| 6052 __ lea(hash, Operand(scratch, character, times_1, seed)); | 6052 __ lea(hash, Operand(scratch, character, times_1, seed)); |
| 6053 } | 6053 } |
| 6054 // hash ^= hash >> 6; | 6054 // hash ^= hash >> 6; |
| 6055 __ mov(scratch, hash); | 6055 __ mov(scratch, hash); |
| 6056 __ shr(scratch, 6); | 6056 __ shr(scratch, 6); |
| 6057 __ xor_(hash, scratch); | 6057 __ xor_(hash, scratch); |
| 6058 } | 6058 } |
| 6059 | 6059 |
| (...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7344 false); | 7344 false); |
| 7345 __ pop(edx); | 7345 __ pop(edx); |
| 7346 __ ret(0); | 7346 __ ret(0); |
| 7347 } | 7347 } |
| 7348 | 7348 |
| 7349 #undef __ | 7349 #undef __ |
| 7350 | 7350 |
| 7351 } } // namespace v8::internal | 7351 } } // namespace v8::internal |
| 7352 | 7352 |
| 7353 #endif // V8_TARGET_ARCH_IA32 | 7353 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |