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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 enum WasmSectionDeclCode { | 26 enum WasmSectionDeclCode { |
27 kDeclMemory = 0x00, | 27 kDeclMemory = 0x00, |
28 kDeclSignatures = 0x01, | 28 kDeclSignatures = 0x01, |
29 kDeclFunctions = 0x02, | 29 kDeclFunctions = 0x02, |
30 kDeclGlobals = 0x03, | 30 kDeclGlobals = 0x03, |
31 kDeclDataSegments = 0x04, | 31 kDeclDataSegments = 0x04, |
32 kDeclFunctionTable = 0x05, | 32 kDeclFunctionTable = 0x05, |
33 kDeclWLL = 0x11, | 33 kDeclWLL = 0x11, |
34 kDeclEnd = 0x06, | 34 kDeclEnd = 0x06, |
| 35 kDeclStartFunction = 0x07, |
35 }; | 36 }; |
36 | 37 |
37 static const int kMaxModuleSectionCode = 6; | 38 static const int kMaxModuleSectionCode = 6; |
38 | 39 |
39 enum WasmFunctionDeclBit { | 40 enum WasmFunctionDeclBit { |
40 kDeclFunctionName = 0x01, | 41 kDeclFunctionName = 0x01, |
41 kDeclFunctionImport = 0x02, | 42 kDeclFunctionImport = 0x02, |
42 kDeclFunctionLocals = 0x04, | 43 kDeclFunctionLocals = 0x04, |
43 kDeclFunctionExport = 0x08 | 44 kDeclFunctionExport = 0x08 |
44 }; | 45 }; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 static const uint8_t kMinMemSize = 12; // Minimum memory size = 4kb | 87 static const uint8_t kMinMemSize = 12; // Minimum memory size = 4kb |
87 static const uint8_t kMaxMemSize = 30; // Maximum memory size = 1gb | 88 static const uint8_t kMaxMemSize = 30; // Maximum memory size = 1gb |
88 | 89 |
89 Isolate* shared_isolate; // isolate for storing shared code. | 90 Isolate* shared_isolate; // isolate for storing shared code. |
90 const byte* module_start; // starting address for the module bytes. | 91 const byte* module_start; // starting address for the module bytes. |
91 const byte* module_end; // end address for the module bytes. | 92 const byte* module_end; // end address for the module bytes. |
92 uint8_t min_mem_size_log2; // minimum size of the memory (log base 2). | 93 uint8_t min_mem_size_log2; // minimum size of the memory (log base 2). |
93 uint8_t max_mem_size_log2; // maximum size of the memory (log base 2). | 94 uint8_t max_mem_size_log2; // maximum size of the memory (log base 2). |
94 bool mem_export; // true if the memory is exported. | 95 bool mem_export; // true if the memory is exported. |
95 bool mem_external; // true if the memory is external. | 96 bool mem_external; // true if the memory is external. |
| 97 int start_function_index; // start function, if any. |
96 | 98 |
97 std::vector<WasmGlobal>* globals; // globals in this module. | 99 std::vector<WasmGlobal>* globals; // globals in this module. |
98 std::vector<FunctionSig*>* signatures; // signatures in this module. | 100 std::vector<FunctionSig*>* signatures; // signatures in this module. |
99 std::vector<WasmFunction>* functions; // functions in this module. | 101 std::vector<WasmFunction>* functions; // functions in this module. |
100 std::vector<WasmDataSegment>* data_segments; // data segments in this module. | 102 std::vector<WasmDataSegment>* data_segments; // data segments in this module. |
101 std::vector<uint16_t>* function_table; // function table. | 103 std::vector<uint16_t>* function_table; // function table. |
102 | 104 |
103 WasmModule(); | 105 WasmModule(); |
104 ~WasmModule(); | 106 ~WasmModule(); |
105 | 107 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 const byte* module_end, bool asm_js = false); | 205 const byte* module_end, bool asm_js = false); |
204 | 206 |
205 // For testing. Decode, verify, and run the last exported function in the | 207 // For testing. Decode, verify, and run the last exported function in the |
206 // given decoded module. | 208 // given decoded module. |
207 int32_t CompileAndRunWasmModule(Isolate* isolate, WasmModule* module); | 209 int32_t CompileAndRunWasmModule(Isolate* isolate, WasmModule* module); |
208 } // namespace wasm | 210 } // namespace wasm |
209 } // namespace internal | 211 } // namespace internal |
210 } // namespace v8 | 212 } // namespace v8 |
211 | 213 |
212 #endif // V8_WASM_MODULE_H_ | 214 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |