Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index cd269cb6f3e0395c04832e73fe93c837d4707e82..2001b80d82e47397f98744675ea0b86ad53bffbf 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -4705,6 +4705,7 @@ void StringHelper::GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm, |
static const int kProbes = 4; |
Label found_in_symbol_table; |
Label next_probe[kProbes]; |
+ Register candidate = scratch; // Scratch register contains candidate. |
for (int i = 0; i < kProbes; i++) { |
// Calculate entry in symbol table. |
__ movl(scratch, hash); |
@@ -4714,7 +4715,6 @@ void StringHelper::GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm, |
__ andl(scratch, mask); |
// Load the entry from the symbol table. |
- Register candidate = scratch; // Scratch register contains candidate. |
STATIC_ASSERT(SymbolTable::kEntrySize == 1); |
__ movq(candidate, |
FieldOperand(symbol_table, |
@@ -4729,7 +4729,12 @@ void StringHelper::GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm, |
__ CompareRoot(candidate, Heap::kUndefinedValueRootIndex); |
__ j(equal, not_found); |
- // Must be null (deleted entry). |
+ // Must be the hole (deleted entry). |
+ if (FLAG_debug_code) { |
+ __ LoadRoot(kScratchRegister, Heap::kTheHoleValueRootIndex); |
+ __ cmpq(kScratchRegister, candidate); |
+ __ Assert(equal, "oddball in symbol table is not undefined or the hole"); |
+ } |
__ jmp(&next_probe[i]); |
__ bind(&is_string); |
@@ -4760,7 +4765,7 @@ void StringHelper::GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm, |
__ jmp(not_found); |
// Scratch register contains result when we fall through to here. |
- Register result = scratch; |
+ Register result = candidate; |
__ bind(&found_in_symbol_table); |
if (!result.is(rax)) { |
__ movq(rax, result); |
@@ -4778,7 +4783,7 @@ void StringHelper::GenerateHashInit(MacroAssembler* masm, |
__ addl(hash, character); |
// hash ^= hash >> 6; |
__ movl(scratch, hash); |
- __ sarl(scratch, Immediate(6)); |
+ __ shrl(scratch, Immediate(6)); |
__ xorl(hash, scratch); |
} |
@@ -4795,7 +4800,7 @@ void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm, |
__ addl(hash, scratch); |
// hash ^= hash >> 6; |
__ movl(scratch, hash); |
- __ sarl(scratch, Immediate(6)); |
+ __ shrl(scratch, Immediate(6)); |
__ xorl(hash, scratch); |
} |
@@ -4807,13 +4812,16 @@ void StringHelper::GenerateHashGetHash(MacroAssembler* masm, |
__ leal(hash, Operand(hash, hash, times_8, 0)); |
// hash ^= hash >> 11; |
__ movl(scratch, hash); |
- __ sarl(scratch, Immediate(11)); |
+ __ shrl(scratch, Immediate(11)); |
__ xorl(hash, scratch); |
// hash += hash << 15; |
__ movl(scratch, hash); |
__ shll(scratch, Immediate(15)); |
__ addl(hash, scratch); |
+ uint32_t kHashShiftCutOffMask = (1 << (32 - String::kHashShift)) - 1; |
+ __ andl(hash, Immediate(kHashShiftCutOffMask)); |
+ |
// if (hash == 0) hash = 27; |
Label hash_not_zero; |
__ j(not_zero, &hash_not_zero); |