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

[heap] Make PagedSpace::Available lock mutex

Isolate::GetHeapStatistics uses PagedSpace::Available, which races
with allocating background threads.

Bug: v8:10315
Change-Id: I6e0dc37d90e0c7a3e3dd2b8bdb77f2ea82372c13
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2349294Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69337}
parent 44c6e9f6
...@@ -433,6 +433,17 @@ void PagedSpace::MakeLinearAllocationAreaIterable() { ...@@ -433,6 +433,17 @@ void PagedSpace::MakeLinearAllocationAreaIterable() {
} }
} }
size_t PagedSpace::Available() {
base::Optional<base::MutexGuard> optional_mutex;
if (FLAG_concurrent_allocation && identity() == OLD_SPACE &&
!is_local_space()) {
optional_mutex.emplace(&allocation_mutex_);
}
return free_list_->Available();
}
void PagedSpace::FreeLinearAllocationArea() { void PagedSpace::FreeLinearAllocationArea() {
// Mark the old linear allocation area with a free space map so it can be // Mark the old linear allocation area with a free space map so it can be
// skipped when scanning the heap. // skipped when scanning the heap.
......
...@@ -112,7 +112,7 @@ class V8_EXPORT_PRIVATE PagedSpace ...@@ -112,7 +112,7 @@ class V8_EXPORT_PRIVATE PagedSpace
// The bytes in the linear allocation area are not included in this total // The bytes in the linear allocation area are not included in this total
// because updating the stats would slow down allocation. New pages are // because updating the stats would slow down allocation. New pages are
// immediately added to the free list so they show up here. // immediately added to the free list so they show up here.
size_t Available() override { return free_list_->Available(); } size_t Available() override;
// Allocated bytes in this space. Garbage bytes that were not found due to // Allocated bytes in this space. Garbage bytes that were not found due to
// concurrent sweeping are counted as being allocated! The bytes in the // concurrent sweeping are counted as being allocated! The bytes in the
......
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