[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/+/2289771 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Dominik Inführ <dinfuehr@chromium.org> Cr-Commit-Position: refs/heads/master@{#68754}
This commit is contained in:
parent
f4b3a59c08
commit
273f4e42e3
@ -347,7 +347,7 @@ Page* PagedSpace::Expand() {
|
||||
Page* PagedSpace::ExpandBackground(LocalHeap* local_heap) {
|
||||
Page* page = AllocatePage();
|
||||
if (page == nullptr) return nullptr;
|
||||
ParkedMutexGuard lock(local_heap, &allocation_mutex_);
|
||||
base::MutexGuard lock(&allocation_mutex_);
|
||||
AddPage(page);
|
||||
Free(page->area_start(), page->area_size(),
|
||||
SpaceAccountingMode::kSpaceAccounted);
|
||||
@ -580,7 +580,7 @@ PagedSpace::SlowGetLinearAllocationAreaBackground(LocalHeap* local_heap,
|
||||
// First try to refill the free-list, concurrent sweeper threads
|
||||
// may have freed some objects in the meantime.
|
||||
{
|
||||
ParkedMutexGuard lock(local_heap, &allocation_mutex_);
|
||||
base::MutexGuard lock(&allocation_mutex_);
|
||||
RefillFreeList();
|
||||
}
|
||||
|
||||
@ -599,7 +599,7 @@ PagedSpace::SlowGetLinearAllocationAreaBackground(LocalHeap* local_heap,
|
||||
invalidated_slots_in_free_space);
|
||||
|
||||
{
|
||||
ParkedMutexGuard lock(local_heap, &allocation_mutex_);
|
||||
base::MutexGuard lock(&allocation_mutex_);
|
||||
RefillFreeList();
|
||||
}
|
||||
|
||||
@ -631,7 +631,7 @@ PagedSpace::TryAllocationFromFreeListBackground(LocalHeap* local_heap,
|
||||
size_t max_size_in_bytes,
|
||||
AllocationAlignment alignment,
|
||||
AllocationOrigin origin) {
|
||||
ParkedMutexGuard lock(local_heap, &allocation_mutex_);
|
||||
base::MutexGuard lock(&allocation_mutex_);
|
||||
DCHECK_LE(min_size_in_bytes, max_size_in_bytes);
|
||||
DCHECK_EQ(identity(), OLD_SPACE);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user