Commit 2aa166a6 authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

[heap] Clear ephemeron worklist when tearing down

Bug: chromium:852308, chromium:844008
Change-Id: I99551c1f75d5916edfb780998963140b8282a570
Reviewed-on: https://chromium-review.googlesource.com/1099065
Commit-Queue: Dominik Inführ <dinfuehr@google.com>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53706}
parent 418bf412
......@@ -781,7 +781,6 @@ void MarkCompactCollector::Prepare() {
FinishConcurrentMarking(ConcurrentMarking::StopRequest::PREEMPT_TASKS);
heap()->incremental_marking()->Deactivate();
ClearMarkbits();
AbortWeakCollections();
AbortWeakObjects();
AbortCompaction();
heap_->local_embedder_heap_tracer()->AbortTracing();
......@@ -1912,10 +1911,6 @@ void MarkCompactCollector::ClearWeakCollections() {
}
}
void MarkCompactCollector::AbortWeakCollections() {
weak_objects_.ephemeron_hash_tables.Clear();
}
void MarkCompactCollector::ClearWeakCells() {
Heap* heap = this->heap();
TRACE_GC(heap->tracer(), GCTracer::Scope::MC_CLEAR_WEAK_CELLS);
......@@ -1981,6 +1976,7 @@ void MarkCompactCollector::ClearWeakReferences() {
void MarkCompactCollector::AbortWeakObjects() {
weak_objects_.weak_cells.Clear();
weak_objects_.transition_arrays.Clear();
weak_objects_.ephemeron_hash_tables.Clear();
weak_objects_.weak_references.Clear();
weak_objects_.weak_objects_in_code.Clear();
}
......
......@@ -736,10 +736,6 @@ class MarkCompactCollector final : public MarkCompactCollectorBase {
// The linked list of all encountered weak maps is destroyed.
void ClearWeakCollections();
// We have to remove all encountered weak maps from the list of weak
// collections when incremental marking is aborted.
void AbortWeakCollections();
// Goes through the list of encountered weak cells and clears those with
// dead values. If the value is a dead map and the parent map transitions to
// the dead map via weak cell, then this function also clears the map
......
......@@ -2675,6 +2675,7 @@ void Isolate::Deinit() {
delete compiler_dispatcher_;
compiler_dispatcher_ = nullptr;
// This stops cancelable tasks (i.e. concurrent masking tasks)
cancelable_task_manager()->CancelAndWait();
heap_.TearDown();
......
......@@ -117,6 +117,32 @@ TEST(ConcurrentMarkingMarkedBytes) {
CHECK_GE(heap->concurrent_marking()->TotalMarkedBytes(), root->Size());
}
UNINITIALIZED_TEST(ConcurrentMarkingStoppedOnTeardown) {
if (!i::FLAG_concurrent_marking) return;
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
{
Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate);
Factory* factory = i_isolate->factory();
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
v8::Context::New(isolate)->Enter();
for (int i = 0; i < 10000; i++) {
factory->NewJSWeakMap();
}
Heap* heap = i_isolate->heap();
heap::SimulateIncrementalMarking(heap, false);
}
isolate->Dispose();
}
} // namespace heap
} // namespace internal
} // namespace v8
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