Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: src/identity-map.cc

Issue 1696363002: Use a better hash function in IdentityMap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/identity-map.h ('k') | test/unittests/interpreter/constant-array-builder-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/identity-map.cc
diff --git a/src/identity-map.cc b/src/identity-map.cc
index 2f5739dad99341031c4ade37182c82636dfe4c87..97b70ae2fd7a096bd55ce8943f9c71aeef23e624 100644
--- a/src/identity-map.cc
+++ b/src/identity-map.cc
@@ -4,7 +4,7 @@
#include "src/identity-map.h"
-#include "src/heap/heap.h"
+#include "src/base/functional.h"
#include "src/heap/heap-inl.h"
#include "src/zone-containers.h"
@@ -42,8 +42,7 @@ IdentityMapBase::RawEntry IdentityMapBase::Insert(Object* key) {
int IdentityMapBase::Hash(Object* address) {
CHECK_NE(address, heap_->not_mapped_symbol());
uintptr_t raw_address = reinterpret_cast<uintptr_t>(address);
- // Xor some of the upper bits, since the lower 2 or 3 are usually aligned.
titzer 2016/02/16 13:02:27 What about the original comment? Objects will typi
rmcilroy 2016/02/16 14:00:55 It uses 64-bit mix functions: https://gist.github.
- return static_cast<int>((raw_address >> 11) ^ raw_address);
+ return static_cast<int>(hasher_(raw_address));
}
« no previous file with comments | « src/identity-map.h ('k') | test/unittests/interpreter/constant-array-builder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698