| Index: src/heap/heap-inl.h
|
| diff --git a/src/heap/heap-inl.h b/src/heap/heap-inl.h
|
| index a94843a0be2a0fad2436ca21f55853ffb71805d2..a723b3bdae783ea2785fb05a80b7ad2d180652af 100644
|
| --- a/src/heap/heap-inl.h
|
| +++ b/src/heap/heap-inl.h
|
| @@ -507,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)));
|
| }
|
|
|
|
|
|
|