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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/api.h" | 10 #include "src/api.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 }; | 227 }; |
228 | 228 |
229 typedef Managed<WasmModule> WasmModuleWrapper; | 229 typedef Managed<WasmModule> WasmModuleWrapper; |
230 | 230 |
231 // An instantiated WASM module, including memory, function table, etc. | 231 // An instantiated WASM module, including memory, function table, etc. |
232 struct WasmInstance { | 232 struct WasmInstance { |
233 const WasmModule* module; // static representation of the module. | 233 const WasmModule* module; // static representation of the module. |
234 // -- Heap allocated -------------------------------------------------------- | 234 // -- Heap allocated -------------------------------------------------------- |
235 Handle<Context> context; // JavaScript native context. | 235 Handle<Context> context; // JavaScript native context. |
236 std::vector<Handle<FixedArray>> function_tables; // indirect function tables. | 236 std::vector<Handle<FixedArray>> function_tables; // indirect function tables. |
| 237 std::vector<Handle<FixedArray>> |
| 238 signature_tables; // indirect signature tables. |
237 std::vector<Handle<Code>> function_code; // code objects for each function. | 239 std::vector<Handle<Code>> function_code; // code objects for each function. |
238 // -- raw memory ------------------------------------------------------------ | 240 // -- raw memory ------------------------------------------------------------ |
239 byte* mem_start = nullptr; // start of linear memory. | 241 byte* mem_start = nullptr; // start of linear memory. |
240 uint32_t mem_size = 0; // size of the linear memory. | 242 uint32_t mem_size = 0; // size of the linear memory. |
241 // -- raw globals ----------------------------------------------------------- | 243 // -- raw globals ----------------------------------------------------------- |
242 byte* globals_start = nullptr; // start of the globals area. | 244 byte* globals_start = nullptr; // start of the globals area. |
243 | 245 |
244 explicit WasmInstance(const WasmModule* m) | 246 explicit WasmInstance(const WasmModule* m) |
245 : module(m), | 247 : module(m), |
246 function_tables(m->function_tables.size()), | 248 function_tables(m->function_tables.size()), |
| 249 signature_tables(m->function_tables.size()), |
247 function_code(m->functions.size()) {} | 250 function_code(m->functions.size()) {} |
248 }; | 251 }; |
249 | 252 |
250 // Interface to the storage (wire bytes) of a wasm module. | 253 // Interface to the storage (wire bytes) of a wasm module. |
251 // It is illegal for anyone receiving a ModuleWireBytes to store pointers based | 254 // It is illegal for anyone receiving a ModuleWireBytes to store pointers based |
252 // on module_bytes, as this storage is only guaranteed to be alive as long as | 255 // on module_bytes, as this storage is only guaranteed to be alive as long as |
253 // this struct is alive. | 256 // this struct is alive. |
254 struct V8_EXPORT_PRIVATE ModuleWireBytes { | 257 struct V8_EXPORT_PRIVATE ModuleWireBytes { |
255 ModuleWireBytes(Vector<const byte> module_bytes) | 258 ModuleWireBytes(Vector<const byte> module_bytes) |
256 : module_bytes(module_bytes) {} | 259 : module_bytes(module_bytes) {} |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj); | 439 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj); |
437 void ValidateOrphanedInstance(Isolate* isolate, | 440 void ValidateOrphanedInstance(Isolate* isolate, |
438 Handle<WasmInstanceObject> instance); | 441 Handle<WasmInstanceObject> instance); |
439 | 442 |
440 } // namespace testing | 443 } // namespace testing |
441 } // namespace wasm | 444 } // namespace wasm |
442 } // namespace internal | 445 } // namespace internal |
443 } // namespace v8 | 446 } // namespace v8 |
444 | 447 |
445 #endif // V8_WASM_MODULE_H_ | 448 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |