Commit c5479518 authored by hpayer's avatar hpayer Committed by Commit bot

[heap] Add detailed timers to --trace-gc-nvp MC marking phase.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#31344}
parent 2c8340da
......@@ -469,6 +469,16 @@ void GCTracer::PrintNVP() const {
"reduce_memory=%d "
"external=%.1f "
"mark=%.1f "
"mark_inc=%.1f "
"mark_prepcodeflush=%.1f "
"mark_root=%.1f "
"mark_topopt=%.1f "
"mark_retainmaps=%.1f "
"mark_weakclosure=%.1f "
"mark_stringtable=%.1f "
"mark_weakrefs=%.1f "
"mark_globalhandles=%.1f "
"mark_codeflush=%.1f "
"sweep=%.2f "
"sweepns=%.2f "
"sweepos=%.2f "
......@@ -492,14 +502,22 @@ void GCTracer::PrintNVP() const {
"steps_count=%d "
"steps_took=%.1f "
"longest_step=%.1f "
"incremental_marking_throughput=%" V8_PTR_PREFIX "d "
"total_size_before=%" V8_PTR_PREFIX "d "
"total_size_after=%" V8_PTR_PREFIX "d "
"holes_size_before=%" V8_PTR_PREFIX "d "
"holes_size_after=%" V8_PTR_PREFIX "d "
"allocated=%" V8_PTR_PREFIX "d "
"promoted=%" V8_PTR_PREFIX "d "
"semi_space_copied=%" V8_PTR_PREFIX "d "
"incremental_marking_throughput=%" V8_PTR_PREFIX
"d "
"total_size_before=%" V8_PTR_PREFIX
"d "
"total_size_after=%" V8_PTR_PREFIX
"d "
"holes_size_before=%" V8_PTR_PREFIX
"d "
"holes_size_after=%" V8_PTR_PREFIX
"d "
"allocated=%" V8_PTR_PREFIX
"d "
"promoted=%" V8_PTR_PREFIX
"d "
"semi_space_copied=%" V8_PTR_PREFIX
"d "
"nodes_died_in_new=%d "
"nodes_copied_in_new=%d "
"nodes_promoted=%d "
......@@ -507,15 +525,23 @@ void GCTracer::PrintNVP() const {
"average_survival_ratio=%.1f%% "
"promotion_rate=%.1f%% "
"semi_space_copy_rate=%.1f%% "
"new_space_allocation_throughput=%" V8_PTR_PREFIX "d "
"new_space_allocation_throughput=%" V8_PTR_PREFIX
"d "
"context_disposal_rate=%.1f\n",
heap_->isolate(),
heap_->isolate()->time_millis_since_init(),
duration, spent_in_mutator,
current_.TypeName(true),
current_.reduce_memory,
current_.scopes[Scope::EXTERNAL],
heap_->isolate(), heap_->isolate()->time_millis_since_init(),
duration, spent_in_mutator, current_.TypeName(true),
current_.reduce_memory, current_.scopes[Scope::EXTERNAL],
current_.scopes[Scope::MC_MARK],
current_.scopes[Scope::MC_MARK_FINISH_INCREMENTAL],
current_.scopes[Scope::MC_MARK_PREPARE_CODE_FLUSH],
current_.scopes[Scope::MC_MARK_ROOT],
current_.scopes[Scope::MC_MARK_TOPOPT],
current_.scopes[Scope::MC_MARK_RETAIN_MAPS],
current_.scopes[Scope::MC_MARK_WEAK_CLOSURE],
current_.scopes[Scope::MC_MARK_STRING_TABLE],
current_.scopes[Scope::MC_MARK_WEAK_REFERENCES],
current_.scopes[Scope::MC_MARK_GLOBAL_HANDLES],
current_.scopes[Scope::MC_MARK_CODE_FLUSH],
current_.scopes[Scope::MC_SWEEP],
current_.scopes[Scope::MC_SWEEP_NEWSPACE],
current_.scopes[Scope::MC_SWEEP_OLDSPACE],
......
......@@ -99,6 +99,16 @@ class GCTracer {
enum ScopeId {
EXTERNAL,
MC_MARK,
MC_MARK_FINISH_INCREMENTAL,
MC_MARK_PREPARE_CODE_FLUSH,
MC_MARK_ROOT,
MC_MARK_TOPOPT,
MC_MARK_RETAIN_MAPS,
MC_MARK_WEAK_CLOSURE,
MC_MARK_STRING_TABLE,
MC_MARK_WEAK_REFERENCES,
MC_MARK_GLOBAL_HANDLES,
MC_MARK_CODE_FLUSH,
MC_SWEEP,
MC_SWEEP_NEWSPACE,
MC_SWEEP_OLDSPACE,
......
......@@ -2107,14 +2107,18 @@ void MarkCompactCollector::MarkLiveObjects() {
// with the C stack limit check.
PostponeInterruptsScope postpone(isolate());
IncrementalMarking* incremental_marking = heap_->incremental_marking();
if (was_marked_incrementally_) {
incremental_marking->Finalize();
} else {
// Abort any pending incremental activities e.g. incremental sweeping.
incremental_marking->Stop();
if (marking_deque_.in_use()) {
marking_deque_.Uninitialize(true);
{
GCTracer::Scope gc_scope(heap()->tracer(),
GCTracer::Scope::MC_MARK_FINISH_INCREMENTAL);
IncrementalMarking* incremental_marking = heap_->incremental_marking();
if (was_marked_incrementally_) {
incremental_marking->Finalize();
} else {
// Abort any pending incremental activities e.g. incremental sweeping.
incremental_marking->Stop();
if (marking_deque_.in_use()) {
marking_deque_.Uninitialize(true);
}
}
}
......@@ -2126,20 +2130,36 @@ void MarkCompactCollector::MarkLiveObjects() {
EnsureMarkingDequeIsCommittedAndInitialize(
MarkCompactCollector::kMaxMarkingDequeSize);
PrepareForCodeFlushing();
{
GCTracer::Scope gc_scope(heap()->tracer(),
GCTracer::Scope::MC_MARK_PREPARE_CODE_FLUSH);
PrepareForCodeFlushing();
}
RootMarkingVisitor root_visitor(heap());
MarkRoots(&root_visitor);
ProcessTopOptimizedFrame(&root_visitor);
{
GCTracer::Scope gc_scope(heap()->tracer(), GCTracer::Scope::MC_MARK_ROOT);
MarkRoots(&root_visitor);
}
{
GCTracer::Scope gc_scope(heap()->tracer(), GCTracer::Scope::MC_MARK_TOPOPT);
ProcessTopOptimizedFrame(&root_visitor);
}
// Retaining dying maps should happen before or during ephemeral marking
// because a map could keep the key of an ephemeron alive. Note that map
// aging is imprecise: maps that are kept alive only by ephemerons will age.
RetainMaps();
{
GCTracer::Scope gc_scope(heap()->tracer(),
GCTracer::Scope::MC_MARK_RETAIN_MAPS);
RetainMaps();
}
{
GCTracer::Scope gc_scope(heap()->tracer(), GCTracer::Scope::MC_WEAKCLOSURE);
GCTracer::Scope gc_scope(heap()->tracer(),
GCTracer::Scope::MC_MARK_WEAK_CLOSURE);
// The objects reachable from the roots are marked, yet unreachable
// objects are unmarked. Mark objects reachable due to host
......@@ -2176,28 +2196,45 @@ void MarkCompactCollector::MarkLiveObjects() {
void MarkCompactCollector::AfterMarking() {
// Prune the string table removing all strings only pointed to by the
// string table. Cannot use string_table() here because the string
// table is marked.
StringTable* string_table = heap()->string_table();
InternalizedStringTableCleaner internalized_visitor(heap());
string_table->IterateElements(&internalized_visitor);
string_table->ElementsRemoved(internalized_visitor.PointersRemoved());
{
GCTracer::Scope gc_scope(heap()->tracer(),
GCTracer::Scope::MC_MARK_STRING_TABLE);
ExternalStringTableCleaner external_visitor(heap());
heap()->external_string_table_.Iterate(&external_visitor);
heap()->external_string_table_.CleanUp();
// Prune the string table removing all strings only pointed to by the
// string table. Cannot use string_table() here because the string
// table is marked.
StringTable* string_table = heap()->string_table();
InternalizedStringTableCleaner internalized_visitor(heap());
string_table->IterateElements(&internalized_visitor);
string_table->ElementsRemoved(internalized_visitor.PointersRemoved());
// Process the weak references.
MarkCompactWeakObjectRetainer mark_compact_object_retainer;
heap()->ProcessAllWeakReferences(&mark_compact_object_retainer);
ExternalStringTableCleaner external_visitor(heap());
heap()->external_string_table_.Iterate(&external_visitor);
heap()->external_string_table_.CleanUp();
}
// Remove object groups after marking phase.
heap()->isolate()->global_handles()->RemoveObjectGroups();
heap()->isolate()->global_handles()->RemoveImplicitRefGroups();
{
GCTracer::Scope gc_scope(heap()->tracer(),
GCTracer::Scope::MC_MARK_WEAK_REFERENCES);
// Process the weak references.
MarkCompactWeakObjectRetainer mark_compact_object_retainer;
heap()->ProcessAllWeakReferences(&mark_compact_object_retainer);
}
{
GCTracer::Scope gc_scope(heap()->tracer(),
GCTracer::Scope::MC_MARK_GLOBAL_HANDLES);
// Remove object groups after marking phase.
heap()->isolate()->global_handles()->RemoveObjectGroups();
heap()->isolate()->global_handles()->RemoveImplicitRefGroups();
}
// Flush code from collected candidates.
if (is_code_flushing_enabled()) {
GCTracer::Scope gc_scope(heap()->tracer(),
GCTracer::Scope::MC_MARK_CODE_FLUSH);
code_flusher_->ProcessCandidates();
}
......
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