Index: src/utils.h |
diff --git a/src/utils.h b/src/utils.h |
index 68b1517de4b822399d8d34c003084d1482f091eb..17bf06ffa3cb5677b81c37640738b4e7517cf1d8 100644 |
--- a/src/utils.h |
+++ b/src/utils.h |
@@ -252,10 +252,13 @@ class BitField { |
// ---------------------------------------------------------------------------- |
// Hash function. |
+static const uint32_t kZeroHashSeed = 0; |
+ |
// Thomas Wang, Integer Hash Functions. |
// http://www.concentric.net/~Ttwang/tech/inthash.htm |
-inline uint32_t ComputeIntegerHash(uint32_t key) { |
+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); |
@@ -280,7 +283,8 @@ inline uint32_t ComputeLongHash(uint64_t key) { |
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); |
} |