Commit 65d05bef authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[test] Make %SimulateNewspaceFull more robust

GC stress flags (--gc-interval, --random-gc-interval) could trigger
unexpected fake allocation failures while trying to fill up a page.
An AlwaysAllocateScope suppresses that.

Drive-by fix: allocation requests with exactly kMaxRegularHeapObjectSize
can take the fast path.

Bug: v8:9700
Change-Id: I7fa35e56848e74f12d3606da453e1ae7254c268b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1834121Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64079}
parent 73811dad
......@@ -176,8 +176,9 @@ AllocationResult Heap::AllocateRaw(int size_in_bytes, AllocationType type,
HeapObject object;
AllocationResult allocation;
if (FLAG_single_generation && type == AllocationType::kYoung)
if (FLAG_single_generation && type == AllocationType::kYoung) {
type = AllocationType::kOld;
}
if (AllocationType::kYoung == type) {
if (large_object) {
......@@ -250,7 +251,7 @@ HeapObject Heap::AllocateRawWith(int size, AllocationType allocation,
Address* limit = heap->NewSpaceAllocationLimitAddress();
if (allocation == AllocationType::kYoung &&
alignment == AllocationAlignment::kWordAligned &&
size < kMaxRegularHeapObjectSize &&
size <= kMaxRegularHeapObjectSize &&
(*limit - *top >= static_cast<unsigned>(size)) &&
V8_LIKELY(!FLAG_single_generation && FLAG_inline_new &&
FLAG_gc_interval == 0)) {
......
......@@ -711,6 +711,7 @@ RUNTIME_FUNCTION(Runtime_SimulateNewspaceFull) {
Heap* heap = isolate->heap();
NewSpace* space = heap->new_space();
PauseAllocationObserversScope pause_observers(heap);
AlwaysAllocateScope always_allocate(heap);
do {
FillUpOneNewSpacePage(isolate, heap);
} while (space->AddFreshPage());
......
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