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

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

Issue 2551463002: [wasm] Move all V8-specific limitations to wasm-limits.h (Closed)
Patch Set: Created 4 years 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/wasm/wasm-limits.h ('k') | src/wasm/wasm-module.cc » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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_MODULE_H_ 5 #ifndef V8_WASM_MODULE_H_
6 #define V8_WASM_MODULE_H_ 6 #define V8_WASM_MODULE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/api.h" 10 #include "src/api.h"
(...skipping 14 matching lines...) Expand all
25 class WasmInstanceObject; 25 class WasmInstanceObject;
26 26
27 namespace compiler { 27 namespace compiler {
28 class CallDescriptor; 28 class CallDescriptor;
29 class WasmCompilationUnit; 29 class WasmCompilationUnit;
30 } 30 }
31 31
32 namespace wasm { 32 namespace wasm {
33 class ErrorThrower; 33 class ErrorThrower;
34 34
35 const size_t kMaxModuleSize = 1024 * 1024 * 1024;
36 const size_t kMaxFunctionSize = 128 * 1024;
37 const size_t kMaxStringSize = 256;
38 const uint32_t kWasmMagic = 0x6d736100; 35 const uint32_t kWasmMagic = 0x6d736100;
39 const uint32_t kWasmVersion = 0x0d; 36 const uint32_t kWasmVersion = 0x0d;
40 37
41 const uint8_t kWasmFunctionTypeForm = 0x60; 38 const uint8_t kWasmFunctionTypeForm = 0x60;
42 const uint8_t kWasmAnyFunctionTypeForm = 0x70; 39 const uint8_t kWasmAnyFunctionTypeForm = 0x70;
43 40
44 const uint64_t kWasmMaxHeapOffset =
45 static_cast<uint64_t>(
46 std::numeric_limits<uint32_t>::max()) // maximum base value
47 + std::numeric_limits<uint32_t>::max(); // maximum index value
48
49 enum WasmSectionCode { 41 enum WasmSectionCode {
50 kUnknownSectionCode = 0, // code for unknown sections 42 kUnknownSectionCode = 0, // code for unknown sections
51 kTypeSectionCode = 1, // Function signature declarations 43 kTypeSectionCode = 1, // Function signature declarations
52 kImportSectionCode = 2, // Import declarations 44 kImportSectionCode = 2, // Import declarations
53 kFunctionSectionCode = 3, // Function declarations 45 kFunctionSectionCode = 3, // Function declarations
54 kTableSectionCode = 4, // Indirect function table and other tables 46 kTableSectionCode = 4, // Indirect function table and other tables
55 kMemorySectionCode = 5, // Memory attributes 47 kMemorySectionCode = 5, // Memory attributes
56 kGlobalSectionCode = 6, // Global declarations 48 kGlobalSectionCode = 6, // Global declarations
57 kExportSectionCode = 7, // Exports 49 kExportSectionCode = 7, // Exports
58 kStartSectionCode = 8, // Start function declaration 50 kStartSectionCode = 8, // Start function declaration
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 uint32_t index; // index into the respective space. 168 uint32_t index; // index into the respective space.
177 }; 169 };
178 170
179 enum ModuleOrigin { kWasmOrigin, kAsmJsOrigin }; 171 enum ModuleOrigin { kWasmOrigin, kAsmJsOrigin };
180 struct ModuleWireBytes; 172 struct ModuleWireBytes;
181 173
182 // Static representation of a module. 174 // Static representation of a module.
183 struct V8_EXPORT_PRIVATE WasmModule { 175 struct V8_EXPORT_PRIVATE WasmModule {
184 static const uint32_t kPageSize = 0x10000; // Page size, 64kb. 176 static const uint32_t kPageSize = 0x10000; // Page size, 64kb.
185 static const uint32_t kMinMemPages = 1; // Minimum memory size = 64kb 177 static const uint32_t kMinMemPages = 1; // Minimum memory size = 64kb
186 static const size_t kV8MaxPages = 16384; // Maximum memory size = 1gb
187 static const size_t kSpecMaxPages = 65536; // Maximum according to the spec
188 static const size_t kV8MaxTableSize = 16 * 1024 * 1024;
189 178
190 Zone* owned_zone; 179 Zone* owned_zone;
191 uint32_t min_mem_pages = 0; // minimum size of the memory in 64k pages 180 uint32_t min_mem_pages = 0; // minimum size of the memory in 64k pages
192 uint32_t max_mem_pages = 0; // maximum size of the memory in 64k pages 181 uint32_t max_mem_pages = 0; // maximum size of the memory in 64k pages
193 bool has_memory = false; // true if the memory was defined or imported 182 bool has_memory = false; // true if the memory was defined or imported
194 bool mem_export = false; // true if the memory is exported 183 bool mem_export = false; // true if the memory is exported
195 // TODO(wasm): reconcile start function index being an int with 184 // TODO(wasm): reconcile start function index being an int with
196 // the fact that we index on uint32_t, so we may technically not be 185 // the fact that we index on uint32_t, so we may technically not be
197 // able to represent some start_function_index -es. 186 // able to represent some start_function_index -es.
198 int start_function_index = -1; // start function, if any 187 int start_function_index = -1; // start function, if any
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj); 447 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj);
459 void ValidateOrphanedInstance(Isolate* isolate, 448 void ValidateOrphanedInstance(Isolate* isolate,
460 Handle<WasmInstanceObject> instance); 449 Handle<WasmInstanceObject> instance);
461 450
462 } // namespace testing 451 } // namespace testing
463 } // namespace wasm 452 } // namespace wasm
464 } // namespace internal 453 } // namespace internal
465 } // namespace v8 454 } // namespace v8
466 455
467 #endif // V8_WASM_MODULE_H_ 456 #endif // V8_WASM_MODULE_H_
OLDNEW
« no previous file with comments | « src/wasm/wasm-limits.h ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698