Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: src/wasm/wasm-limits.h

Issue 2935243002: Revert of [wasm] Increase WebAssembly.Memory maximum size to ~2GB (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_WASM_WASM_LIMITS_H_ 5 #ifndef V8_WASM_WASM_LIMITS_H_
6 #define V8_WASM_WASM_LIMITS_H_ 6 #define V8_WASM_WASM_LIMITS_H_
7 7
8 #include <cstddef> 8 #include <cstddef>
9 #include <cstdint> 9 #include <cstdint>
10 #include <limits> 10 #include <limits>
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 namespace wasm { 14 namespace wasm {
15 15
16 // The following limits are imposed by V8 on WebAssembly modules. 16 // The following limits are imposed by V8 on WebAssembly modules.
17 // The limits are agreed upon with other engines for consistency. 17 // The limits are agreed upon with other engines for consistency.
18 constexpr size_t kV8MaxWasmTypes = 1000000; 18 constexpr size_t kV8MaxWasmTypes = 1000000;
19 constexpr size_t kV8MaxWasmFunctions = 1000000; 19 constexpr size_t kV8MaxWasmFunctions = 1000000;
20 constexpr size_t kV8MaxWasmImports = 100000; 20 constexpr size_t kV8MaxWasmImports = 100000;
21 constexpr size_t kV8MaxWasmExports = 100000; 21 constexpr size_t kV8MaxWasmExports = 100000;
22 constexpr size_t kV8MaxWasmGlobals = 1000000; 22 constexpr size_t kV8MaxWasmGlobals = 1000000;
23 constexpr size_t kV8MaxWasmDataSegments = 100000; 23 constexpr size_t kV8MaxWasmDataSegments = 100000;
24 // Don't use this limit directly, but use the value of FLAG_wasm_max_mem_pages. 24 // Don't use this limit directly, but use the value of FLAG_wasm_max_mem_pages.
25 // Current limit mimics the maximum allowed allocation on an ArrayBuffer 25 constexpr size_t kV8MaxWasmMemoryPages = 16384; // = 1 GiB
26 // (2GiB - 1 page).
27 constexpr size_t kV8MaxWasmMemoryPages = 32767; // ~ 2 GiB
28 constexpr size_t kV8MaxWasmStringSize = 100000; 26 constexpr size_t kV8MaxWasmStringSize = 100000;
29 constexpr size_t kV8MaxWasmModuleSize = 1024 * 1024 * 1024; // = 1 GiB 27 constexpr size_t kV8MaxWasmModuleSize = 1024 * 1024 * 1024; // = 1 GiB
30 constexpr size_t kV8MaxWasmFunctionSize = 128 * 1024; 28 constexpr size_t kV8MaxWasmFunctionSize = 128 * 1024;
31 constexpr size_t kV8MaxWasmFunctionLocals = 50000; 29 constexpr size_t kV8MaxWasmFunctionLocals = 50000;
32 constexpr size_t kV8MaxWasmFunctionParams = 1000; 30 constexpr size_t kV8MaxWasmFunctionParams = 1000;
33 constexpr size_t kV8MaxWasmFunctionMultiReturns = 1000; 31 constexpr size_t kV8MaxWasmFunctionMultiReturns = 1000;
34 constexpr size_t kV8MaxWasmFunctionReturns = 1; 32 constexpr size_t kV8MaxWasmFunctionReturns = 1;
35 // Don't use this limit directly, but use the value of FLAG_wasm_max_table_size. 33 // Don't use this limit directly, but use the value of FLAG_wasm_max_table_size.
36 constexpr size_t kV8MaxWasmTableSize = 10000000; 34 constexpr size_t kV8MaxWasmTableSize = 10000000;
37 constexpr size_t kV8MaxWasmTableEntries = 10000000; 35 constexpr size_t kV8MaxWasmTableEntries = 10000000;
38 constexpr size_t kV8MaxWasmTables = 1; 36 constexpr size_t kV8MaxWasmTables = 1;
39 constexpr size_t kV8MaxWasmMemories = 1; 37 constexpr size_t kV8MaxWasmMemories = 1;
40 38
41 constexpr size_t kSpecMaxWasmMemoryPages = 65536; 39 constexpr size_t kSpecMaxWasmMemoryPages = 65536;
42 constexpr size_t kSpecMaxWasmTableSize = 0xFFFFFFFFu; 40 constexpr size_t kSpecMaxWasmTableSize = 0xFFFFFFFFu;
43 41
44 constexpr uint64_t kWasmMaxHeapOffset = 42 constexpr uint64_t kWasmMaxHeapOffset =
45 static_cast<uint64_t>( 43 static_cast<uint64_t>(
46 std::numeric_limits<uint32_t>::max()) // maximum base value 44 std::numeric_limits<uint32_t>::max()) // maximum base value
47 + std::numeric_limits<uint32_t>::max(); // maximum index value 45 + std::numeric_limits<uint32_t>::max(); // maximum index value
48 46
49 // Limit the control stack size of the C++ wasm interpreter. 47 // Limit the control stack size of the C++ wasm interpreter.
50 constexpr size_t kV8MaxWasmInterpretedStackSize = 64 * 1024; 48 constexpr size_t kV8MaxWasmInterpretedStackSize = 64 * 1024;
51 49
52 } // namespace wasm 50 } // namespace wasm
53 } // namespace internal 51 } // namespace internal
54 } // namespace v8 52 } // namespace v8
55 53
56 #endif // V8_WASM_WASM_LIMITS_H_ 54 #endif // V8_WASM_WASM_LIMITS_H_
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698