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

[unified-heap] Fix termination sequence for EmbedderHeapTracer

Garbage collection needs to be finalized before unsetting the
EmbedderHeapTracer pointer.

Otherwise, an already running GC may not be properly finalized and the
GC is left in a undefined state which the subsequent follow up GCs
discover.

Bug: 843903
Change-Id: I4dc73005174a1b99dfda96ef379fe62bf5b34dbe
Reviewed-on: https://chromium-review.googlesource.com/1243247Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594024}
parent 5d741ba9
...@@ -162,6 +162,13 @@ void V8PerIsolateData::WillBeDestroyed(v8::Isolate* isolate) { ...@@ -162,6 +162,13 @@ void V8PerIsolateData::WillBeDestroyed(v8::Isolate* isolate) {
data->active_script_wrappables_.Clear(); data->active_script_wrappables_.Clear();
// Detach V8's garbage collector. // Detach V8's garbage collector.
if (RuntimeEnabledFeatures::HeapUnifiedGarbageCollectionEnabled()) {
// Need to finalize an already running garbage collection as otherwise
// callbacks are missing and state gets out of sync.
ThreadState::Current()->FinishIncrementalMarkingIfRunning(
BlinkGC::kHeapPointersOnStack, BlinkGC::kAtomicMarking,
BlinkGC::kEagerSweeping, BlinkGC::GCReason::kThreadTerminationGC);
}
isolate->SetEmbedderHeapTracer(nullptr); isolate->SetEmbedderHeapTracer(nullptr);
if (data->script_wrappable_visitor_->WrapperTracingInProgress()) if (data->script_wrappable_visitor_->WrapperTracingInProgress())
data->script_wrappable_visitor_->AbortTracing(); data->script_wrappable_visitor_->AbortTracing();
......
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