Commit 3a82e2c6 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm] Reserve memory also on 32-bit systems

On 64-bit platforms we reserve the maximum size of a WebAssembly memory.
Thereby the memory can grow in-place. On 32-bit platforms, however, we
allocate only the initial size, and grow the memory by reallocating the
memory. Due to memory fragmentation the memory therefore cannot grow
big. With this CL we allow to reserve 1GB of memory even on 32-bit
platforms. Thereby the memory can grow to at least 1GB.

R=gdeepti@chromium.org
CC=ulan@chromium.org

Bug: chromium:1175564
Change-Id: Iba44bb64ffa47322a205e8da3b7088e3edfeee62
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2707163Reviewed-by: 's avatarDeepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72888}
parent 013a5e0f
......@@ -859,7 +859,10 @@ MaybeHandle<WasmMemoryObject> WasmMemoryObject::New(Isolate* isolate,
// tests. For now, on 32-bit we never reserve more than initial, unless the
// memory is shared.
if (shared == SharedFlag::kNotShared) {
heuristic_maximum = initial;
// On 32-bit systems we reserve a maximum of 1GB.
constexpr uint32_t kGB = 1024 * 1024 * 1024;
heuristic_maximum = std::min(maximum, kGB / wasm::kWasmPageSize);
heuristic_maximum = std::max(heuristic_maximum, initial);
}
#endif
......
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