diff options
Diffstat (limited to 'deps/v8/src/wasm/wasm-limits.h')
-rw-r--r-- | deps/v8/src/wasm/wasm-limits.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/deps/v8/src/wasm/wasm-limits.h b/deps/v8/src/wasm/wasm-limits.h index c1011c3f89..db99313e07 100644 --- a/deps/v8/src/wasm/wasm-limits.h +++ b/deps/v8/src/wasm/wasm-limits.h @@ -15,6 +15,8 @@ namespace v8 { namespace internal { namespace wasm { +constexpr size_t kSpecMaxWasmMemoryPages = 65536; + // The following limits are imposed by V8 on WebAssembly modules. // The limits are agreed upon with other engines for consistency. constexpr size_t kV8MaxWasmTypes = 1000000; @@ -26,9 +28,7 @@ constexpr size_t kV8MaxWasmExceptions = 1000000; constexpr size_t kV8MaxWasmExceptionTypes = 1000000; constexpr size_t kV8MaxWasmDataSegments = 100000; // Don't use this limit directly, but use the value of FLAG_wasm_max_mem_pages. -// Current limit mimics the maximum allowed allocation on an ArrayBuffer -// (2GiB - 1 page). -constexpr size_t kV8MaxWasmMemoryPages = 32767; // ~ 2 GiB +constexpr size_t kV8MaxWasmMemoryPages = 32767; // = ~ 2 GiB constexpr size_t kV8MaxWasmStringSize = 100000; constexpr size_t kV8MaxWasmModuleSize = 1024 * 1024 * 1024; // = 1 GiB constexpr size_t kV8MaxWasmFunctionSize = 7654321; @@ -42,14 +42,15 @@ constexpr size_t kV8MaxWasmTableEntries = 10000000; constexpr size_t kV8MaxWasmTables = 1; constexpr size_t kV8MaxWasmMemories = 1; -constexpr size_t kSpecMaxWasmMemoryPages = 65536; static_assert(kV8MaxWasmMemoryPages <= kSpecMaxWasmMemoryPages, "v8 should not be more permissive than the spec"); constexpr size_t kSpecMaxWasmTableSize = 0xFFFFFFFFu; -constexpr size_t kV8MaxWasmMemoryBytes = kV8MaxWasmMemoryPages * kWasmPageSize; -static_assert(kV8MaxWasmMemoryBytes <= std::numeric_limits<int32_t>::max(), - "max memory bytes should fit in int32_t"); +constexpr uint64_t kV8MaxWasmMemoryBytes = + kV8MaxWasmMemoryPages * uint64_t{kWasmPageSize}; + +constexpr uint64_t kSpecMaxWasmMemoryBytes = + kSpecMaxWasmMemoryPages * uint64_t{kWasmPageSize}; constexpr uint64_t kWasmMaxHeapOffset = static_cast<uint64_t>( |