Commit 3f6686c2 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[heap] Initialize the heap tear down at the beginning of Isolate::Deinit

Code in Isolate::Deinit may trigger a GC, e.g. wasm_engine()->TearDown.
However, the gin platform in Chrome does not allow to post tasks within
Isolate::Deinit. By initializing heap tear down at the beginning of
Isolate::Deinit, we can make that no tasks are posted anymore within
Isolate::Deinit.

R=ulan@chromium.org

Bug: chromium:826105
Change-Id: I246c324aa23efe82cc8e7059a1cae5efca33a1b0
Reviewed-on: https://chromium-review.googlesource.com/983598
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52283}
parent 651a7901
......@@ -5991,8 +5991,10 @@ void Heap::RegisterExternallyReferencedObject(Object** object) {
}
}
void Heap::StartTearDown() { SetGCState(TEAR_DOWN); }
void Heap::TearDown() {
SetGCState(TEAR_DOWN);
DCHECK_EQ(gc_state_, TEAR_DOWN);
#ifdef VERIFY_HEAP
if (FLAG_verify_heap) {
Verify();
......
......@@ -978,6 +978,9 @@ class Heap {
// Create ObjectStats if live_object_stats_ or dead_object_stats_ are nullptr.
void CreateObjectStats();
// Sets the TearDown state, so no new GC tasks get posted.
void StartTearDown();
// Destroys all memory allocated by the heap.
void TearDown();
......
......@@ -2625,6 +2625,7 @@ void Isolate::ClearSerializerData() {
void Isolate::Deinit() {
TRACE_ISOLATE(deinit);
heap_.StartTearDown();
debug()->Unload();
if (concurrent_recompilation_enabled()) {
......
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