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

[heap] Add tracer scopes to GC prologue and epilogue

BUG=

Change-Id: I51278784c2303419155abbfe6e36a1dc78c53527
Reviewed-on: https://chromium-review.googlesource.com/455835Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43856}
parent f3aeb762
...@@ -451,6 +451,12 @@ void GCTracer::PrintNVP() const { ...@@ -451,6 +451,12 @@ void GCTracer::PrintNVP() const {
"mutator=%.1f " "mutator=%.1f "
"gc=%s " "gc=%s "
"reduce_memory=%d " "reduce_memory=%d "
"heap.prologue=%.2f "
"heap.epilogue=%.2f "
"heap.epilogue.reduce_new_space=%.2f "
"heap.external.prologue=%.2f "
"heap.external.epilogue=%.2f "
"heap.external_weak_global_handles=%.2f "
"scavenge=%.2f " "scavenge=%.2f "
"evacuate=%.2f " "evacuate=%.2f "
"old_new=%.2f " "old_new=%.2f "
...@@ -458,9 +464,6 @@ void GCTracer::PrintNVP() const { ...@@ -458,9 +464,6 @@ void GCTracer::PrintNVP() const {
"roots=%.2f " "roots=%.2f "
"code=%.2f " "code=%.2f "
"semispace=%.2f " "semispace=%.2f "
"external.prologue=%.2f "
"external.epilogue=%.2f "
"external_weak_global_handles=%.2f "
"steps_count=%d " "steps_count=%d "
"steps_took=%.1f " "steps_took=%.1f "
"scavenge_throughput=%.f " "scavenge_throughput=%.f "
...@@ -488,16 +491,19 @@ void GCTracer::PrintNVP() const { ...@@ -488,16 +491,19 @@ void GCTracer::PrintNVP() const {
"new_space_allocation_throughput=%.1f " "new_space_allocation_throughput=%.1f "
"context_disposal_rate=%.1f\n", "context_disposal_rate=%.1f\n",
duration, spent_in_mutator, current_.TypeName(true), duration, spent_in_mutator, current_.TypeName(true),
current_.reduce_memory, current_.scopes[Scope::SCAVENGER_SCAVENGE], current_.reduce_memory, current_.scopes[Scope::HEAP_PROLOGUE],
current_.scopes[Scope::HEAP_EPILOGUE],
current_.scopes[Scope::HEAP_EPILOGUE_REDUCE_NEW_SPACE],
current_.scopes[Scope::HEAP_EXTERNAL_PROLOGUE],
current_.scopes[Scope::HEAP_EXTERNAL_EPILOGUE],
current_.scopes[Scope::HEAP_EXTERNAL_WEAK_GLOBAL_HANDLES],
current_.scopes[Scope::SCAVENGER_SCAVENGE],
current_.scopes[Scope::SCAVENGER_EVACUATE], current_.scopes[Scope::SCAVENGER_EVACUATE],
current_.scopes[Scope::SCAVENGER_OLD_TO_NEW_POINTERS], current_.scopes[Scope::SCAVENGER_OLD_TO_NEW_POINTERS],
current_.scopes[Scope::SCAVENGER_WEAK], current_.scopes[Scope::SCAVENGER_WEAK],
current_.scopes[Scope::SCAVENGER_ROOTS], current_.scopes[Scope::SCAVENGER_ROOTS],
current_.scopes[Scope::SCAVENGER_CODE_FLUSH_CANDIDATES], current_.scopes[Scope::SCAVENGER_CODE_FLUSH_CANDIDATES],
current_.scopes[Scope::SCAVENGER_SEMISPACE], current_.scopes[Scope::SCAVENGER_SEMISPACE],
current_.scopes[Scope::EXTERNAL_PROLOGUE],
current_.scopes[Scope::EXTERNAL_EPILOGUE],
current_.scopes[Scope::EXTERNAL_WEAK_GLOBAL_HANDLES],
current_.incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL] current_.incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL]
.steps, .steps,
current_.scopes[Scope::MC_INCREMENTAL], current_.scopes[Scope::MC_INCREMENTAL],
...@@ -534,6 +540,12 @@ void GCTracer::PrintNVP() const { ...@@ -534,6 +540,12 @@ void GCTracer::PrintNVP() const {
"mutator=%.1f " "mutator=%.1f "
"gc=%s " "gc=%s "
"reduce_memory=%d " "reduce_memory=%d "
"heap.prologue=%.2f "
"heap.epilogue=%.2f "
"heap.epilogue.reduce_new_space=%.2f "
"heap.external.prologue=%.1f "
"heap.external.epilogue=%.1f "
"heap.external.weak_global_handles=%.1f "
"clear=%1.f " "clear=%1.f "
"clear.code_flush=%.1f " "clear.code_flush=%.1f "
"clear.dependent_code=%.1f " "clear.dependent_code=%.1f "
...@@ -556,9 +568,6 @@ void GCTracer::PrintNVP() const { ...@@ -556,9 +568,6 @@ void GCTracer::PrintNVP() const {
"evacuate.update_pointers.to_evacuated=%.1f " "evacuate.update_pointers.to_evacuated=%.1f "
"evacuate.update_pointers.to_new=%.1f " "evacuate.update_pointers.to_new=%.1f "
"evacuate.update_pointers.weak=%.1f " "evacuate.update_pointers.weak=%.1f "
"external.prologue=%.1f "
"external.epilogue=%.1f "
"external.weak_global_handles=%.1f "
"finish=%.1f " "finish=%.1f "
"mark=%.1f " "mark=%.1f "
"mark.finish_incremental=%.1f " "mark.finish_incremental=%.1f "
...@@ -617,7 +626,13 @@ void GCTracer::PrintNVP() const { ...@@ -617,7 +626,13 @@ void GCTracer::PrintNVP() const {
"context_disposal_rate=%.1f " "context_disposal_rate=%.1f "
"compaction_speed=%.f\n", "compaction_speed=%.f\n",
duration, spent_in_mutator, current_.TypeName(true), duration, spent_in_mutator, current_.TypeName(true),
current_.reduce_memory, current_.scopes[Scope::MC_CLEAR], current_.reduce_memory, current_.scopes[Scope::HEAP_PROLOGUE],
current_.scopes[Scope::HEAP_EPILOGUE],
current_.scopes[Scope::HEAP_EPILOGUE_REDUCE_NEW_SPACE],
current_.scopes[Scope::HEAP_EXTERNAL_PROLOGUE],
current_.scopes[Scope::HEAP_EXTERNAL_EPILOGUE],
current_.scopes[Scope::HEAP_EXTERNAL_WEAK_GLOBAL_HANDLES],
current_.scopes[Scope::MC_CLEAR],
current_.scopes[Scope::MC_CLEAR_CODE_FLUSH], current_.scopes[Scope::MC_CLEAR_CODE_FLUSH],
current_.scopes[Scope::MC_CLEAR_DEPENDENT_CODE], current_.scopes[Scope::MC_CLEAR_DEPENDENT_CODE],
current_.scopes[Scope::MC_CLEAR_MAPS], current_.scopes[Scope::MC_CLEAR_MAPS],
...@@ -639,9 +654,6 @@ void GCTracer::PrintNVP() const { ...@@ -639,9 +654,6 @@ void GCTracer::PrintNVP() const {
current_.scopes[Scope::MC_EVACUATE_UPDATE_POINTERS_TO_EVACUATED], current_.scopes[Scope::MC_EVACUATE_UPDATE_POINTERS_TO_EVACUATED],
current_.scopes[Scope::MC_EVACUATE_UPDATE_POINTERS_TO_NEW], current_.scopes[Scope::MC_EVACUATE_UPDATE_POINTERS_TO_NEW],
current_.scopes[Scope::MC_EVACUATE_UPDATE_POINTERS_WEAK], current_.scopes[Scope::MC_EVACUATE_UPDATE_POINTERS_WEAK],
current_.scopes[Scope::EXTERNAL_PROLOGUE],
current_.scopes[Scope::EXTERNAL_EPILOGUE],
current_.scopes[Scope::EXTERNAL_WEAK_GLOBAL_HANDLES],
current_.scopes[Scope::MC_FINISH], current_.scopes[Scope::MC_MARK], current_.scopes[Scope::MC_FINISH], current_.scopes[Scope::MC_MARK],
current_.scopes[Scope::MC_MARK_FINISH_INCREMENTAL], current_.scopes[Scope::MC_MARK_FINISH_INCREMENTAL],
current_.scopes[Scope::MC_MARK_PREPARE_CODE_FLUSH], current_.scopes[Scope::MC_MARK_PREPARE_CODE_FLUSH],
......
...@@ -36,9 +36,12 @@ enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects }; ...@@ -36,9 +36,12 @@ enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects };
#define TRACER_SCOPES(F) \ #define TRACER_SCOPES(F) \
INCREMENTAL_SCOPES(F) \ INCREMENTAL_SCOPES(F) \
F(EXTERNAL_EPILOGUE) \ F(HEAP_EPILOGUE) \
F(EXTERNAL_PROLOGUE) \ F(HEAP_EPILOGUE_REDUCE_NEW_SPACE) \
F(EXTERNAL_WEAK_GLOBAL_HANDLES) \ F(HEAP_EXTERNAL_EPILOGUE) \
F(HEAP_EXTERNAL_PROLOGUE) \
F(HEAP_EXTERNAL_WEAK_GLOBAL_HANDLES) \
F(HEAP_PROLOGUE) \
F(MC_CLEAR) \ F(MC_CLEAR) \
F(MC_CLEAR_CODE_FLUSH) \ F(MC_CLEAR_CODE_FLUSH) \
F(MC_CLEAR_DEPENDENT_CODE) \ F(MC_CLEAR_DEPENDENT_CODE) \
...@@ -371,9 +374,9 @@ class V8_EXPORT_PRIVATE GCTracer { ...@@ -371,9 +374,9 @@ class V8_EXPORT_PRIVATE GCTracer {
void PRINTF_FORMAT(2, 3) Output(const char* format, ...) const; void PRINTF_FORMAT(2, 3) Output(const char* format, ...) const;
double TotalExternalTime() const { double TotalExternalTime() const {
return current_.scopes[Scope::EXTERNAL_WEAK_GLOBAL_HANDLES] + return current_.scopes[Scope::HEAP_EXTERNAL_WEAK_GLOBAL_HANDLES] +
current_.scopes[Scope::EXTERNAL_EPILOGUE] + current_.scopes[Scope::HEAP_EXTERNAL_EPILOGUE] +
current_.scopes[Scope::EXTERNAL_PROLOGUE] + current_.scopes[Scope::HEAP_EXTERNAL_PROLOGUE] +
current_.scopes[Scope::MC_INCREMENTAL_EXTERNAL_EPILOGUE] + current_.scopes[Scope::MC_INCREMENTAL_EXTERNAL_EPILOGUE] +
current_.scopes[Scope::MC_INCREMENTAL_EXTERNAL_PROLOGUE]; current_.scopes[Scope::MC_INCREMENTAL_EXTERNAL_PROLOGUE];
} }
......
...@@ -415,6 +415,7 @@ void Heap::IncrementDeferredCount(v8::Isolate::UseCounterFeature feature) { ...@@ -415,6 +415,7 @@ void Heap::IncrementDeferredCount(v8::Isolate::UseCounterFeature feature) {
bool Heap::UncommitFromSpace() { return new_space_->UncommitFromSpace(); } bool Heap::UncommitFromSpace() { return new_space_->UncommitFromSpace(); }
void Heap::GarbageCollectionPrologue() { void Heap::GarbageCollectionPrologue() {
TRACE_GC(tracer(), GCTracer::Scope::HEAP_PROLOGUE);
{ {
AllowHeapAllocation for_the_first_part_of_prologue; AllowHeapAllocation for_the_first_part_of_prologue;
gc_count_++; gc_count_++;
...@@ -641,6 +642,7 @@ void Heap::DeoptMarkedAllocationSites() { ...@@ -641,6 +642,7 @@ void Heap::DeoptMarkedAllocationSites() {
void Heap::GarbageCollectionEpilogue() { void Heap::GarbageCollectionEpilogue() {
TRACE_GC(tracer(), GCTracer::Scope::HEAP_EPILOGUE);
// In release mode, we only zap the from space under heap verification. // In release mode, we only zap the from space under heap verification.
if (Heap::ShouldZapGarbage()) { if (Heap::ShouldZapGarbage()) {
ZapFromSpace(); ZapFromSpace();
...@@ -746,7 +748,10 @@ void Heap::GarbageCollectionEpilogue() { ...@@ -746,7 +748,10 @@ void Heap::GarbageCollectionEpilogue() {
new_space_top_after_last_gc_ = new_space()->top(); new_space_top_after_last_gc_ = new_space()->top();
last_gc_time_ = MonotonicallyIncreasingTimeInMs(); last_gc_time_ = MonotonicallyIncreasingTimeInMs();
ReduceNewSpaceSize(); {
TRACE_GC(tracer(), GCTracer::Scope::HEAP_EPILOGUE_REDUCE_NEW_SPACE);
ReduceNewSpaceSize();
}
} }
...@@ -1312,7 +1317,7 @@ bool Heap::PerformGarbageCollection( ...@@ -1312,7 +1317,7 @@ bool Heap::PerformGarbageCollection(
GCCallbacksScope scope(this); GCCallbacksScope scope(this);
if (scope.CheckReenter()) { if (scope.CheckReenter()) {
AllowHeapAllocation allow_allocation; AllowHeapAllocation allow_allocation;
TRACE_GC(tracer(), GCTracer::Scope::EXTERNAL_PROLOGUE); TRACE_GC(tracer(), GCTracer::Scope::HEAP_EXTERNAL_PROLOGUE);
VMState<EXTERNAL> state(isolate_); VMState<EXTERNAL> state(isolate_);
HandleScope handle_scope(isolate_); HandleScope handle_scope(isolate_);
CallGCPrologueCallbacks(gc_type, kNoGCCallbackFlags); CallGCPrologueCallbacks(gc_type, kNoGCCallbackFlags);
...@@ -1373,7 +1378,7 @@ bool Heap::PerformGarbageCollection( ...@@ -1373,7 +1378,7 @@ bool Heap::PerformGarbageCollection(
gc_post_processing_depth_++; gc_post_processing_depth_++;
{ {
AllowHeapAllocation allow_allocation; AllowHeapAllocation allow_allocation;
TRACE_GC(tracer(), GCTracer::Scope::EXTERNAL_WEAK_GLOBAL_HANDLES); TRACE_GC(tracer(), GCTracer::Scope::HEAP_EXTERNAL_WEAK_GLOBAL_HANDLES);
freed_global_handles = freed_global_handles =
isolate_->global_handles()->PostGarbageCollectionProcessing( isolate_->global_handles()->PostGarbageCollectionProcessing(
collector, gc_callback_flags); collector, gc_callback_flags);
...@@ -1403,7 +1408,7 @@ bool Heap::PerformGarbageCollection( ...@@ -1403,7 +1408,7 @@ bool Heap::PerformGarbageCollection(
GCCallbacksScope scope(this); GCCallbacksScope scope(this);
if (scope.CheckReenter()) { if (scope.CheckReenter()) {
AllowHeapAllocation allow_allocation; AllowHeapAllocation allow_allocation;
TRACE_GC(tracer(), GCTracer::Scope::EXTERNAL_EPILOGUE); TRACE_GC(tracer(), GCTracer::Scope::HEAP_EXTERNAL_EPILOGUE);
VMState<EXTERNAL> state(isolate_); VMState<EXTERNAL> state(isolate_);
HandleScope handle_scope(isolate_); HandleScope handle_scope(isolate_);
CallGCEpilogueCallbacks(gc_type, gc_callback_flags); CallGCEpilogueCallbacks(gc_type, gc_callback_flags);
......
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