Commit b2bf0c98 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[heap] MinorMC: Update gc tracer counters

Bug: chromium:651354
Change-Id: I356d551f249c9c9c785bb082412ff872639f692f
Reviewed-on: https://chromium-review.googlesource.com/502813Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45263}
parent ee41ee6b
...@@ -527,21 +527,49 @@ void GCTracer::PrintNVP() const { ...@@ -527,21 +527,49 @@ void GCTracer::PrintNVP() const {
"mutator=%.1f " "mutator=%.1f "
"gc=%s " "gc=%s "
"reduce_memory=%d " "reduce_memory=%d "
"minor_mc=%.2f "
"finish_sweeping=%.2f "
"mark=%.2f " "mark=%.2f "
"mark.identify_global_handles=%.2f "
"mark.roots=%.2f " "mark.roots=%.2f "
"mark.old_to_new=%.2f " "mark.old_to_new=%.2f "
"mark.weak=%.2f "
"mark.global_handles=%.2f "
"clear=%.2f "
"clear.string_table=%.2f "
"clear.weak_lists=%.2f "
"evacuate=%.2f " "evacuate=%.2f "
"evacuate.copy=%.2f " "evacuate.copy=%.2f "
"evacuate.update_pointers=%.2f " "evacuate.update_pointers=%.2f "
"evacuate.update_pointers.to_new=%.2f\n", "evacuate.update_pointers.to_new=%.2f "
"evacuate.update_pointers.to_new.tospace=%.2f "
"evacuate.update_pointers.to_new.roots=%.2f "
"evacuate.update_pointers.to_new.old=%.2f "
"update_marking_deque=%.2f "
"reset_liveness=%.2f\n",
duration, spent_in_mutator, "mmc", current_.reduce_memory, duration, spent_in_mutator, "mmc", current_.reduce_memory,
current_.scopes[Scope::MINOR_MC],
current_.scopes[Scope::MINOR_MC_SWEEPING],
current_.scopes[Scope::MINOR_MC_MARK], current_.scopes[Scope::MINOR_MC_MARK],
current_.scopes[Scope::MINOR_MC_MARK_IDENTIFY_GLOBAL_HANDLES],
current_.scopes[Scope::MINOR_MC_MARK_ROOTS], current_.scopes[Scope::MINOR_MC_MARK_ROOTS],
current_.scopes[Scope::MINOR_MC_MARK_OLD_TO_NEW_POINTERS], current_.scopes[Scope::MINOR_MC_MARK_OLD_TO_NEW_POINTERS],
current_.scopes[Scope::MC_EVACUATE], current_.scopes[Scope::MINOR_MC_MARK_WEAK],
current_.scopes[Scope::MC_EVACUATE_COPY], current_.scopes[Scope::MINOR_MC_MARK_GLOBAL_HANDLES],
current_.scopes[Scope::MC_EVACUATE_UPDATE_POINTERS], current_.scopes[Scope::MINOR_MC_CLEAR],
current_.scopes[Scope::MC_EVACUATE_UPDATE_POINTERS_TO_NEW]); current_.scopes[Scope::MINOR_MC_CLEAR_STRING_TABLE],
current_.scopes[Scope::MINOR_MC_CLEAR_WEAK_LISTS],
current_.scopes[Scope::MINOR_MC_EVACUATE],
current_.scopes[Scope::MINOR_MC_EVACUATE_COPY],
current_.scopes[Scope::MINOR_MC_EVACUATE_UPDATE_POINTERS],
current_.scopes[Scope::MINOR_MC_EVACUATE_UPDATE_POINTERS_TO_NEW],
current_
.scopes[Scope::MINOR_MC_EVACUATE_UPDATE_POINTERS_TO_NEW_TOSPACE],
current_
.scopes[Scope::MINOR_MC_EVACUATE_UPDATE_POINTERS_TO_NEW_ROOTS],
current_.scopes[Scope::MINOR_MC_EVACUATE_UPDATE_POINTERS_TO_NEW_OLD],
current_.scopes[Scope::MINOR_MC_MARKING_DEQUE],
current_.scopes[Scope::MINOR_MC_RESET_LIVENESS]);
break; break;
case Event::MARK_COMPACTOR: case Event::MARK_COMPACTOR:
case Event::INCREMENTAL_MARK_COMPACTOR: case Event::INCREMENTAL_MARK_COMPACTOR:
......
...@@ -82,15 +82,31 @@ enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects }; ...@@ -82,15 +82,31 @@ enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects };
F(MC_SWEEP_CODE) \ F(MC_SWEEP_CODE) \
F(MC_SWEEP_MAP) \ F(MC_SWEEP_MAP) \
F(MC_SWEEP_OLD) \ F(MC_SWEEP_OLD) \
F(MC_MINOR_MC) \ F(MINOR_MC) \
F(MINOR_MC_CLEAR_LIVENESS) \ F(MINOR_MC_CLEAR) \
F(MINOR_MC_EVACUATE_PROCESS_BLACK_ALLOCATION) \ F(MINOR_MC_CLEAR_STRING_TABLE) \
F(MINOR_MC_CLEAR_WEAK_LISTS) \
F(MINOR_MC_EVACUATE) \
F(MINOR_MC_EVACUATE_CLEAN_UP) \
F(MINOR_MC_EVACUATE_COPY) \
F(MINOR_MC_EVACUATE_EPILOGUE) \
F(MINOR_MC_EVACUATE_PROLOGUE) \
F(MINOR_MC_EVACUATE_REBALANCE) \
F(MINOR_MC_EVACUATE_UPDATE_POINTERS) \
F(MINOR_MC_EVACUATE_UPDATE_POINTERS_TO_NEW) \
F(MINOR_MC_EVACUATE_UPDATE_POINTERS_TO_NEW_ROOTS) \
F(MINOR_MC_EVACUATE_UPDATE_POINTERS_TO_NEW_TOSPACE) \
F(MINOR_MC_EVACUATE_UPDATE_POINTERS_TO_NEW_OLD) \
F(MINOR_MC_EVACUATE_UPDATE_POINTERS_WEAK) \
F(MINOR_MC_MARK) \ F(MINOR_MC_MARK) \
F(MINOR_MC_MARK_CODE_FLUSH_CANDIDATES) \
F(MINOR_MC_MARK_GLOBAL_HANDLES) \ F(MINOR_MC_MARK_GLOBAL_HANDLES) \
F(MINOR_MC_MARK_IDENTIFY_GLOBAL_HANDLES) \
F(MINOR_MC_MARK_OLD_TO_NEW_POINTERS) \ F(MINOR_MC_MARK_OLD_TO_NEW_POINTERS) \
F(MINOR_MC_MARK_ROOTS) \ F(MINOR_MC_MARK_ROOTS) \
F(MINOR_MC_MARK_WEAK) \ F(MINOR_MC_MARK_WEAK) \
F(MINOR_MC_MARKING_DEQUE) \
F(MINOR_MC_RESET_LIVENESS) \
F(MINOR_MC_SWEEPING) \
F(SCAVENGER_CODE_FLUSH_CANDIDATES) \ F(SCAVENGER_CODE_FLUSH_CANDIDATES) \
F(SCAVENGER_EVACUATE) \ F(SCAVENGER_EVACUATE) \
F(SCAVENGER_OLD_TO_NEW_POINTERS) \ F(SCAVENGER_OLD_TO_NEW_POINTERS) \
......
...@@ -1500,7 +1500,7 @@ void Heap::MinorMarkCompact() { ...@@ -1500,7 +1500,7 @@ void Heap::MinorMarkCompact() {
SetGCState(MINOR_MARK_COMPACT); SetGCState(MINOR_MARK_COMPACT);
LOG(isolate_, ResourceEvent("MinorMarkCompact", "begin")); LOG(isolate_, ResourceEvent("MinorMarkCompact", "begin"));
TRACE_GC(tracer(), GCTracer::Scope::MC_MINOR_MC); TRACE_GC(tracer(), GCTracer::Scope::MINOR_MC);
AlwaysAllocateScope always_allocate(isolate()); AlwaysAllocateScope always_allocate(isolate());
PauseAllocationObserversScope pause_observers(this); PauseAllocationObserversScope pause_observers(this);
IncrementalMarking::PauseBlackAllocationScope pause_black_allocation( IncrementalMarking::PauseBlackAllocationScope pause_black_allocation(
......
...@@ -2580,8 +2580,12 @@ void MinorMarkCompactCollector::MarkLiveObjects() { ...@@ -2580,8 +2580,12 @@ void MinorMarkCompactCollector::MarkLiveObjects() {
marking_deque()->StartUsing(); marking_deque()->StartUsing();
{
TRACE_GC(heap()->tracer(),
GCTracer::Scope::MINOR_MC_MARK_IDENTIFY_GLOBAL_HANDLES);
isolate()->global_handles()->IdentifyWeakUnmodifiedObjects( isolate()->global_handles()->IdentifyWeakUnmodifiedObjects(
&Heap::IsUnmodifiedHeapObject); &Heap::IsUnmodifiedHeapObject);
}
{ {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_MARK_ROOTS); TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_MARK_ROOTS);
...@@ -2649,9 +2653,11 @@ void MinorMarkCompactCollector::EmptyMarkingDeque() { ...@@ -2649,9 +2653,11 @@ void MinorMarkCompactCollector::EmptyMarkingDeque() {
} }
void MinorMarkCompactCollector::CollectGarbage() { void MinorMarkCompactCollector::CollectGarbage() {
{
TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_SWEEPING);
heap()->mark_compact_collector()->sweeper().EnsureNewSpaceCompleted(); heap()->mark_compact_collector()->sweeper().EnsureNewSpaceCompleted();
CleanupSweepToIteratePages(); CleanupSweepToIteratePages();
}
MarkLiveObjects(); MarkLiveObjects();
ClearNonLiveReferences(); ClearNonLiveReferences();
...@@ -2670,10 +2676,13 @@ void MinorMarkCompactCollector::CollectGarbage() { ...@@ -2670,10 +2676,13 @@ void MinorMarkCompactCollector::CollectGarbage() {
} }
#endif // VERIFY_HEAP #endif // VERIFY_HEAP
{
TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_MARKING_DEQUE);
heap()->incremental_marking()->UpdateMarkingDequeAfterScavenge(); heap()->incremental_marking()->UpdateMarkingDequeAfterScavenge();
}
{ {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_CLEAR_LIVENESS); TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_RESET_LIVENESS);
for (Page* p : PageRange(heap()->new_space()->FromSpaceStart(), for (Page* p : PageRange(heap()->new_space()->FromSpaceStart(),
heap()->new_space()->FromSpaceEnd())) { heap()->new_space()->FromSpaceEnd())) {
DCHECK(!p->IsFlagSet(Page::SWEEP_TO_ITERATE)); DCHECK(!p->IsFlagSet(Page::SWEEP_TO_ITERATE));
...@@ -2735,10 +2744,10 @@ void MinorMarkCompactCollector::MakeIterable( ...@@ -2735,10 +2744,10 @@ void MinorMarkCompactCollector::MakeIterable(
} }
void MinorMarkCompactCollector::ClearNonLiveReferences() { void MinorMarkCompactCollector::ClearNonLiveReferences() {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_CLEAR); TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_CLEAR);
{ {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_CLEAR_STRING_TABLE); TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_CLEAR_STRING_TABLE);
// Internalized strings are always stored in old space, so there is no need // Internalized strings are always stored in old space, so there is no need
// to clean them here. // to clean them here.
YoungGenerationExternalStringTableCleaner external_visitor(*this); YoungGenerationExternalStringTableCleaner external_visitor(*this);
...@@ -2747,7 +2756,7 @@ void MinorMarkCompactCollector::ClearNonLiveReferences() { ...@@ -2747,7 +2756,7 @@ void MinorMarkCompactCollector::ClearNonLiveReferences() {
} }
{ {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_CLEAR_WEAK_LISTS); TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_CLEAR_WEAK_LISTS);
// Process the weak references. // Process the weak references.
MinorMarkCompactWeakObjectRetainer retainer(*this); MinorMarkCompactWeakObjectRetainer retainer(*this);
heap()->ProcessYoungWeakReferences(&retainer); heap()->ProcessYoungWeakReferences(&retainer);
...@@ -2769,23 +2778,23 @@ void MinorMarkCompactCollector::EvacuateEpilogue() { ...@@ -2769,23 +2778,23 @@ void MinorMarkCompactCollector::EvacuateEpilogue() {
} }
void MinorMarkCompactCollector::Evacuate() { void MinorMarkCompactCollector::Evacuate() {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE); TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_EVACUATE);
base::LockGuard<base::Mutex> guard(heap()->relocation_mutex()); base::LockGuard<base::Mutex> guard(heap()->relocation_mutex());
{ {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_PROLOGUE); TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_EVACUATE_PROLOGUE);
EvacuatePrologue(); EvacuatePrologue();
} }
{ {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_COPY); TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_EVACUATE_COPY);
EvacuatePagesInParallel(); EvacuatePagesInParallel();
} }
UpdatePointersAfterEvacuation(); UpdatePointersAfterEvacuation();
{ {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_REBALANCE); TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_EVACUATE_REBALANCE);
if (!heap()->new_space()->Rebalance()) { if (!heap()->new_space()->Rebalance()) {
FatalProcessOutOfMemory("NewSpace::Rebalance"); FatalProcessOutOfMemory("NewSpace::Rebalance");
} }
...@@ -2795,7 +2804,7 @@ void MinorMarkCompactCollector::Evacuate() { ...@@ -2795,7 +2804,7 @@ void MinorMarkCompactCollector::Evacuate() {
heap()->memory_allocator()->unmapper()->FreeQueuedChunks(); heap()->memory_allocator()->unmapper()->FreeQueuedChunks();
{ {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_CLEAN_UP); TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_EVACUATE_CLEAN_UP);
for (Page* p : new_space_evacuation_pages_) { for (Page* p : new_space_evacuation_pages_) {
if (p->IsFlagSet(Page::PAGE_NEW_NEW_PROMOTION) || if (p->IsFlagSet(Page::PAGE_NEW_NEW_PROMOTION) ||
p->IsFlagSet(Page::PAGE_NEW_OLD_PROMOTION)) { p->IsFlagSet(Page::PAGE_NEW_OLD_PROMOTION)) {
...@@ -2809,7 +2818,7 @@ void MinorMarkCompactCollector::Evacuate() { ...@@ -2809,7 +2818,7 @@ void MinorMarkCompactCollector::Evacuate() {
} }
{ {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_EPILOGUE); TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_EVACUATE_EPILOGUE);
EvacuateEpilogue(); EvacuateEpilogue();
} }
} }
...@@ -4435,23 +4444,37 @@ void MarkCompactCollector::UpdatePointersAfterEvacuation() { ...@@ -4435,23 +4444,37 @@ void MarkCompactCollector::UpdatePointersAfterEvacuation() {
} }
void MinorMarkCompactCollector::UpdatePointersAfterEvacuation() { void MinorMarkCompactCollector::UpdatePointersAfterEvacuation() {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_UPDATE_POINTERS); TRACE_GC(heap()->tracer(),
GCTracer::Scope::MINOR_MC_EVACUATE_UPDATE_POINTERS);
PointersUpdatingVisitor updating_visitor; PointersUpdatingVisitor updating_visitor;
{ {
TRACE_GC(heap()->tracer(), TRACE_GC(heap()->tracer(),
GCTracer::Scope::MC_EVACUATE_UPDATE_POINTERS_TO_NEW); GCTracer::Scope::MINOR_MC_EVACUATE_UPDATE_POINTERS_TO_NEW);
{
TRACE_GC(
heap()->tracer(),
GCTracer::Scope::MINOR_MC_EVACUATE_UPDATE_POINTERS_TO_NEW_TOSPACE);
UpdateToSpacePointersInParallel(heap_, &page_parallel_job_semaphore_, UpdateToSpacePointersInParallel(heap_, &page_parallel_job_semaphore_,
*this); *this);
}
{
TRACE_GC(heap()->tracer(),
GCTracer::Scope::MINOR_MC_EVACUATE_UPDATE_POINTERS_TO_NEW_ROOTS);
heap_->IterateRoots(&updating_visitor, VISIT_ALL_IN_MINOR_MC_UPDATE); heap_->IterateRoots(&updating_visitor, VISIT_ALL_IN_MINOR_MC_UPDATE);
}
{
TRACE_GC(heap()->tracer(),
GCTracer::Scope::MINOR_MC_EVACUATE_UPDATE_POINTERS_TO_NEW_OLD);
UpdatePointersInParallel<OLD_TO_NEW>(heap_, &page_parallel_job_semaphore_, UpdatePointersInParallel<OLD_TO_NEW>(heap_, &page_parallel_job_semaphore_,
this); this);
} }
}
{ {
TRACE_GC(heap()->tracer(), TRACE_GC(heap()->tracer(),
GCTracer::Scope::MC_EVACUATE_UPDATE_POINTERS_WEAK); GCTracer::Scope::MINOR_MC_EVACUATE_UPDATE_POINTERS_WEAK);
EvacuationWeakObjectRetainer evacuation_object_retainer; EvacuationWeakObjectRetainer evacuation_object_retainer;
heap()->ProcessWeakListRoots(&evacuation_object_retainer); heap()->ProcessWeakListRoots(&evacuation_object_retainer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment