Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Unified Diff: src/mips/code-stubs-mips.cc

Issue 9086006: Randomize the seed used for string hashing. This helps guard against (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/mips/code-stubs-mips.cc
===================================================================
--- src/mips/code-stubs-mips.cc (revision 10328)
+++ src/mips/code-stubs-mips.cc (working copy)
@@ -5924,11 +5924,15 @@
void StringHelper::GenerateHashInit(MacroAssembler* masm,
- Register hash,
- Register character) {
+ Register hash,
+ Register character) {
// hash = character + (character << 10);
Vyacheslav Egorov (Chromium) 2012/01/04 14:30:57 comment is outdated
Erik Corry 2012/01/04 15:48:59 Done.
- __ sll(hash, character, 10);
+ __ LoadRoot(hash, Heap::kStringHashSeedRootIndex);
+ // Untag smi seed and add the character.
+ __ SmiUntag(hash);
__ addu(hash, hash, character);
+ __ sll(at, hash, 10);
+ __ addu(hash, hash, at);
// hash ^= hash >> 6;
__ srl(at, hash, 6);
__ xor_(hash, hash, at);
@@ -5936,8 +5940,8 @@
void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm,
- Register hash,
- Register character) {
+ Register hash,
+ Register character) {
// hash += character;
__ addu(hash, hash, character);
// hash += hash << 10;

Powered by Google App Engine
This is Rietveld 408576698