Reviewers: Dean McNamee,

Message:
Quick review.

Description:
X64: Changed hash computations to only use lower 32 bits of pointers.

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

Affected files:
   M src/stub-cache.h


Index: src/stub-cache.h
diff --git a/src/stub-cache.h b/src/stub-cache.h
index  
824f4ff17b923ba8747aeac3297faa279592ff1a..92100ba59875da81610fdac0d2cc28ab0005bb18
  
100644
--- a/src/stub-cache.h
+++ b/src/stub-cache.h
@@ -203,14 +203,18 @@ class StubCache : public AllStatic {
      // Compute the hash of the name (use entire length field).
      ASSERT(name->HasHashCode());
      uint32_t field = name->length_field();
+    uint32_t map_lowbits =
+        static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map));
      // Base the offset on a simple combination of name, flags, and map.
-    uint32_t key = (reinterpret_cast<uint32_t>(map) + field) ^ flags;
+    uint32_t key = (map_lowbits + field) ^ flags;
      return key & ((kPrimaryTableSize - 1) << kHeapObjectTagSize);
    }

    static int SecondaryOffset(String* name, Code::Flags flags, int seed) {
      // Use the seed from the primary cache in the secondary cache.
-    uint32_t key = seed - reinterpret_cast<uint32_t>(name) + flags;
+    uint32_t string_lowbits =
+        static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name));
+    uint32_t key = seed - string_lowbits + flags;
      return key & ((kSecondaryTableSize - 1) << kHeapObjectTagSize);
    }




--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to