Index: src/x64/code-stubs-x64.cc |
=================================================================== |
--- src/x64/code-stubs-x64.cc (revision 10321) |
+++ src/x64/code-stubs-x64.cc (working copy) |
@@ -4958,10 +4958,20 @@ |
Register hash, |
Register character, |
Register scratch) { |
- // hash = character + (character << 10); |
- __ movl(hash, character); |
- __ shll(hash, Immediate(10)); |
- __ addl(hash, character); |
+ int32_t seed = masm->isolate()->HasherSeed(); |
+ if (seed != 0) { |
+ ASSERT(FLAG_randomize_string_hashes); |
+ // hash = (seed + character) + ((seed + character) << 10); |
+ __ leal(scratch, Operand(character, seed)); |
+ __ shll(scratch, Immediate(10)); |
+ __ leal(hash, Operand(scratch, character, times_1, seed)); |
+ } else { |
+ ASSERT(!FLAG_randomize_string_hashes); |
+ // hash = character + (character << 10); |
+ __ movl(hash, character); |
+ __ shll(hash, Immediate(10)); |
+ __ addl(hash, character); |
+ } |
// hash ^= hash >> 6; |
__ movl(scratch, hash); |
__ shrl(scratch, Immediate(6)); |