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

Unified Diff: src/heap/mark-compact.cc

Issue 2494723002: [heap] Record pretenuring feedback for moved pages (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index 2eb9a1b79195f3c38e9b2c1df6f5daf84dac66f1..a60c892612276ec2657c4da7148ec796cc0d7d12 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -1837,8 +1837,15 @@ class MarkCompactCollector::EvacuateNewSpaceVisitor final
class MarkCompactCollector::EvacuateNewSpacePageVisitor final
: public MarkCompactCollector::HeapObjectVisitor {
public:
- explicit EvacuateNewSpacePageVisitor(Heap* heap)
- : heap_(heap), promoted_size_(0), semispace_copied_size_(0) {}
+ enum VisitationMode { kNewToOld, kNewToNew };
+
+ explicit EvacuateNewSpacePageVisitor(
+ Heap* heap, base::HashMap* local_pretenuring_feedback)
+ : heap_(heap),
+ promoted_size_(0),
+ semispace_copied_size_(0),
+ local_pretenuring_feedback_(local_pretenuring_feedback),
+ mode_(VisitationMode::kNewToNew) {}
static void MoveToOldSpace(Page* page, PagedSpace* owner) {
page->Unlink();
@@ -1852,23 +1859,32 @@ class MarkCompactCollector::EvacuateNewSpacePageVisitor final
}
inline bool Visit(HeapObject* object) {
- RecordMigratedSlotVisitor visitor(heap_->mark_compact_collector());
- object->IterateBodyFast(&visitor);
- promoted_size_ += object->Size();
+ heap_->UpdateAllocationSite<Heap::kCached>(object,
+ local_pretenuring_feedback_);
+ if (mode_ == kNewToOld) {
+ RecordMigratedSlotVisitor visitor(heap_->mark_compact_collector());
+ object->IterateBodyFast(&visitor);
+ }
return true;
}
intptr_t promoted_size() { return promoted_size_; }
intptr_t semispace_copied_size() { return semispace_copied_size_; }
- void account_semispace_copied(intptr_t copied) {
- semispace_copied_size_ += copied;
+ void account_semispace_copied(intptr_t bytes) {
+ semispace_copied_size_ += bytes;
}
+ void account_promoted(intptr_t bytes) { promoted_size_ += bytes; }
+
+ void set_mode(VisitationMode mode) { mode_ = mode; }
+
private:
Heap* heap_;
intptr_t promoted_size_;
intptr_t semispace_copied_size_;
+ base::HashMap* local_pretenuring_feedback_;
+ VisitationMode mode_;
};
class MarkCompactCollector::EvacuateOldSpaceVisitor final
@@ -2925,7 +2941,7 @@ class MarkCompactCollector::Evacuator : public Malloced {
local_pretenuring_feedback_(kInitialLocalPretenuringFeedbackCapacity),
new_space_visitor_(collector->heap(), &compaction_spaces_,
&local_pretenuring_feedback_),
- new_space_page_visitor(collector->heap()),
+ new_space_page_visitor(collector->heap(), &local_pretenuring_feedback_),
old_space_visitor_(collector->heap(), &compaction_spaces_),
duration_(0.0),
bytes_compacted_(0) {}
@@ -2982,15 +2998,19 @@ bool MarkCompactCollector::Evacuator::EvacuatePage(Page* page) {
DCHECK(success);
break;
case kPageNewToOld:
+ new_space_page_visitor.set_mode(EvacuateNewSpacePageVisitor::kNewToOld);
success = collector_->VisitLiveObjects(page, &new_space_page_visitor,
kKeepMarking);
+ new_space_page_visitor.account_promoted(page->LiveBytes());
// ArrayBufferTracker will be updated during sweeping.
DCHECK(success);
break;
case kPageNewToNew:
+ new_space_page_visitor.set_mode(EvacuateNewSpacePageVisitor::kNewToNew);
+ success = collector_->VisitLiveObjects(page, &new_space_page_visitor,
Michael Lippautz 2016/11/10 14:06:02 Measured the impact on ToT splay w/ --gc-global. I
+ kKeepMarking);
new_space_page_visitor.account_semispace_copied(page->LiveBytes());
// ArrayBufferTracker will be updated during sweeping.
- success = true;
break;
case kObjectsOldToOld:
success = collector_->VisitLiveObjects(page, &old_space_visitor_,
@@ -3015,8 +3035,6 @@ bool MarkCompactCollector::Evacuator::EvacuatePage(Page* page) {
page, ArrayBufferTracker::kUpdateForwardedRemoveOthers);
}
break;
- default:
- UNREACHABLE();
}
}
ReportCompactionProgress(evacuation_time, saved_live_bytes);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698