[heap] Stop allocation in StressConcurrentAllocatorTask on tear down

StressConcurrentAllocatorTask now checks whether tear down was started
for the isolate to avoid allocation failures.

As a drive-by change remove the unused method
ConcurrentAllocator::PerformCollectionAndAllocateAgain.

Bug: v8:10315
Change-Id: Iba329ebbd782e9f8f11e9b8ec644bf28ab9c80ab
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2423703
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70044}
This commit is contained in:
Dominik Inführ 2020-09-22 11:01:45 +02:00 committed by Commit Bot
parent a0afb01145
commit 5b7cb7f4eb
2 changed files with 3 additions and 24 deletions

View File

@ -27,6 +27,9 @@ void StressConcurrentAllocatorTask::RunInternal() {
MemoryChunkLayout::ObjectStartOffsetInDataPage());
for (int i = 0; i < kNumIterations; i++) {
// Isolate tear down started, stop allocation...
if (heap->gc_state() == Heap::TEAR_DOWN) return;
Address address = local_heap.AllocateRawOrFail(
kSmallObjectSize, AllocationType::kOld, AllocationOrigin::kRuntime,
AllocationAlignment::kWordAligned);
@ -62,27 +65,6 @@ void StressConcurrentAllocatorTask::Schedule(Isolate* isolate) {
kDelayInSeconds);
}
Address ConcurrentAllocator::PerformCollectionAndAllocateAgain(
int object_size, AllocationAlignment alignment, AllocationOrigin origin) {
Heap* heap = local_heap_->heap();
local_heap_->allocation_failed_ = true;
for (int i = 0; i < 3; i++) {
{
ParkedScope scope(local_heap_);
heap->RequestAndWaitForCollection();
}
AllocationResult result = AllocateRaw(object_size, alignment, origin);
if (!result.IsRetry()) {
local_heap_->allocation_failed_ = false;
return result.ToObjectChecked().address();
}
}
heap->FatalProcessOutOfMemory("ConcurrentAllocator: allocation failed");
}
void ConcurrentAllocator::FreeLinearAllocationArea() {
lab_.CloseAndMakeIterable();
}

View File

@ -63,9 +63,6 @@ class ConcurrentAllocator {
V8_EXPORT_PRIVATE AllocationResult AllocateOutsideLab(
int object_size, AllocationAlignment alignment, AllocationOrigin origin);
V8_EXPORT_PRIVATE Address PerformCollectionAndAllocateAgain(
int object_size, AllocationAlignment alignment, AllocationOrigin origin);
LocalHeap* const local_heap_;
PagedSpace* const space_;
LocalAllocationBuffer lab_;