Commit 1e546a49 authored by Bill Budge's avatar Bill Budge Committed by Commit Bot

Revert "[heap] Allow LocalHeap on the main thread"

This reverts commit bebb2bdc.

Reason for revert: Breaks GarbageCollectionWithLocalHeap test.
https://ci.chromium.org/p/v8/builders/ci/V8%20Linux%20-%20debug/31107

Original change's description:
> [heap] Allow LocalHeap on the main thread
> 
> This changes the safepoint scope to skip LocalHeap that is active
> for the current thread to avoid deadlocking.
> 
> Bug: v8:10315
> Change-Id: I45e80ae66d0dbbe768107aa9cf0603204c644d9f
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2289983
> Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
> Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#68769}

TBR=ulan@chromium.org,dinfuehr@chromium.org

Change-Id: Ifba8218f9104afed3f2d92258296067f8f424062
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:10315
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2290573Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68770}
parent bebb2bdc
......@@ -23,25 +23,17 @@ void GlobalSafepoint::EnterSafepointScope() {
if (!FLAG_local_heaps) return;
if (++active_safepoint_scopes_ > 1) return;
local_heaps_mutex_.Lock();
local_heap_of_this_thread_ = LocalHeap::Current();
barrier_.Arm();
for (LocalHeap* current = local_heaps_head_; current;
current = current->next_) {
if (current == local_heap_of_this_thread_) {
continue;
}
current->RequestSafepoint();
}
for (LocalHeap* current = local_heaps_head_; current;
current = current->next_) {
if (current == local_heap_of_this_thread_) {
continue;
}
current->state_mutex_.Lock();
while (current->state_ == LocalHeap::ThreadState::Running) {
......@@ -56,19 +48,13 @@ void GlobalSafepoint::LeaveSafepointScope() {
DCHECK_GT(active_safepoint_scopes_, 0);
if (--active_safepoint_scopes_ > 0) return;
DCHECK_EQ(local_heap_of_this_thread_, LocalHeap::Current());
for (LocalHeap* current = local_heaps_head_; current;
current = current->next_) {
if (current == local_heap_of_this_thread_) {
continue;
}
current->state_mutex_.Unlock();
}
barrier_.Disarm();
local_heap_of_this_thread_ = nullptr;
local_heaps_mutex_.Unlock();
}
......
......@@ -77,8 +77,6 @@ class GlobalSafepoint {
int active_safepoint_scopes_;
LocalHeap* local_heap_of_this_thread_;
friend class SafepointScope;
friend class LocalHeap;
friend class PersistentHandles;
......
......@@ -7141,22 +7141,6 @@ HEAP_TEST(GCDuringOffThreadMergeWithTransferHandle) {
CHECK_EQ(transfer_handle.ToHandle()->length(), 10);
}
TEST(GarbageCollectionWithLocalHeap) {
FLAG_local_heaps = true;
ManualGCScope manual_gc_scope;
CcTest::InitializeVM();
Heap* heap = CcTest::i_isolate()->heap();
LocalHeap local_heap(heap);
CcTest::CollectGarbage(OLD_SPACE);
{
ParkedScope parked_scope(&local_heap);
CcTest::CollectGarbage(OLD_SPACE);
}
CcTest::CollectGarbage(OLD_SPACE);
}
} // namespace heap
} // namespace internal
} // namespace v8
......
......@@ -138,24 +138,5 @@ TEST_F(SafepointTest, StopRunningThreads) {
CHECK_EQ(safepoint_count, kRuns * kSafepoints);
}
TEST_F(SafepointTest, SkipLocalHeapOfThisThread) {
Heap* heap = i_isolate()->heap();
FLAG_local_heaps = true;
LocalHeap local_heap(heap);
{
SafepointScope scope(heap);
local_heap.Safepoint();
}
{
ParkedScope parked_scope(&local_heap);
SafepointScope scope(heap);
local_heap.Safepoint();
}
{
SafepointScope scope(heap);
local_heap.Safepoint();
}
}
} // 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