Index: src/utils.h |
=================================================================== |
--- src/utils.h (revision 10379) |
+++ src/utils.h (working copy) |
@@ -237,10 +237,13 @@ |
// ---------------------------------------------------------------------------- |
// Hash function. |
+static const uint32_t kZeroHashSeed = 0; |
+ |
// Thomas Wang, Integer Hash Functions. |
// http://www.concentric.net/~Ttwang/tech/inthash.htm |
-static inline uint32_t ComputeIntegerHash(uint32_t key) { |
+static inline uint32_t ComputeIntegerHash(uint32_t key, uint32_t seed) { |
uint32_t hash = key; |
+ hash = hash ^ seed; |
hash = ~hash + (hash << 15); // hash = (hash << 15) - hash - 1; |
hash = hash ^ (hash >> 12); |
hash = hash + (hash << 2); |
@@ -253,7 +256,8 @@ |
static inline uint32_t ComputePointerHash(void* ptr) { |
return ComputeIntegerHash( |
- static_cast<uint32_t>(reinterpret_cast<intptr_t>(ptr))); |
+ static_cast<uint32_t>(reinterpret_cast<intptr_t>(ptr)), |
+ v8::internal::kZeroHashSeed); |
} |