Commit 6c22ae69 authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

Stub cache: use more bits of map address for hashing.

This should recover the regression from constant field tracking
in Speedometer/angular.

Bug: chromium:930680
Change-Id: I9ccbcbdaf11556596ed5df5c08829b7ae329cab7
Reviewed-on: https://chromium-review.googlesource.com/c/1480383Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59775}
parent 6f763280
......@@ -2234,7 +2234,10 @@ Node* AccessorAssembler::StubCachePrimaryOffset(Node* name, Node* map) {
// Using only the low bits in 64-bit mode is unlikely to increase the
// 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 = TruncateIntPtrToInt32(BitcastTaggedToWord(map));
Node* map_word = BitcastTaggedToWord(map);
Node* map32 = TruncateIntPtrToInt32(UncheckedCast<IntPtrT>(
WordXor(map_word, WordShr(map_word, StubCache::kMapKeyShift))));
// Base the offset on a simple combination of name and map.
Node* hash = Int32Add(hash_field, map32);
uint32_t mask = (StubCache::kPrimaryTableSize - 1)
......
......@@ -36,7 +36,8 @@ int StubCache::PrimaryOffset(Name name, Map map) {
// Using only the low bits in 64-bit mode is unlikely to increase the
// risk of collision even if the heap is spread over an area larger than
// 4Gb (and not at all if it isn't).
uint32_t map_low32bits = static_cast<uint32_t>(map.ptr());
uint32_t map_low32bits =
static_cast<uint32_t>(map.ptr() ^ (map.ptr() >> kMapKeyShift));
// Base the offset on a simple combination of name and map.
uint32_t key = map_low32bits + field;
return key & ((kPrimaryTableSize - 1) << kCacheIndexShift);
......
......@@ -89,6 +89,10 @@ class StubCache {
static const int kSecondaryTableBits = 9;
static const int kSecondaryTableSize = (1 << kSecondaryTableBits);
// We compute the hash code for a map as follows:
// <code> = <address> ^ (<address> >> kMapKeyShift)
static const int kMapKeyShift = kPrimaryTableBits + kCacheIndexShift;
// Some magic number used in the secondary hash computation.
static const int kSecondaryMagic = 0xb16ca6e5;
......
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