Commit 273f4e42 authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

[heap] Avoid ParkedMutexGuard during allocation

Since main thread allocation does not start incremental marking anymore
while holding allocation_mutex_, background allocation does not need
ParkedMutexGuard anymore to avoid deadlocks.

This also means background thread allocation isn't paused anymore to
perform a GC, which already resulted in subtle bugs (e.g. in
ExpandBackground with incremental marking). We also do not
stop-the-world anymore while holding allocation_mutex_.

Bug: v8:10315
Change-Id: Iadf00bc26434c765722b82a10497ab06151f15cc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2289771Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68754}
parent f4b3a59c
...@@ -347,7 +347,7 @@ Page* PagedSpace::Expand() { ...@@ -347,7 +347,7 @@ Page* PagedSpace::Expand() {
Page* PagedSpace::ExpandBackground(LocalHeap* local_heap) { Page* PagedSpace::ExpandBackground(LocalHeap* local_heap) {
Page* page = AllocatePage(); Page* page = AllocatePage();
if (page == nullptr) return nullptr; if (page == nullptr) return nullptr;
ParkedMutexGuard lock(local_heap, &allocation_mutex_); base::MutexGuard lock(&allocation_mutex_);
AddPage(page); AddPage(page);
Free(page->area_start(), page->area_size(), Free(page->area_start(), page->area_size(),
SpaceAccountingMode::kSpaceAccounted); SpaceAccountingMode::kSpaceAccounted);
...@@ -580,7 +580,7 @@ PagedSpace::SlowGetLinearAllocationAreaBackground(LocalHeap* local_heap, ...@@ -580,7 +580,7 @@ PagedSpace::SlowGetLinearAllocationAreaBackground(LocalHeap* local_heap,
// First try to refill the free-list, concurrent sweeper threads // First try to refill the free-list, concurrent sweeper threads
// may have freed some objects in the meantime. // may have freed some objects in the meantime.
{ {
ParkedMutexGuard lock(local_heap, &allocation_mutex_); base::MutexGuard lock(&allocation_mutex_);
RefillFreeList(); RefillFreeList();
} }
...@@ -599,7 +599,7 @@ PagedSpace::SlowGetLinearAllocationAreaBackground(LocalHeap* local_heap, ...@@ -599,7 +599,7 @@ PagedSpace::SlowGetLinearAllocationAreaBackground(LocalHeap* local_heap,
invalidated_slots_in_free_space); invalidated_slots_in_free_space);
{ {
ParkedMutexGuard lock(local_heap, &allocation_mutex_); base::MutexGuard lock(&allocation_mutex_);
RefillFreeList(); RefillFreeList();
} }
...@@ -631,7 +631,7 @@ PagedSpace::TryAllocationFromFreeListBackground(LocalHeap* local_heap, ...@@ -631,7 +631,7 @@ PagedSpace::TryAllocationFromFreeListBackground(LocalHeap* local_heap,
size_t max_size_in_bytes, size_t max_size_in_bytes,
AllocationAlignment alignment, AllocationAlignment alignment,
AllocationOrigin origin) { AllocationOrigin origin) {
ParkedMutexGuard lock(local_heap, &allocation_mutex_); base::MutexGuard lock(&allocation_mutex_);
DCHECK_LE(min_size_in_bytes, max_size_in_bytes); DCHECK_LE(min_size_in_bytes, max_size_in_bytes);
DCHECK_EQ(identity(), OLD_SPACE); DCHECK_EQ(identity(), OLD_SPACE);
......
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