diff --git a/src/heap/heap.cc b/src/heap/heap.cc index 1586a004c4..467a220761 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc @@ -18,6 +18,7 @@ #include "src/deoptimizer.h" #include "src/global-handles.h" #include "src/heap/gc-idle-time-handler.h" +#include "src/heap/gc-tracer.h" #include "src/heap/incremental-marking.h" #include "src/heap/mark-compact-inl.h" #include "src/heap/mark-compact.h" @@ -97,7 +98,7 @@ Heap::Heap() inline_allocation_disabled_(false), store_buffer_rebuilder_(store_buffer()), total_regexp_code_generated_(0), - tracer_(this), + tracer_(nullptr), high_survival_rate_period_length_(0), promoted_objects_size_(0), promotion_ratio_(0), @@ -5806,6 +5807,7 @@ bool Heap::SetUp() { deferred_counters_[i] = 0; } + tracer_ = new GCTracer(this); LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); LOG(isolate_, IntPtrTEvent("heap-available", Available())); @@ -5878,8 +5880,9 @@ void Heap::TearDown() { PrintF("total_gc_time=%.1f ", total_gc_time_ms_); PrintF("min_in_mutator=%.1f ", get_min_in_mutator()); PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ", get_max_alive_after_gc()); - PrintF("total_marking_time=%.1f ", tracer_.cumulative_marking_duration()); - PrintF("total_sweeping_time=%.1f ", tracer_.cumulative_sweeping_duration()); + PrintF("total_marking_time=%.1f ", tracer()->cumulative_marking_duration()); + PrintF("total_sweeping_time=%.1f ", + tracer()->cumulative_sweeping_duration()); PrintF("\n\n"); } @@ -5914,6 +5917,9 @@ void Heap::TearDown() { mark_compact_collector()->TearDown(); + delete tracer_; + tracer_ = nullptr; + new_space_.TearDown(); if (old_space_ != NULL) { diff --git a/src/heap/heap.h b/src/heap/heap.h index a4268e5324..6791ecf673 100644 --- a/src/heap/heap.h +++ b/src/heap/heap.h @@ -12,7 +12,6 @@ #include "src/assert-scope.h" #include "src/globals.h" #include "src/heap/gc-idle-time-handler.h" -#include "src/heap/gc-tracer.h" #include "src/heap/incremental-marking.h" #include "src/heap/mark-compact.h" #include "src/heap/memory-reducer.h" @@ -1344,7 +1343,7 @@ class Heap { void ClearNormalizedMapCaches(); - GCTracer* tracer() { return &tracer_; } + GCTracer* tracer() { return tracer_; } // Returns the size of objects residing in non new spaces. intptr_t PromotedSpaceSizeOfObjects(); @@ -2098,7 +2097,7 @@ class Heap { int deferred_counters_[v8::Isolate::kUseCounterFeatureCount]; - GCTracer tracer_; + GCTracer* tracer_; // Creates and installs the full-sized number string cache. int FullSizeNumberStringCacheLength(); diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc index 544ee7458b..c7b3eac190 100644 --- a/src/heap/incremental-marking.cc +++ b/src/heap/incremental-marking.cc @@ -7,6 +7,7 @@ #include "src/code-stubs.h" #include "src/compilation-cache.h" #include "src/conversions.h" +#include "src/heap/gc-tracer.h" #include "src/heap/mark-compact-inl.h" #include "src/heap/objects-visiting.h" #include "src/heap/objects-visiting-inl.h" diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc index ab00782ca9..de37ecbe30 100644 --- a/src/heap/mark-compact.cc +++ b/src/heap/mark-compact.cc @@ -14,6 +14,7 @@ #include "src/frames-inl.h" #include "src/gdb-jit.h" #include "src/global-handles.h" +#include "src/heap/gc-tracer.h" #include "src/heap/incremental-marking.h" #include "src/heap/mark-compact-inl.h" #include "src/heap/objects-visiting.h" diff --git a/src/heap/memory-reducer.cc b/src/heap/memory-reducer.cc index 3f2862df3b..f3c14731e7 100644 --- a/src/heap/memory-reducer.cc +++ b/src/heap/memory-reducer.cc @@ -5,6 +5,7 @@ #include "src/heap/memory-reducer.h" #include "src/flags.h" +#include "src/heap/gc-tracer.h" #include "src/heap/heap.h" #include "src/objects-inl.h" // TODO(mstarzinger): Temporary cycle breaker! #include "src/utils.h" diff --git a/test/cctest/test-gc-tracer.cc b/test/cctest/test-gc-tracer.cc index 190644dec1..1289ec5cea 100644 --- a/test/cctest/test-gc-tracer.cc +++ b/test/cctest/test-gc-tracer.cc @@ -28,8 +28,7 @@ #include #include -#include "src/v8.h" - +#include "src/heap/gc-tracer.h" #include "test/cctest/cctest.h" using namespace v8::internal; diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc index 1c09752b72..e5533b676b 100644 --- a/test/cctest/test-heap.cc +++ b/test/cctest/test-heap.cc @@ -28,14 +28,13 @@ #include #include -#include "src/v8.h" - #include "src/compilation-cache.h" #include "src/context-measure.h" #include "src/deoptimizer.h" #include "src/execution.h" #include "src/factory.h" #include "src/global-handles.h" +#include "src/heap/gc-tracer.h" #include "src/ic/ic.h" #include "src/macro-assembler.h" #include "src/snapshot/snapshot.h"