diff options
Diffstat (limited to 'deps/v8/src/heap/heap-inl.h')
-rw-r--r-- | deps/v8/src/heap/heap-inl.h | 55 |
1 files changed, 37 insertions, 18 deletions
diff --git a/deps/v8/src/heap/heap-inl.h b/deps/v8/src/heap/heap-inl.h index c6185c6e30..a723b3bdae 100644 --- a/deps/v8/src/heap/heap-inl.h +++ b/deps/v8/src/heap/heap-inl.h @@ -257,20 +257,21 @@ void Heap::OnAllocationEvent(HeapObject* object, int size_in_bytes) { profiler->AllocationEvent(object->address(), size_in_bytes); } - ++allocations_count_; - if (FLAG_verify_predictable) { + ++allocations_count_; + // Advance synthetic time by making a time request. + MonotonicallyIncreasingTimeInMs(); + UpdateAllocationsHash(object); UpdateAllocationsHash(size_in_bytes); - if ((FLAG_dump_allocations_digest_at_alloc > 0) && - (--dump_allocations_hash_countdown_ == 0)) { - dump_allocations_hash_countdown_ = FLAG_dump_allocations_digest_at_alloc; + if (allocations_count_ % FLAG_dump_allocations_digest_at_alloc == 0) { PrintAlloctionsHash(); } } if (FLAG_trace_allocation_stack_interval > 0) { + if (!FLAG_verify_predictable) ++allocations_count_; if (allocations_count_ % FLAG_trace_allocation_stack_interval == 0) { isolate()->PrintStack(stdout, Isolate::kPrintStackConcise); } @@ -292,14 +293,14 @@ void Heap::OnMoveEvent(HeapObject* target, HeapObject* source, if (FLAG_verify_predictable) { ++allocations_count_; + // Advance synthetic time by making a time request. + MonotonicallyIncreasingTimeInMs(); UpdateAllocationsHash(source); UpdateAllocationsHash(target); UpdateAllocationsHash(size_in_bytes); - if ((FLAG_dump_allocations_digest_at_alloc > 0) && - (--dump_allocations_hash_countdown_ == 0)) { - dump_allocations_hash_countdown_ = FLAG_dump_allocations_digest_at_alloc; + if (allocations_count_ % FLAG_dump_allocations_digest_at_alloc == 0) { PrintAlloctionsHash(); } } @@ -506,21 +507,39 @@ AllocationMemento* Heap::FindAllocationMemento(HeapObject* object) { } -void Heap::UpdateAllocationSiteFeedback(HeapObject* object, - ScratchpadSlotMode mode) { - Heap* heap = object->GetHeap(); - DCHECK(heap->InFromSpace(object)); - +void Heap::UpdateAllocationSite(HeapObject* object, + HashMap* pretenuring_feedback) { + DCHECK(InFromSpace(object)); if (!FLAG_allocation_site_pretenuring || !AllocationSite::CanTrack(object->map()->instance_type())) return; + AllocationMemento* memento = FindAllocationMemento(object); + if (memento == nullptr) return; + + AllocationSite* key = memento->GetAllocationSite(); + DCHECK(!key->IsZombie()); + + if (pretenuring_feedback == global_pretenuring_feedback_) { + // For inserting in the global pretenuring storage we need to first + // increment the memento found count on the allocation site. + if (key->IncrementMementoFoundCount()) { + global_pretenuring_feedback_->LookupOrInsert( + key, static_cast<uint32_t>(bit_cast<uintptr_t>(key))); + } + } else { + // Any other pretenuring storage than the global one is used as a cache, + // where the count is later on merge in the allocation site. + HashMap::Entry* e = pretenuring_feedback->LookupOrInsert( + key, static_cast<uint32_t>(bit_cast<uintptr_t>(key))); + DCHECK(e != nullptr); + (*bit_cast<intptr_t*>(&e->value))++; + } +} - AllocationMemento* memento = heap->FindAllocationMemento(object); - if (memento == NULL) return; - if (memento->GetAllocationSite()->IncrementMementoFoundCount()) { - heap->AddAllocationSiteToScratchpad(memento->GetAllocationSite(), mode); - } +void Heap::RemoveAllocationSitePretenuringFeedback(AllocationSite* site) { + global_pretenuring_feedback_->Remove( + site, static_cast<uint32_t>(bit_cast<uintptr_t>(site))); } |