Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1093)

Unified Diff: src/heap/mark-compact.cc

Issue 2371733002: Introduce EmbedderReachableReferenceReporter (Closed)
Patch Set: Fix UsingEmbedderHeapTracer Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/mark-compact.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index 08472e5b10448949ef761f91de3fbdaedeead34b..2b504e56d58fdd8740d9af92885d68f2b65693de 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -61,7 +61,6 @@ MarkCompactCollector::MarkCompactCollector(Heap* heap)
marking_deque_memory_(NULL),
marking_deque_memory_committed_(0),
code_flusher_(nullptr),
- embedder_heap_tracer_(nullptr),
sweeper_(heap) {
}
@@ -809,7 +808,7 @@ void MarkCompactCollector::Prepare() {
AbortTransitionArrays();
AbortCompaction();
if (heap_->UsingEmbedderHeapTracer()) {
- heap_->mark_compact_collector()->embedder_heap_tracer()->AbortTracing();
+ heap_->embedder_heap_tracer()->AbortTracing();
}
was_marked_incrementally_ = false;
}
@@ -817,12 +816,13 @@ void MarkCompactCollector::Prepare() {
if (!was_marked_incrementally_) {
if (heap_->UsingEmbedderHeapTracer()) {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WRAPPER_PROLOGUE);
- heap_->mark_compact_collector()->embedder_heap_tracer()->TracePrologue();
+ heap_->embedder_heap_tracer()->TracePrologue(
+ heap_->embedder_reachable_reference_reporter());
}
}
- if (UsingEmbedderHeapTracer()) {
- embedder_heap_tracer()->EnterFinalPause();
+ if (heap_->UsingEmbedderHeapTracer()) {
+ heap_->embedder_heap_tracer()->EnterFinalPause();
}
// Don't start compaction if we are in the middle of incremental
@@ -2085,10 +2085,10 @@ void MarkCompactCollector::ProcessEphemeralMarking(
DCHECK(marking_deque_.IsEmpty() && !marking_deque_.overflowed());
bool work_to_do = true;
while (work_to_do) {
- if (UsingEmbedderHeapTracer()) {
+ if (heap_->UsingEmbedderHeapTracer()) {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WRAPPER_TRACING);
- RegisterWrappersWithEmbedderHeapTracer();
- embedder_heap_tracer()->AdvanceTracing(
+ heap_->RegisterWrappersWithEmbedderHeapTracer();
+ heap_->embedder_heap_tracer()->AdvanceTracing(
0, EmbedderHeapTracer::AdvanceTracingActions(
EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION));
}
@@ -2202,39 +2202,6 @@ void MarkingDeque::Uninitialize(bool aborting) {
in_use_ = false;
}
-void MarkCompactCollector::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) {
- DCHECK_NOT_NULL(tracer);
- CHECK_NULL(embedder_heap_tracer_);
- embedder_heap_tracer_ = tracer;
-}
-
-bool MarkCompactCollector::RequiresImmediateWrapperProcessing() {
- const size_t kTooManyWrappers = 16000;
- return wrappers_to_trace_.size() > kTooManyWrappers;
-}
-
-void MarkCompactCollector::RegisterWrappersWithEmbedderHeapTracer() {
- DCHECK(UsingEmbedderHeapTracer());
- if (wrappers_to_trace_.empty()) {
- return;
- }
- embedder_heap_tracer()->RegisterV8References(wrappers_to_trace_);
- wrappers_to_trace_.clear();
-}
-
-void MarkCompactCollector::TracePossibleWrapper(JSObject* js_object) {
- DCHECK(js_object->WasConstructedFromApiFunction());
- if (js_object->GetInternalFieldCount() >= 2 &&
- js_object->GetInternalField(0) &&
- js_object->GetInternalField(0) != heap_->undefined_value() &&
- js_object->GetInternalField(1) != heap_->undefined_value()) {
- DCHECK(reinterpret_cast<intptr_t>(js_object->GetInternalField(0)) % 2 == 0);
- wrappers_to_trace_.push_back(std::pair<void*, void*>(
- reinterpret_cast<void*>(js_object->GetInternalField(0)),
- reinterpret_cast<void*>(js_object->GetInternalField(1))));
- }
-}
-
class MarkCompactCollector::ObjectStatsVisitor
: public MarkCompactCollector::HeapObjectVisitor {
public:
@@ -2376,9 +2343,9 @@ void MarkCompactCollector::MarkLiveObjects() {
{
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WEAK_CLOSURE_HARMONY);
ProcessEphemeralMarking(&root_visitor, true);
- if (UsingEmbedderHeapTracer()) {
+ if (heap_->UsingEmbedderHeapTracer()) {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WRAPPER_EPILOGUE);
- embedder_heap_tracer()->TraceEpilogue();
+ heap()->embedder_heap_tracer()->TraceEpilogue();
}
}
}
« no previous file with comments | « src/heap/mark-compact.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698