Commit cba1501d authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[wasm] Reduce code space estimates on 32-bit

Multiple code spaces are cheaper on 32-bit systems, because we can
directly call between them. Over-reservation on the other hand increases
the chance for OOMs. Hence reduce the code space estimation (used for
the initial reservation) on 32-bit systems.

Numbers were obtained from an older Epic module, Photoshop, and AutoCAD.
I'll keep an eye on the {V8.WasmModuleNumberOfCodeSpaces} counter.

R=ahaas@chromium.org

Change-Id: Ide804eaf46e8ba9bb48fcb41f23f1facc910645e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3634778
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80425}
parent 44c74847
...@@ -2020,8 +2020,13 @@ namespace { ...@@ -2020,8 +2020,13 @@ namespace {
// separate code spaces being allocated (compile time and runtime overhead), // separate code spaces being allocated (compile time and runtime overhead),
// choosing them too large results in over-reservation (virtual address space // choosing them too large results in over-reservation (virtual address space
// only). // only).
// In doubt, choose the numbers slightly too large, because over-reservation is // In doubt, choose the numbers slightly too large on 64-bit systems (where
// less critical than multiple separate code spaces (especially on 64-bit). // {kNeedsFarJumpsBetweenCodeSpaces} is {true}). Over-reservation is less
// critical in a 64-bit address space, but separate code spaces cause overhead.
// On 32-bit systems (where {kNeedsFarJumpsBetweenCodeSpaces} is {false}), the
// opposite is true: Multiple code spaces are cheaper, and address space is
// scarce, hence choose numbers slightly too small.
//
// Numbers can be determined by running benchmarks with // Numbers can be determined by running benchmarks with
// --trace-wasm-compilation-times, and piping the output through // --trace-wasm-compilation-times, and piping the output through
// tools/wasm/code-size-factors.py. // tools/wasm/code-size-factors.py.
...@@ -2033,13 +2038,13 @@ constexpr size_t kLiftoffCodeSizeMultiplier = 4; ...@@ -2033,13 +2038,13 @@ constexpr size_t kLiftoffCodeSizeMultiplier = 4;
constexpr size_t kImportSize = 640; constexpr size_t kImportSize = 640;
#elif V8_TARGET_ARCH_IA32 #elif V8_TARGET_ARCH_IA32
constexpr size_t kTurbofanFunctionOverhead = 20; constexpr size_t kTurbofanFunctionOverhead = 20;
constexpr size_t kTurbofanCodeSizeMultiplier = 4; constexpr size_t kTurbofanCodeSizeMultiplier = 3;
constexpr size_t kLiftoffFunctionOverhead = 48; constexpr size_t kLiftoffFunctionOverhead = 48;
constexpr size_t kLiftoffCodeSizeMultiplier = 5; constexpr size_t kLiftoffCodeSizeMultiplier = 3;
constexpr size_t kImportSize = 320; constexpr size_t kImportSize = 600;
#elif V8_TARGET_ARCH_ARM #elif V8_TARGET_ARCH_ARM
constexpr size_t kTurbofanFunctionOverhead = 44; constexpr size_t kTurbofanFunctionOverhead = 44;
constexpr size_t kTurbofanCodeSizeMultiplier = 4; constexpr size_t kTurbofanCodeSizeMultiplier = 3;
constexpr size_t kLiftoffFunctionOverhead = 96; constexpr size_t kLiftoffFunctionOverhead = 96;
constexpr size_t kLiftoffCodeSizeMultiplier = 5; constexpr size_t kLiftoffCodeSizeMultiplier = 5;
constexpr size_t kImportSize = 550; constexpr size_t kImportSize = 550;
......
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