From 8f90b655201e4cd77196a0b90ea4f398ecfe2c56 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 9 Jan 2018 21:13:11 -0800 Subject: Do not emit 100k data segments, browsers reject it (#1350) Instead merge constant-offset segments if we must in order to stay under the limit. If we can't - too many non-constant-offset segments - then issue a warning. --- src/wasm-binary.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/wasm-binary.h') diff --git a/src/wasm-binary.h b/src/wasm-binary.h index a407c56e4..12aecfeaa 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -37,7 +37,14 @@ namespace wasm { enum { // the maximum amount of bytes we emit per LEB - MaxLEB32Bytes = 5 + MaxLEB32Bytes = 5, +}; + +// wasm VMs on the web have decided to impose some limits on what they +// accept +enum WebLimitations { + MaxDataSegments = 100 * 1000, + MaxFunctionBodySize = 128 * 1024 }; template -- cgit v1.2.3