| Index: src/heap/mark-compact.cc
|
| diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
|
| index a4c1971c13f33355ec5468dccadda52e130d53c0..eca2880acd174b0bc7e6e620899ad17f6cd3d794 100644
|
| --- a/src/heap/mark-compact.cc
|
| +++ b/src/heap/mark-compact.cc
|
| @@ -336,6 +336,8 @@ void MarkCompactCollector::CollectGarbage() {
|
|
|
| ClearNonLiveReferences();
|
|
|
| + RecordObjectStats();
|
| +
|
| #ifdef VERIFY_HEAP
|
| if (FLAG_verify_heap) {
|
| VerifyMarking(heap_);
|
| @@ -2273,6 +2275,20 @@ void MarkCompactCollector::VisitAllObjects(HeapObjectVisitor* visitor) {
|
| }
|
| }
|
|
|
| +void MarkCompactCollector::RecordObjectStats() {
|
| + if (FLAG_track_gc_object_stats) {
|
| + ObjectStatsVisitor visitor(heap()->live_object_stats_,
|
| + heap()->dead_object_stats_);
|
| + VisitAllObjects(&visitor);
|
| + if (FLAG_trace_gc_object_stats) {
|
| + heap()->live_object_stats_->PrintJSON("live");
|
| + heap()->dead_object_stats_->PrintJSON("dead");
|
| + }
|
| + heap()->live_object_stats_->CheckpointObjectStats();
|
| + heap()->dead_object_stats_->ClearObjectStats();
|
| + }
|
| +}
|
| +
|
| void MarkCompactCollector::MarkLiveObjects() {
|
| TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK);
|
| double start_time = 0.0;
|
| @@ -2372,17 +2388,6 @@ void MarkCompactCollector::MarkLiveObjects() {
|
| heap_->tracer()->AddMarkingTime(heap_->MonotonicallyIncreasingTimeInMs() -
|
| start_time);
|
| }
|
| - if (FLAG_track_gc_object_stats) {
|
| - ObjectStatsVisitor visitor(heap()->live_object_stats_,
|
| - heap()->dead_object_stats_);
|
| - VisitAllObjects(&visitor);
|
| - if (FLAG_trace_gc_object_stats) {
|
| - heap()->live_object_stats_->PrintJSON("live");
|
| - heap()->dead_object_stats_->PrintJSON("dead");
|
| - }
|
| - heap()->live_object_stats_->CheckpointObjectStats();
|
| - heap()->dead_object_stats_->ClearObjectStats();
|
| - }
|
| }
|
|
|
|
|
|
|