Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Unified Diff: src/heap/heap-inl.h

Issue 1535723002: [heap] Use HashMap as scratchpad backing store (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Revive the founder counter on the AllocationSite Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/mark-compact.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)));
}
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/mark-compact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698