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

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

Issue 1659823002: [heap] Slightly optimize Heap::UpdateAllocationSite() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
Index: src/heap/heap-inl.h
diff --git a/src/heap/heap-inl.h b/src/heap/heap-inl.h
index 5c5a2bace672914e7b31c5ac7d07018d38539bdc..d54d644bdb4e542069b8693dddcceb1882961c1b 100644
--- a/src/heap/heap-inl.h
+++ b/src/heap/heap-inl.h
@@ -515,7 +515,7 @@ AllocationMemento* Heap::FindAllocationMemento(HeapObject* object) {
return nullptr;
}
-
+template <Heap::UpdateAllocationSiteMode mode>
void Heap::UpdateAllocationSite(HeapObject* object,
HashMap* pretenuring_feedback) {
DCHECK(InFromSpace(object));
@@ -525,7 +525,8 @@ void Heap::UpdateAllocationSite(HeapObject* object,
AllocationMemento* memento_candidate = FindAllocationMemento<kForGC>(object);
if (memento_candidate == nullptr) return;
- if (pretenuring_feedback == global_pretenuring_feedback_) {
+ if (mode == kGlobal) {
+ DCHECK_EQ(pretenuring_feedback, global_pretenuring_feedback_);
// Entering global pretenuring feedback is only used in the scavenger, where
// we are allowed to actually touch the allocation site.
if (!memento_candidate->IsValid()) return;
@@ -538,6 +539,8 @@ void Heap::UpdateAllocationSite(HeapObject* object,
ObjectHash(site->address()));
}
} else {
+ DCHECK_EQ(mode, kCached);
+ DCHECK_NE(pretenuring_feedback, global_pretenuring_feedback_);
// Entering cached feedback is used in the parallel case. We are not allowed
// to dereference the allocation site and rather have to postpone all checks
// till actually merging the data.
« src/heap/heap.h ('K') | « src/heap/heap.h ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698