From d75023f3a1f24498b05c361a62a7513e0918edcb Mon Sep 17 00:00:00 2001 From: mlippautz Date: Tue, 3 Jan 2017 11:20:34 -0800 Subject: [PATCH] [heap] Enter final pause for embedder tracer in MarkLiveObjects MarkCompactCollector::Prepare is too early in the rare case that we don't have a marking deque yet. EnterFinalPause could then trigger Heap::RegisterExternallyReferencedObject which rightfully fails because MC is not properly set up. Note that the DCHECK also triggers, without actual consequences, for aborting incremental marking. BUG=468240 TBR=jochen@chromium.org Review-Url: https://codereview.chromium.org/2611753002 Cr-Commit-Position: refs/heads/master@{#42044} --- src/heap/mark-compact.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc index 41e8d03147..427185a5c8 100644 --- a/src/heap/mark-compact.cc +++ b/src/heap/mark-compact.cc @@ -806,8 +806,6 @@ void MarkCompactCollector::Prepare() { heap_->local_embedder_heap_tracer()->TracePrologue(); } - heap_->local_embedder_heap_tracer()->EnterFinalPause(); - // Don't start compaction if we are in the middle of incremental // marking cycle. We did not collect any slots. if (!FLAG_never_compact && !was_marked_incrementally_) { @@ -2440,6 +2438,8 @@ void MarkCompactCollector::MarkLiveObjects() { marking_deque()->StartUsing(); + heap_->local_embedder_heap_tracer()->EnterFinalPause(); + { TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_PREPARE_CODE_FLUSH); PrepareForCodeFlushing();