Commit fb7f6ab9 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Fix gc calls in memory allocation

Just a minor fix to skip the third GC after which we fail anyway.

R=ulan@chromium.org

Bug: v8:7621
Change-Id: I4dd6bcedc20ecb75dc06af02649ff5c7b67317d0
Reviewed-on: https://chromium-review.googlesource.com/1224434Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55870}
parent 4a5650bf
......@@ -53,15 +53,18 @@ void* TryAllocateBackingStore(WasmMemoryTracker* memory_tracker, Heap* heap,
// address space.
// Try up to three times; getting rid of dead JSArrayBuffer allocations might
// require two GCs.
// TODO(gc): Fix this to only require one GC (crbug.com/v8/7621).
// TODO(ulan): Fix this to only require one GC (crbug.com/v8/7621).
bool did_retry = false;
for (int trial = 0;; ++trial) {
if (memory_tracker->ReserveAddressSpace(*allocation_length)) break;
// Collect garbage and retry.
heap->MemoryPressureNotification(MemoryPressureLevel::kCritical, true);
did_retry = true;
// After first and second GC: retry.
if (trial < 2) continue;
if (trial < 2) {
// Collect garbage and retry.
heap->MemoryPressureNotification(MemoryPressureLevel::kCritical, true);
continue;
}
// We are over the address space limit. Fail.
//
// When running under the correctness fuzzer (i.e.
......
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