Reviewers: Michael Lippautz,
Description:
[heap] Hide GCTracer inside the heap component.
This prevents leakage of the gc-tracer.h declarations inside of the
heap and prevents it from being exposed to the world. Protects private
state from being inadvertently mocked with.
[email protected]
Please review this at https://codereview.chromium.org/1294763004/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+16, -10 lines):
M src/heap/heap.h
M src/heap/heap.cc
M src/heap/incremental-marking.cc
M src/heap/mark-compact.cc
M src/heap/memory-reducer.cc
M test/cctest/test-gc-tracer.cc
M test/cctest/test-heap.cc
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index
3ae588f1dbadc7a58dd49c61b1f038092b8e4db6..92324c1bbda02c0f90bb4b0b5a1a7bc4e7e041c8
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) {
Index: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index
d4248079e72dbb1bc57f1c3af8b644ca86ea1900..da52d3ce8df7ef4ec29cc58239c3a709e8b1db87
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();
@@ -2097,7 +2096,7 @@ class Heap {
int deferred_counters_[v8::Isolate::kUseCounterFeatureCount];
- GCTracer tracer_;
+ GCTracer* tracer_;
// Creates and installs the full-sized number string cache.
int FullSizeNumberStringCacheLength();
Index: src/heap/incremental-marking.cc
diff --git a/src/heap/incremental-marking.cc
b/src/heap/incremental-marking.cc
index
544ee7458baf075324f7f5220506171bfc44289f..c7b3eac190b54cb5792b6d5aada0cd0d03f30043
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"
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index
6a0c9d58cd3d852f7a8f4228d339b3127a1e99fa..eef49636c48da6dbc7db9e32d97f471d78ba5859
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"
Index: src/heap/memory-reducer.cc
diff --git a/src/heap/memory-reducer.cc b/src/heap/memory-reducer.cc
index
3f2862df3b0c0f78029e73489fa848c33755f8b8..f3c14731e7cb777793643a39f86536dc082eb2b4
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"
Index: test/cctest/test-gc-tracer.cc
diff --git a/test/cctest/test-gc-tracer.cc b/test/cctest/test-gc-tracer.cc
index
190644dec1e58e34e0db982c1abe1d7728f45d28..1289ec5cea958a714b9a29d744bdf79fd6eb6057
100644
--- a/test/cctest/test-gc-tracer.cc
+++ b/test/cctest/test-gc-tracer.cc
@@ -28,8 +28,7 @@
#include <stdlib.h>
#include <utility>
-#include "src/v8.h"
-
+#include "src/heap/gc-tracer.h"
#include "test/cctest/cctest.h"
using namespace v8::internal;
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index
1c09752b726e4a2cfe32ff36b698086edc60b78c..e5533b676b4301c3459b212761198063cee92da3
100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -28,14 +28,13 @@
#include <stdlib.h>
#include <utility>
-#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"
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.