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, ...@@ -176,8 +176,9 @@ AllocationResult Heap::AllocateRaw(int size_in_bytes, AllocationType type,
HeapObject object; HeapObject object;
AllocationResult allocation; AllocationResult allocation;
if (FLAG_single_generation && type == AllocationType::kYoung) if (FLAG_single_generation && type == AllocationType::kYoung) {
type = AllocationType::kOld; type = AllocationType::kOld;
}
if (AllocationType::kYoung == type) { if (AllocationType::kYoung == type) {
if (large_object) { if (large_object) {
...@@ -250,7 +251,7 @@ HeapObject Heap::AllocateRawWith(int size, AllocationType allocation, ...@@ -250,7 +251,7 @@ HeapObject Heap::AllocateRawWith(int size, AllocationType allocation,
Address* limit = heap->NewSpaceAllocationLimitAddress(); Address* limit = heap->NewSpaceAllocationLimitAddress();
if (allocation == AllocationType::kYoung && if (allocation == AllocationType::kYoung &&
alignment == AllocationAlignment::kWordAligned && alignment == AllocationAlignment::kWordAligned &&
size < kMaxRegularHeapObjectSize && size <= kMaxRegularHeapObjectSize &&
(*limit - *top >= static_cast<unsigned>(size)) && (*limit - *top >= static_cast<unsigned>(size)) &&
V8_LIKELY(!FLAG_single_generation && FLAG_inline_new && V8_LIKELY(!FLAG_single_generation && FLAG_inline_new &&
FLAG_gc_interval == 0)) { FLAG_gc_interval == 0)) {
......
...@@ -711,6 +711,7 @@ RUNTIME_FUNCTION(Runtime_SimulateNewspaceFull) { ...@@ -711,6 +711,7 @@ RUNTIME_FUNCTION(Runtime_SimulateNewspaceFull) {
Heap* heap = isolate->heap(); Heap* heap = isolate->heap();
NewSpace* space = heap->new_space(); NewSpace* space = heap->new_space();
PauseAllocationObserversScope pause_observers(heap); PauseAllocationObserversScope pause_observers(heap);
AlwaysAllocateScope always_allocate(heap);
do { do {
FillUpOneNewSpacePage(isolate, heap); FillUpOneNewSpacePage(isolate, heap);
} while (space->AddFreshPage()); } 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