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

[heap] Make stress_concurrent_allocation more resilient against OOM

Allow all allocations to fail in StressConcurrentAllocatorTask, this
still stresses the concurrent allocation code path but makes
--stress-concurrent-allocation more resilient against OOM. In case the
allocation fails try to start a GC.

Bug: v8:9337
Change-Id: I3633687d67d3a135114a3ea46b5238378153f377
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2797280Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73802}
parent 7a17ddf4
...@@ -34,19 +34,26 @@ void StressConcurrentAllocatorTask::RunInternal() { ...@@ -34,19 +34,26 @@ void StressConcurrentAllocatorTask::RunInternal() {
// Isolate tear down started, stop allocation... // Isolate tear down started, stop allocation...
if (heap->gc_state() == Heap::TEAR_DOWN) return; if (heap->gc_state() == Heap::TEAR_DOWN) return;
Address address = local_heap.AllocateRawOrFail( AllocationResult result = local_heap.AllocateRaw(
kSmallObjectSize, AllocationType::kOld, AllocationOrigin::kRuntime, kSmallObjectSize, AllocationType::kOld, AllocationOrigin::kRuntime,
AllocationAlignment::kWordAligned); AllocationAlignment::kWordAligned);
if (!result.IsRetry()) {
heap->CreateFillerObjectAtBackground( heap->CreateFillerObjectAtBackground(
address, kSmallObjectSize, ClearFreedMemoryMode::kDontClearFreedMemory); result.ToAddress(), kSmallObjectSize,
ClearFreedMemoryMode::kDontClearFreedMemory);
} else {
local_heap.TryPerformCollection();
}
AllocationResult result = local_heap.AllocateRaw( result = local_heap.AllocateRaw(kMediumObjectSize, AllocationType::kOld,
kMediumObjectSize, AllocationType::kOld, AllocationOrigin::kRuntime, AllocationOrigin::kRuntime,
AllocationAlignment::kWordAligned); AllocationAlignment::kWordAligned);
if (!result.IsRetry()) { if (!result.IsRetry()) {
heap->CreateFillerObjectAtBackground( heap->CreateFillerObjectAtBackground(
result.ToAddress(), kMediumObjectSize, result.ToAddress(), kMediumObjectSize,
ClearFreedMemoryMode::kDontClearFreedMemory); ClearFreedMemoryMode::kDontClearFreedMemory);
} else {
local_heap.TryPerformCollection();
} }
result = local_heap.AllocateRaw(kLargeObjectSize, AllocationType::kOld, result = local_heap.AllocateRaw(kLargeObjectSize, AllocationType::kOld,
...@@ -56,6 +63,8 @@ void StressConcurrentAllocatorTask::RunInternal() { ...@@ -56,6 +63,8 @@ void StressConcurrentAllocatorTask::RunInternal() {
heap->CreateFillerObjectAtBackground( heap->CreateFillerObjectAtBackground(
result.ToAddress(), kLargeObjectSize, result.ToAddress(), kLargeObjectSize,
ClearFreedMemoryMode::kDontClearFreedMemory); ClearFreedMemoryMode::kDontClearFreedMemory);
} else {
local_heap.TryPerformCollection();
} }
local_heap.Safepoint(); local_heap.Safepoint();
} }
......
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