[heap, isolate] Add Heap::TearDownWithSharedHeap()
When invoking Heap::TearDown() the isolate detached from the shared heap. However there is some data in Heap which indirectly uses the shared heap (e.g. through the external pointer table). For such cases this CL adds Heap::TearDownWithSharedHeap() which is invoked while the isolate is still being attached to the shared heap. Bug: v8:11708, v8:13353 Change-Id: Ib9d7b36b9069b182c265dd93257b4fa6fdfb1055 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3932070 Commit-Queue: Dominik Inführ <dinfuehr@chromium.org> Reviewed-by: Patrick Thier <pthier@chromium.org> Reviewed-by: Igor Sheludko <ishell@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/main@{#83541}
This commit is contained in:
parent
3dce6253b8
commit
82708bbd0f
@ -3629,6 +3629,9 @@ void Isolate::Deinit() {
|
||||
// At this point there are no more background threads left in this isolate.
|
||||
heap_.safepoint()->AssertMainThreadIsOnlyThread();
|
||||
|
||||
// Tear down data using the shared heap before detaching.
|
||||
heap_.TearDownWithSharedHeap();
|
||||
|
||||
{
|
||||
// This isolate might have to park for a shared GC initiated by another
|
||||
// client isolate before it can actually detach from the shared isolate.
|
||||
|
@ -5910,6 +5910,17 @@ void Heap::StartTearDown() {
|
||||
}
|
||||
}
|
||||
|
||||
void Heap::TearDownWithSharedHeap() {
|
||||
DCHECK_EQ(gc_state(), TEAR_DOWN);
|
||||
|
||||
// Assert that there are no background threads left and no executable memory
|
||||
// chunks are unprotected.
|
||||
safepoint()->AssertMainThreadIsOnlyThread();
|
||||
|
||||
// Might use the external pointer which might be in the shared heap.
|
||||
external_string_table_.TearDown();
|
||||
}
|
||||
|
||||
void Heap::TearDown() {
|
||||
DCHECK_EQ(gc_state(), TEAR_DOWN);
|
||||
|
||||
@ -6004,8 +6015,6 @@ void Heap::TearDown() {
|
||||
cpp_heap_ = nullptr;
|
||||
}
|
||||
|
||||
external_string_table_.TearDown();
|
||||
|
||||
tracer_.reset();
|
||||
|
||||
allocation_sites_to_pretenure_.reset();
|
||||
|
@ -863,6 +863,9 @@ class Heap {
|
||||
// Sets the TearDown state, so no new GC tasks get posted.
|
||||
void StartTearDown();
|
||||
|
||||
// Destroys all data that might require the shared heap.
|
||||
void TearDownWithSharedHeap();
|
||||
|
||||
// Destroys all memory allocated by the heap.
|
||||
void TearDown();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user