Commit e40d453d authored by mlippautz's avatar mlippautz Committed by Commit bot

Add scavenger events to GC tracer

BUG=

Review URL: https://codereview.chromium.org/1235913002

Cr-Commit-Position: refs/heads/master@{#29768}
parent 5e5fadb7
......@@ -399,36 +399,67 @@ void GCTracer::PrintNVP() const {
PrintF("mutator=%.1f ", spent_in_mutator);
PrintF("gc=%s ", current_.TypeName(true));
PrintF("external=%.1f ", current_.scopes[Scope::EXTERNAL]);
PrintF("mark=%.1f ", current_.scopes[Scope::MC_MARK]);
PrintF("sweep=%.2f ", current_.scopes[Scope::MC_SWEEP]);
PrintF("sweepns=%.2f ", current_.scopes[Scope::MC_SWEEP_NEWSPACE]);
PrintF("sweepos=%.2f ", current_.scopes[Scope::MC_SWEEP_OLDSPACE]);
PrintF("sweepcode=%.2f ", current_.scopes[Scope::MC_SWEEP_CODE]);
PrintF("sweepcell=%.2f ", current_.scopes[Scope::MC_SWEEP_CELL]);
PrintF("sweepmap=%.2f ", current_.scopes[Scope::MC_SWEEP_MAP]);
PrintF("evacuate=%.1f ", current_.scopes[Scope::MC_EVACUATE_PAGES]);
PrintF("new_new=%.1f ",
current_.scopes[Scope::MC_UPDATE_NEW_TO_NEW_POINTERS]);
PrintF("root_new=%.1f ",
current_.scopes[Scope::MC_UPDATE_ROOT_TO_NEW_POINTERS]);
PrintF("old_new=%.1f ",
current_.scopes[Scope::MC_UPDATE_OLD_TO_NEW_POINTERS]);
PrintF("compaction_ptrs=%.1f ",
current_.scopes[Scope::MC_UPDATE_POINTERS_TO_EVACUATED]);
PrintF("intracompaction_ptrs=%.1f ",
current_.scopes[Scope::MC_UPDATE_POINTERS_BETWEEN_EVACUATED]);
PrintF("misc_compaction=%.1f ",
current_.scopes[Scope::MC_UPDATE_MISC_POINTERS]);
PrintF("weak_closure=%.1f ", current_.scopes[Scope::MC_WEAKCLOSURE]);
PrintF("inc_weak_closure=%.1f ",
current_.scopes[Scope::MC_INCREMENTAL_WEAKCLOSURE]);
PrintF("weakcollection_process=%.1f ",
current_.scopes[Scope::MC_WEAKCOLLECTION_PROCESS]);
PrintF("weakcollection_clear=%.1f ",
current_.scopes[Scope::MC_WEAKCOLLECTION_CLEAR]);
PrintF("weakcollection_abort=%.1f ",
current_.scopes[Scope::MC_WEAKCOLLECTION_ABORT]);
switch (current_.type) {
case Event::SCAVENGER:
PrintF("scavenge=%.2f ", current_.scopes[Scope::SCAVENGER_SCAVENGE]);
PrintF("old_new=%.2f ",
current_.scopes[Scope::SCAVENGER_OLD_TO_NEW_POINTERS]);
PrintF("weak=%.2f ", current_.scopes[Scope::SCAVENGER_WEAK]);
PrintF("roots=%.2f ", current_.scopes[Scope::SCAVENGER_ROOTS]);
PrintF("code=%.2f ",
current_.scopes[Scope::SCAVENGER_CODE_FLUSH_CANDIDATES]);
PrintF("semispace=%.2f ", current_.scopes[Scope::SCAVENGER_SEMISPACE]);
PrintF("object_groups=%.2f ",
current_.scopes[Scope::SCAVENGER_OBJECT_GROUPS]);
PrintF("steps_count=%d ", current_.incremental_marking_steps);
PrintF("steps_took=%.1f ", current_.incremental_marking_duration);
PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ",
ScavengeSpeedInBytesPerMillisecond());
break;
case Event::MARK_COMPACTOR:
case Event::INCREMENTAL_MARK_COMPACTOR:
PrintF("external=%.1f ", current_.scopes[Scope::EXTERNAL]);
PrintF("mark=%.1f ", current_.scopes[Scope::MC_MARK]);
PrintF("sweep=%.2f ", current_.scopes[Scope::MC_SWEEP]);
PrintF("sweepns=%.2f ", current_.scopes[Scope::MC_SWEEP_NEWSPACE]);
PrintF("sweepos=%.2f ", current_.scopes[Scope::MC_SWEEP_OLDSPACE]);
PrintF("sweepcode=%.2f ", current_.scopes[Scope::MC_SWEEP_CODE]);
PrintF("sweepcell=%.2f ", current_.scopes[Scope::MC_SWEEP_CELL]);
PrintF("sweepmap=%.2f ", current_.scopes[Scope::MC_SWEEP_MAP]);
PrintF("evacuate=%.1f ", current_.scopes[Scope::MC_EVACUATE_PAGES]);
PrintF("new_new=%.1f ",
current_.scopes[Scope::MC_UPDATE_NEW_TO_NEW_POINTERS]);
PrintF("root_new=%.1f ",
current_.scopes[Scope::MC_UPDATE_ROOT_TO_NEW_POINTERS]);
PrintF("old_new=%.1f ",
current_.scopes[Scope::MC_UPDATE_OLD_TO_NEW_POINTERS]);
PrintF("compaction_ptrs=%.1f ",
current_.scopes[Scope::MC_UPDATE_POINTERS_TO_EVACUATED]);
PrintF("intracompaction_ptrs=%.1f ",
current_.scopes[Scope::MC_UPDATE_POINTERS_BETWEEN_EVACUATED]);
PrintF("misc_compaction=%.1f ",
current_.scopes[Scope::MC_UPDATE_MISC_POINTERS]);
PrintF("weak_closure=%.1f ", current_.scopes[Scope::MC_WEAKCLOSURE]);
PrintF("inc_weak_closure=%.1f ",
current_.scopes[Scope::MC_INCREMENTAL_WEAKCLOSURE]);
PrintF("weakcollection_process=%.1f ",
current_.scopes[Scope::MC_WEAKCOLLECTION_PROCESS]);
PrintF("weakcollection_clear=%.1f ",
current_.scopes[Scope::MC_WEAKCOLLECTION_CLEAR]);
PrintF("weakcollection_abort=%.1f ",
current_.scopes[Scope::MC_WEAKCOLLECTION_ABORT]);
PrintF("steps_count=%d ", current_.incremental_marking_steps);
PrintF("steps_took=%.1f ", current_.incremental_marking_duration);
PrintF("longest_step=%.1f ", current_.longest_incremental_marking_step);
PrintF("incremental_marking_throughput=%" V8_PTR_PREFIX "d ",
IncrementalMarkingSpeedInBytesPerMillisecond());
break;
case Event::START:
break;
default:
UNREACHABLE();
}
PrintF("total_size_before=%" V8_PTR_PREFIX "d ", current_.start_object_size);
PrintF("total_size_after=%" V8_PTR_PREFIX "d ", current_.end_object_size);
......@@ -452,19 +483,6 @@ void GCTracer::PrintNVP() const {
NewSpaceAllocationThroughputInBytesPerMillisecond());
PrintF("context_disposal_rate=%.1f ", ContextDisposalRateInMilliseconds());
if (current_.type == Event::SCAVENGER) {
PrintF("steps_count=%d ", current_.incremental_marking_steps);
PrintF("steps_took=%.1f ", current_.incremental_marking_duration);
PrintF("scavenge_throughput=%" V8_PTR_PREFIX "d ",
ScavengeSpeedInBytesPerMillisecond());
} else {
PrintF("steps_count=%d ", current_.incremental_marking_steps);
PrintF("steps_took=%.1f ", current_.incremental_marking_duration);
PrintF("longest_step=%.1f ", current_.longest_incremental_marking_step);
PrintF("incremental_marking_throughput=%" V8_PTR_PREFIX "d ",
IncrementalMarkingSpeedInBytesPerMillisecond());
}
PrintF("\n");
}
......
......@@ -117,6 +117,13 @@ class GCTracer {
MC_WEAKCOLLECTION_CLEAR,
MC_WEAKCOLLECTION_ABORT,
MC_FLUSH_CODE,
SCAVENGER_CODE_FLUSH_CANDIDATES,
SCAVENGER_OBJECT_GROUPS,
SCAVENGER_OLD_TO_NEW_POINTERS,
SCAVENGER_ROOTS,
SCAVENGER_SCAVENGE,
SCAVENGER_SEMISPACE,
SCAVENGER_WEAK,
NUMBER_OF_SCOPES
};
......
......@@ -1641,6 +1641,7 @@ class ScavengeWeakObjectRetainer : public WeakObjectRetainer {
void Heap::Scavenge() {
GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::SCAVENGER_SCAVENGE);
RelocationLock relocation_lock(this);
// There are soft limits in the allocation code, designed to trigger a mark
// sweep collection by failing allocations. There is no sense in trying to
......@@ -1692,35 +1693,54 @@ void Heap::Scavenge() {
promotion_queue_.Initialize();
ScavengeVisitor scavenge_visitor(this);
// Copy roots.
IterateRoots(&scavenge_visitor, VISIT_ALL_IN_SCAVENGE);
{
// Copy roots.
GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::SCAVENGER_ROOTS);
IterateRoots(&scavenge_visitor, VISIT_ALL_IN_SCAVENGE);
}
// Copy objects reachable from the old generation.
{
// Copy objects reachable from the old generation.
GCTracer::Scope gc_scope(tracer(),
GCTracer::Scope::SCAVENGER_OLD_TO_NEW_POINTERS);
StoreBufferRebuildScope scope(this, store_buffer(),
&ScavengeStoreBufferCallback);
store_buffer()->IteratePointersToNewSpace(&ScavengeObject);
}
// Copy objects reachable from the encountered weak collections list.
scavenge_visitor.VisitPointer(&encountered_weak_collections_);
// Copy objects reachable from the encountered weak cells.
scavenge_visitor.VisitPointer(&encountered_weak_cells_);
// Copy objects reachable from the code flushing candidates list.
MarkCompactCollector* collector = mark_compact_collector();
if (collector->is_code_flushing_enabled()) {
collector->code_flusher()->IteratePointersToFromSpace(&scavenge_visitor);
{
GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::SCAVENGER_WEAK);
// Copy objects reachable from the encountered weak collections list.
scavenge_visitor.VisitPointer(&encountered_weak_collections_);
// Copy objects reachable from the encountered weak cells.
scavenge_visitor.VisitPointer(&encountered_weak_cells_);
}
new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
{
// Copy objects reachable from the code flushing candidates list.
GCTracer::Scope gc_scope(tracer(),
GCTracer::Scope::SCAVENGER_CODE_FLUSH_CANDIDATES);
MarkCompactCollector* collector = mark_compact_collector();
if (collector->is_code_flushing_enabled()) {
collector->code_flusher()->IteratePointersToFromSpace(&scavenge_visitor);
}
}
while (isolate()->global_handles()->IterateObjectGroups(
&scavenge_visitor, &IsUnscavengedHeapObject)) {
{
GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::SCAVENGER_SEMISPACE);
new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
}
isolate()->global_handles()->RemoveObjectGroups();
isolate()->global_handles()->RemoveImplicitRefGroups();
{
GCTracer::Scope gc_scope(tracer(),
GCTracer::Scope::SCAVENGER_OBJECT_GROUPS);
while (isolate()->global_handles()->IterateObjectGroups(
&scavenge_visitor, &IsUnscavengedHeapObject)) {
new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
}
isolate()->global_handles()->RemoveObjectGroups();
isolate()->global_handles()->RemoveImplicitRefGroups();
}
isolate()->global_handles()->IdentifyNewSpaceWeakIndependentHandles(
&IsUnscavengedHeapObject);
......
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