Author: [email protected]
Date: Thu Jul 16 07:59:28 2009
New Revision: 2488
Modified:
branches/bleeding_edge/src/objects.cc
Log:
Changed the dictionary code to use original hash value when starting linear
scan.
This is necessary for hash codes for string where the array index is
encoded.
Review URL: http://codereview.chromium.org/149753
Modified: branches/bleeding_edge/src/objects.cc
==============================================================================
--- branches/bleeding_edge/src/objects.cc (original)
+++ branches/bleeding_edge/src/objects.cc Thu Jul 16 07:59:28 2009
@@ -6521,15 +6521,15 @@
uint32_t hash = Shape::Hash(key);
// For the first probes rotate the hash to ensure a proper spread.
+ uint32_t h = hash;
for (uint32_t i = 0; i < kNofFastProbes; i++) {
- int entry = hash & mask;
+ int entry = h & mask;
Object* element = KeyAt(entry);
if (element->IsUndefined()) return kNotFound;
if (!element->IsNull() && Shape::IsMatch(key, element)) return entry;
- hash = RotateRight(hash, kHashRotateShift);
+ h = RotateRight(h, kHashRotateShift);
}
-
// In this unlikely event, do a linear scan.
for (uint32_t i = 1; i <= mask; i++) {
int entry = ++hash & mask;
@@ -6584,11 +6584,12 @@
Object* element;
// For the first probes rotate the hash to ensure a proper spread.
+ uint32_t h = hash;
for (uint32_t i = 0; i < kNofFastProbes; i++) {
- entry = hash & mask;
+ entry = h & mask;
element = KeyAt(entry);
if (element->IsUndefined() || element->IsNull()) return entry;
- hash = RotateRight(hash, kHashRotateShift);
+ h = RotateRight(h, kHashRotateShift);
}
do {
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---