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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 Handle<Script> asm_js_script, | 225 Handle<Script> asm_js_script, |
226 Vector<const byte> asm_js_offset_table_bytes) const; | 226 Vector<const byte> asm_js_offset_table_bytes) const; |
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<JSObject> js_object; // JavaScript module object. | |
236 Handle<Context> context; // JavaScript native context. | 235 Handle<Context> context; // JavaScript native context. |
237 Handle<JSArrayBuffer> mem_buffer; // Handle to array buffer of memory. | |
238 Handle<JSArrayBuffer> globals_buffer; // Handle to array buffer of globals. | |
239 std::vector<Handle<FixedArray>> function_tables; // indirect function tables. | 236 std::vector<Handle<FixedArray>> function_tables; // indirect function tables. |
240 std::vector<Handle<Code>> function_code; // code objects for each function. | 237 std::vector<Handle<Code>> function_code; // code objects for each function. |
241 // -- raw memory ------------------------------------------------------------ | 238 // -- raw memory ------------------------------------------------------------ |
242 byte* mem_start = nullptr; // start of linear memory. | 239 byte* mem_start = nullptr; // start of linear memory. |
243 uint32_t mem_size = 0; // size of the linear memory. | 240 uint32_t mem_size = 0; // size of the linear memory. |
244 // -- raw globals ----------------------------------------------------------- | 241 // -- raw globals ----------------------------------------------------------- |
245 byte* globals_start = nullptr; // start of the globals area. | 242 byte* globals_start = nullptr; // start of the globals area. |
246 | 243 |
247 explicit WasmInstance(const WasmModule* m) | 244 explicit WasmInstance(const WasmModule* m) |
248 : module(m), | 245 : module(m), |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj); | 436 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj); |
440 void ValidateOrphanedInstance(Isolate* isolate, | 437 void ValidateOrphanedInstance(Isolate* isolate, |
441 Handle<WasmInstanceObject> instance); | 438 Handle<WasmInstanceObject> instance); |
442 | 439 |
443 } // namespace testing | 440 } // namespace testing |
444 } // namespace wasm | 441 } // namespace wasm |
445 } // namespace internal | 442 } // namespace internal |
446 } // namespace v8 | 443 } // namespace v8 |
447 | 444 |
448 #endif // V8_WASM_MODULE_H_ | 445 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |