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

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

Issue 2181623002: [heap] ObjectStats: Cleanup and more FIXED_ARRAY sub types (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments Created 4 years, 5 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 | « no previous file | src/heap/object-stats.h » ('j') | 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 3d4673b3feb1bc94bed782cb856c9e9633927848..cf9ba155fed2b78558466f57d6a66638133abf23 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -2230,25 +2230,28 @@ void MarkCompactCollector::RegisterExternallyReferencedObject(Object** object) {
class MarkCompactCollector::ObjectStatsVisitor
: public MarkCompactCollector::HeapObjectVisitor {
public:
- ObjectStatsVisitor(ObjectStats* live_stats, ObjectStats* dead_stats)
- : live_stats_(live_stats), dead_stats_(dead_stats) {
- DCHECK_NOT_NULL(live_stats_);
- DCHECK_NOT_NULL(dead_stats_);
+ ObjectStatsVisitor(Heap* heap, ObjectStats* live_stats,
+ ObjectStats* dead_stats)
+ : live_collector_(heap, live_stats), dead_collector_(heap, dead_stats) {
+ DCHECK_NOT_NULL(live_stats);
+ DCHECK_NOT_NULL(dead_stats);
+ // Global objects are roots and thus recorded as live.
+ live_collector_.CollectGlobalStatistics();
}
bool Visit(HeapObject* obj) override {
if (Marking::IsBlack(ObjectMarking::MarkBitFrom(obj))) {
- ObjectStatsCollector::CollectStatistics(live_stats_, obj);
+ live_collector_.CollectStatistics(obj);
} else {
DCHECK(!Marking::IsGrey(ObjectMarking::MarkBitFrom(obj)));
- ObjectStatsCollector::CollectStatistics(dead_stats_, obj);
+ dead_collector_.CollectStatistics(obj);
}
return true;
}
private:
- ObjectStats* live_stats_;
- ObjectStats* dead_stats_;
+ ObjectStatsCollector live_collector_;
+ ObjectStatsCollector dead_collector_;
};
void MarkCompactCollector::VisitAllObjects(HeapObjectVisitor* visitor) {
@@ -2264,7 +2267,7 @@ void MarkCompactCollector::VisitAllObjects(HeapObjectVisitor* visitor) {
void MarkCompactCollector::RecordObjectStats() {
if (FLAG_track_gc_object_stats) {
- ObjectStatsVisitor visitor(heap()->live_object_stats_,
+ ObjectStatsVisitor visitor(heap(), heap()->live_object_stats_,
heap()->dead_object_stats_);
VisitAllObjects(&visitor);
if (FLAG_trace_gc_object_stats) {
« no previous file with comments | « no previous file | src/heap/object-stats.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698