Commit d64ea283 authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[ic] Remove pointless xor from primary StubCache hash computation

This xor can never change the number of collisions, so it should be safe to remove.

Bug: 
Change-Id: I253c0ece422f66e7cba15b13c041cfb6c8361674
Reviewed-on: https://chromium-review.googlesource.com/809113Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49985}
parent 5d824c79
......@@ -2076,9 +2076,8 @@ Node* AccessorAssembler::StubCachePrimaryOffset(Node* name, Node* map) {
// risk of collision even if the heap is spread over an area larger than
// 4Gb (and not at all if it isn't).
Node* map32 = TruncateWordToWord32(BitcastTaggedToWord(map));
Node* hash = Int32Add(hash_field, map32);
// Base the offset on a simple combination of name and map.
hash = Word32Xor(hash, Int32Constant(StubCache::kPrimaryMagic));
Node* hash = Int32Add(hash_field, map32);
uint32_t mask = (StubCache::kPrimaryTableSize - 1)
<< StubCache::kCacheIndexShift;
return ChangeUint32ToWord(Word32And(hash, Int32Constant(mask)));
......
......@@ -39,7 +39,7 @@ int StubCache::PrimaryOffset(Name* name, Map* map) {
uint32_t map_low32bits =
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map));
// Base the offset on a simple combination of name and map.
uint32_t key = (map_low32bits + field) ^ kPrimaryMagic;
uint32_t key = map_low32bits + field;
return key & ((kPrimaryTableSize - 1) << kCacheIndexShift);
}
......
......@@ -84,8 +84,7 @@ class StubCache {
static const int kSecondaryTableBits = 9;
static const int kSecondaryTableSize = (1 << kSecondaryTableBits);
// Some magic number used in primary and secondary hash computations.
static const int kPrimaryMagic = 0x3d532433;
// Some magic number used in the secondary hash computation.
static const int kSecondaryMagic = 0xb16ca6e5;
static int PrimaryOffsetForTesting(Name* name, Map* map) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment