OLD | NEW |
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 "src/wasm/wasm-opcodes.h" | 8 #include "src/wasm/wasm-opcodes.h" |
9 #include "src/wasm/wasm-result.h" | 9 #include "src/wasm/wasm-result.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 const size_t kMaxModuleSize = 1024 * 1024 * 1024; | 22 const size_t kMaxModuleSize = 1024 * 1024 * 1024; |
23 const size_t kMaxFunctionSize = 128 * 1024; | 23 const size_t kMaxFunctionSize = 128 * 1024; |
24 const size_t kMaxStringSize = 256; | 24 const size_t kMaxStringSize = 256; |
25 const uint32_t kWasmMagic = 0x6d736100; | 25 const uint32_t kWasmMagic = 0x6d736100; |
26 const uint32_t kWasmVersion = 0x0a; | 26 const uint32_t kWasmVersion = 0x0a; |
27 | 27 |
28 // WebAssembly sections are named as strings in the binary format, but | 28 // WebAssembly sections are named as strings in the binary format, but |
29 // internally V8 uses an enum to handle them. | 29 // internally V8 uses an enum to handle them. |
30 // | 30 // |
31 // Entries have the form F(enumerator, string). | 31 // Entries have the form F(enumerator, string). |
32 #define FOR_EACH_WASM_SECTION_TYPE(F) \ | 32 #define FOR_EACH_WASM_SECTION_TYPE(F) \ |
33 F(kDeclMemory, "memory") \ | 33 F(kDeclMemory, "memory") \ |
34 F(kDeclSignatures, "signatures") \ | 34 F(kDeclSignatures, "signatures") \ |
35 F(kDeclFunctions, "functions") \ | 35 F(kDeclFunctions, "functions") \ |
36 F(kDeclGlobals, "globals") \ | 36 F(kDeclGlobals, "globals") \ |
37 F(kDeclDataSegments, "data_segments") \ | 37 F(kDeclDataSegments, "data_segments") \ |
38 F(kDeclFunctionTable, "function_table") \ | 38 F(kDeclFunctionTable, "function_table") \ |
39 F(kDeclEnd, "end") \ | 39 F(kDeclEnd, "end") \ |
40 F(kDeclStartFunction, "start_function") \ | 40 F(kDeclStartFunction, "start_function") \ |
41 F(kDeclImportTable, "import_table") \ | 41 F(kDeclImportTable, "import_table") \ |
42 F(kDeclExportTable, "export_table") | 42 F(kDeclExportTable, "export_table") \ |
| 43 F(kDeclFunctionSignatures, "function_signatures") \ |
| 44 F(kDeclFunctionBodies, "function_bodies") \ |
| 45 F(kDeclNames, "names") |
43 | 46 |
44 enum WasmSectionDeclCode : uint32_t { | 47 enum WasmSectionDeclCode : uint32_t { |
45 #define F(enumerator, string) enumerator, | 48 #define F(enumerator, string) enumerator, |
46 FOR_EACH_WASM_SECTION_TYPE(F) | 49 FOR_EACH_WASM_SECTION_TYPE(F) |
47 #undef F | 50 #undef F |
48 kMaxModuleSectionCode | 51 kMaxModuleSectionCode |
49 }; | 52 }; |
50 | 53 |
51 enum WasmFunctionDeclBit { | 54 enum WasmFunctionDeclBit { |
52 kDeclFunctionName = 0x01, | 55 kDeclFunctionName = 0x01, |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 270 |
268 // For testing. Decode, verify, and run the last exported function in the | 271 // For testing. Decode, verify, and run the last exported function in the |
269 // given decoded module. | 272 // given decoded module. |
270 int32_t CompileAndRunWasmModule(Isolate* isolate, WasmModule* module); | 273 int32_t CompileAndRunWasmModule(Isolate* isolate, WasmModule* module); |
271 | 274 |
272 } // namespace wasm | 275 } // namespace wasm |
273 } // namespace internal | 276 } // namespace internal |
274 } // namespace v8 | 277 } // namespace v8 |
275 | 278 |
276 #endif // V8_WASM_MODULE_H_ | 279 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |