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

Side by Side Diff: src/arm/code-stubs-arm.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, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/flag-definitions.h » ('j') | src/flag-definitions.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5712 matching lines...) Expand 10 before | Expand all | Expand 10 after
5723 Register result = candidate; 5723 Register result = candidate;
5724 __ bind(&found_in_symbol_table); 5724 __ bind(&found_in_symbol_table);
5725 __ Move(r0, result); 5725 __ Move(r0, result);
5726 } 5726 }
5727 5727
5728 5728
5729 void StringHelper::GenerateHashInit(MacroAssembler* masm, 5729 void StringHelper::GenerateHashInit(MacroAssembler* masm,
5730 Register hash, 5730 Register hash,
5731 Register character) { 5731 Register character) {
5732 // hash = character + (character << 10); 5732 // hash = character + (character << 10);
5733 __ add(hash, character, Operand(character, LSL, 10)); 5733 __ LoadRoot(hash, Heap::kStringHashSeedRootIndex);
5734 // Untag smi seed and add the character.
5735 __ add(hash, character, Operand(hash, LSR, kSmiTagSize));
5736 // hash += hash << 10;
5737 __ add(hash, hash, Operand(hash, LSL, 10));
5734 // hash ^= hash >> 6; 5738 // hash ^= hash >> 6;
5735 __ eor(hash, hash, Operand(hash, LSR, 6)); 5739 __ eor(hash, hash, Operand(hash, LSR, 6));
5736 } 5740 }
5737 5741
5738 5742
5739 void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm, 5743 void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm,
5740 Register hash, 5744 Register hash,
5741 Register character) { 5745 Register character) {
5742 // hash += character; 5746 // hash += character;
5743 __ add(hash, hash, Operand(character)); 5747 __ add(hash, hash, Operand(character));
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after
7310 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r10, 7314 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r10,
7311 &slow_elements); 7315 &slow_elements);
7312 __ Ret(); 7316 __ Ret();
7313 } 7317 }
7314 7318
7315 #undef __ 7319 #undef __
7316 7320
7317 } } // namespace v8::internal 7321 } } // namespace v8::internal
7318 7322
7319 #endif // V8_TARGET_ARCH_ARM 7323 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/flag-definitions.h » ('j') | src/flag-definitions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698