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 5592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5603 | 5603 |
5604 | 5604 |
5605 void StringHelper::GenerateHashInit(MacroAssembler* masm, | 5605 void StringHelper::GenerateHashInit(MacroAssembler* masm, |
5606 Register hash, | 5606 Register hash, |
5607 Register character, | 5607 Register character, |
5608 Register scratch) { | 5608 Register scratch) { |
5609 // hash = (seed + character) + ((seed + character) << 10); | 5609 // hash = (seed + character) + ((seed + character) << 10); |
5610 if (Serializer::enabled()) { | 5610 if (Serializer::enabled()) { |
5611 ExternalReference roots_address = | 5611 ExternalReference roots_address = |
5612 ExternalReference::roots_address(masm->isolate()); | 5612 ExternalReference::roots_address(masm->isolate()); |
5613 __ mov(scratch, Immediate(Heap::kStringHashSeedRootIndex)); | 5613 __ mov(scratch, Immediate(Heap::kHashSeedRootIndex)); |
5614 __ mov(scratch, Operand::StaticArray(scratch, | 5614 __ mov(scratch, Operand::StaticArray(scratch, |
5615 times_pointer_size, | 5615 times_pointer_size, |
5616 roots_address)); | 5616 roots_address)); |
Erik Corry
2012/01/19 15:35:00
Oops, there's a missing SmiUntag here. I fixed it
| |
5617 __ add(scratch, Operand(character)); | 5617 __ add(scratch, Operand(character)); |
5618 __ mov(hash, scratch); | 5618 __ mov(hash, scratch); |
5619 __ shl(scratch, 10); | 5619 __ shl(scratch, 10); |
5620 __ add(hash, Operand(scratch)); | 5620 __ add(hash, Operand(scratch)); |
5621 } else { | 5621 } else { |
5622 int32_t seed = masm->isolate()->heap()->StringHashSeed(); | 5622 int32_t seed = masm->isolate()->heap()->HashSeed(); |
5623 __ lea(scratch, Operand(character, seed)); | 5623 __ lea(scratch, Operand(character, seed)); |
5624 __ shl(scratch, 10); | 5624 __ shl(scratch, 10); |
5625 __ lea(hash, Operand(scratch, character, times_1, seed)); | 5625 __ lea(hash, Operand(scratch, character, times_1, seed)); |
5626 } | 5626 } |
5627 // hash ^= hash >> 6; | 5627 // hash ^= hash >> 6; |
5628 __ mov(scratch, hash); | 5628 __ mov(scratch, hash); |
5629 __ shr(scratch, 6); | 5629 __ shr(scratch, 6); |
5630 __ xor_(hash, Operand(scratch)); | 5630 __ xor_(hash, Operand(scratch)); |
5631 } | 5631 } |
5632 | 5632 |
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6523 __ Drop(1); | 6523 __ Drop(1); |
6524 __ ret(2 * kPointerSize); | 6524 __ ret(2 * kPointerSize); |
6525 } | 6525 } |
6526 | 6526 |
6527 | 6527 |
6528 #undef __ | 6528 #undef __ |
6529 | 6529 |
6530 } } // namespace v8::internal | 6530 } } // namespace v8::internal |
6531 | 6531 |
6532 #endif // V8_TARGET_ARCH_IA32 | 6532 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |