| 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 6015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6026 if (!result.is(eax)) { | 6026 if (!result.is(eax)) { |
| 6027 __ mov(eax, result); | 6027 __ mov(eax, result); |
| 6028 } | 6028 } |
| 6029 } | 6029 } |
| 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 = character + (character << 10); | 6036 // hash = (seed + character) + ((seed + character) << 10); |
| 6037 __ mov(hash, character); | 6037 if (Serializer::enabled()) { |
| 6038 __ shl(hash, 10); | 6038 ExternalReference roots_array_start = |
| 6039 __ add(hash, character); | 6039 ExternalReference::roots_array_start(masm->isolate()); |
| 6040 __ mov(scratch, Immediate(Heap::kStringHashSeedRootIndex)); |
| 6041 __ mov(scratch, Operand::StaticArray(scratch, |
| 6042 times_pointer_size, |
| 6043 roots_array_start)); |
| 6044 __ add(scratch, character); |
| 6045 __ mov(hash, scratch); |
| 6046 __ shl(scratch, 10); |
| 6047 __ add(hash, scratch); |
| 6048 } else { |
| 6049 int32_t seed = masm->isolate()->heap()->StringHashSeed(); |
| 6050 __ lea(scratch, Operand(character, seed)); |
| 6051 __ shl(scratch, 10); |
| 6052 __ lea(hash, Operand(scratch, character, times_1, seed)); |
| 6053 } |
| 6040 // hash ^= hash >> 6; | 6054 // hash ^= hash >> 6; |
| 6041 __ mov(scratch, hash); | 6055 __ mov(scratch, hash); |
| 6042 __ shr(scratch, 6); | 6056 __ shr(scratch, 6); |
| 6043 __ xor_(hash, scratch); | 6057 __ xor_(hash, scratch); |
| 6044 } | 6058 } |
| 6045 | 6059 |
| 6046 | 6060 |
| 6047 void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm, | 6061 void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm, |
| 6048 Register hash, | 6062 Register hash, |
| 6049 Register character, | 6063 Register character, |
| (...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7332 false); | 7346 false); |
| 7333 __ pop(edx); | 7347 __ pop(edx); |
| 7334 __ ret(0); | 7348 __ ret(0); |
| 7335 } | 7349 } |
| 7336 | 7350 |
| 7337 #undef __ | 7351 #undef __ |
| 7338 | 7352 |
| 7339 } } // namespace v8::internal | 7353 } } // namespace v8::internal |
| 7340 | 7354 |
| 7341 #endif // V8_TARGET_ARCH_IA32 | 7355 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |