1 // Copyright 2016 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_WASM_WASM_LIMITS_H_ 6 #define V8_WASM_WASM_LIMITS_H_ 7 8 namespace v8 { 9 namespace internal { 10 namespace wasm { 11 12 // The following limits are imposed by V8 on WebAssembly modules. 13 // The limits are agreed upon with other engines for consistency. 14 const size_t kV8MaxWasmTypes = 1000000; 15 const size_t kV8MaxWasmFunctions = 1000000; 16 const size_t kV8MaxWasmImports = 100000; 17 const size_t kV8MaxWasmExports = 100000; 18 const size_t kV8MaxWasmGlobals = 1000000; 19 const size_t kV8MaxWasmDataSegments = 100000; 20 // Don't use this limit directly, but use the value of FLAG_wasm_max_mem_pages. 21 const size_t kV8MaxWasmMemoryPages = 16384; // = 1 GiB 22 const size_t kV8MaxWasmStringSize = 100000; 23 const size_t kV8MaxWasmModuleSize = 1024 * 1024 * 1024; // = 1 GiB 24 const size_t kV8MaxWasmFunctionSize = 128 * 1024; 25 const size_t kV8MaxWasmFunctionLocals = 50000; 26 const size_t kV8MaxWasmFunctionParams = 1000; 27 const size_t kV8MaxWasmFunctionMultiReturns = 1000; 28 const size_t kV8MaxWasmFunctionReturns = 1; 29 // Don't use this limit directly, but use the value of FLAG_wasm_max_table_size. 30 const size_t kV8MaxWasmTableSize = 10000000; 31 const size_t kV8MaxWasmTableEntries = 10000000; 32 const size_t kV8MaxWasmTables = 1; 33 const size_t kV8MaxWasmMemories = 1; 34 35 const size_t kSpecMaxWasmMemoryPages = 65536; 36 const size_t kSpecMaxWasmTableSize = 0xFFFFFFFFu; 37 38 const uint64_t kWasmMaxHeapOffset = 39 static_cast<uint64_t>( 40 std::numeric_limits<uint32_t>::max()) // maximum base value 41 + std::numeric_limits<uint32_t>::max(); // maximum index value 42 43 } // namespace wasm 44 } // namespace internal 45 } // namespace v8 46 47 #endif // V8_WASM_WASM_LIMITS_H_ 48