InnerPointerToCodeCache::GetCacheEntry() made deterministic in predictable mode.
The hash calculation was dependent on upper part of |inner_pointer| and caused non-deterministic cache miss events which in turn caused non-deterministic progress of pages sweeping (see GcSafeFindCodeForInnerPointer()). Review URL: https://codereview.chromium.org/1582573002 Cr-Commit-Position: refs/heads/master@{#33246}
This commit is contained in:
parent
f5828cb4db
commit
07c52763bb
@ -1509,9 +1509,8 @@ InnerPointerToCodeCache::InnerPointerToCodeCacheEntry*
|
||||
InnerPointerToCodeCache::GetCacheEntry(Address inner_pointer) {
|
||||
isolate_->counters()->pc_to_code()->Increment();
|
||||
DCHECK(base::bits::IsPowerOfTwo32(kInnerPointerToCodeCacheSize));
|
||||
uint32_t hash = ComputeIntegerHash(
|
||||
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(inner_pointer)),
|
||||
v8::internal::kZeroHashSeed);
|
||||
uint32_t hash = ComputeIntegerHash(ObjectAddressForHashing(inner_pointer),
|
||||
v8::internal::kZeroHashSeed);
|
||||
uint32_t index = hash & (kInnerPointerToCodeCacheSize - 1);
|
||||
InnerPointerToCodeCacheEntry* entry = cache(index);
|
||||
if (entry->inner_pointer == inner_pointer) {
|
||||
|
@ -7753,6 +7753,14 @@ String::SubStringRange::iterator String::SubStringRange::end() {
|
||||
}
|
||||
|
||||
|
||||
// Predictably converts HeapObject* or Address to uint32 by calculating
|
||||
// offset of the address in respective MemoryChunk.
|
||||
static inline uint32_t ObjectAddressForHashing(void* object) {
|
||||
uint32_t value = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(object));
|
||||
return value & MemoryChunk::kAlignmentMask;
|
||||
}
|
||||
|
||||
|
||||
#undef TYPE_CHECKER
|
||||
#undef CAST_ACCESSOR
|
||||
#undef INT_ACCESSORS
|
||||
|
@ -12171,12 +12171,6 @@ void String::PrintOn(FILE* file) {
|
||||
}
|
||||
|
||||
|
||||
inline static uint32_t ObjectAddressForHashing(Object* object) {
|
||||
uint32_t value = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(object));
|
||||
return value & MemoryChunk::kAlignmentMask;
|
||||
}
|
||||
|
||||
|
||||
int Map::Hash() {
|
||||
// For performance reasons we only hash the 3 most variable fields of a map:
|
||||
// constructor, prototype and bit_field2. For predictability reasons we
|
||||
|
Loading…
Reference in New Issue
Block a user