Reviewers: Kasper Lund,

Description:
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.


Please review this at http://codereview.chromium.org/149753

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     src/objects.cc


Index: src/objects.cc
===================================================================
--- src/objects.cc      (revision 2487)
+++ src/objects.cc      (working copy)
@@ -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
-~----------~----~----~----~------~----~------~--~---

Reply via email to