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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 if (owned_zone) delete owned_zone; | 214 if (owned_zone) delete owned_zone; |
215 } | 215 } |
216 | 216 |
217 // Creates a new instantiation of the module in the given isolate. | 217 // Creates a new instantiation of the module in the given isolate. |
218 static MaybeHandle<WasmInstanceObject> Instantiate( | 218 static MaybeHandle<WasmInstanceObject> Instantiate( |
219 Isolate* isolate, ErrorThrower* thrower, Handle<JSObject> wasm_module, | 219 Isolate* isolate, ErrorThrower* thrower, Handle<JSObject> wasm_module, |
220 Handle<JSReceiver> ffi, Handle<JSArrayBuffer> memory); | 220 Handle<JSReceiver> ffi, Handle<JSArrayBuffer> memory); |
221 | 221 |
222 MaybeHandle<WasmCompiledModule> CompileFunctions( | 222 MaybeHandle<WasmCompiledModule> CompileFunctions( |
223 Isolate* isolate, Handle<Managed<WasmModule>> module_wrapper, | 223 Isolate* isolate, Handle<Managed<WasmModule>> module_wrapper, |
224 ErrorThrower* thrower, const ModuleWireBytes& wire_bytes) const; | 224 ErrorThrower* thrower, const ModuleWireBytes& wire_bytes, |
| 225 Handle<Script> asm_js_script, |
| 226 Vector<const byte> asm_js_offset_table_bytes) const; |
225 }; | 227 }; |
226 | 228 |
227 typedef Managed<WasmModule> WasmModuleWrapper; | 229 typedef Managed<WasmModule> WasmModuleWrapper; |
228 | 230 |
229 // An instantiated WASM module, including memory, function table, etc. | 231 // An instantiated WASM module, including memory, function table, etc. |
230 struct WasmInstance { | 232 struct WasmInstance { |
231 const WasmModule* module; // static representation of the module. | 233 const WasmModule* module; // static representation of the module. |
232 // -- Heap allocated -------------------------------------------------------- | 234 // -- Heap allocated -------------------------------------------------------- |
233 Handle<JSObject> js_object; // JavaScript module object. | 235 Handle<JSObject> js_object; // JavaScript module object. |
234 Handle<Context> context; // JavaScript native context. | 236 Handle<Context> context; // JavaScript native context. |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 bool IsWasmInstance(Object* instance); | 387 bool IsWasmInstance(Object* instance); |
386 | 388 |
387 // Get the script of the wasm module. If the origin of the module is asm.js, the | 389 // Get the script of the wasm module. If the origin of the module is asm.js, the |
388 // returned Script will be a JavaScript Script of Script::TYPE_NORMAL, otherwise | 390 // returned Script will be a JavaScript Script of Script::TYPE_NORMAL, otherwise |
389 // it's of type TYPE_WASM. | 391 // it's of type TYPE_WASM. |
390 Handle<Script> GetScript(Handle<JSObject> instance); | 392 Handle<Script> GetScript(Handle<JSObject> instance); |
391 | 393 |
392 V8_EXPORT_PRIVATE MaybeHandle<WasmModuleObject> CreateModuleObjectFromBytes( | 394 V8_EXPORT_PRIVATE MaybeHandle<WasmModuleObject> CreateModuleObjectFromBytes( |
393 Isolate* isolate, const byte* start, const byte* end, ErrorThrower* thrower, | 395 Isolate* isolate, const byte* start, const byte* end, ErrorThrower* thrower, |
394 ModuleOrigin origin, Handle<Script> asm_js_script, | 396 ModuleOrigin origin, Handle<Script> asm_js_script, |
395 const byte* asm_offset_tables_start, const byte* asm_offset_tables_end); | 397 Vector<const byte> asm_offset_table); |
396 | 398 |
397 V8_EXPORT_PRIVATE bool ValidateModuleBytes(Isolate* isolate, const byte* start, | 399 V8_EXPORT_PRIVATE bool ValidateModuleBytes(Isolate* isolate, const byte* start, |
398 const byte* end, | 400 const byte* end, |
399 ErrorThrower* thrower, | 401 ErrorThrower* thrower, |
400 ModuleOrigin origin); | 402 ModuleOrigin origin); |
401 | 403 |
402 // Get the offset of the code of a function within a module. | 404 // Get the offset of the code of a function within a module. |
403 int GetFunctionCodeOffset(Handle<WasmCompiledModule> compiled_module, | 405 int GetFunctionCodeOffset(Handle<WasmCompiledModule> compiled_module, |
404 int func_index); | 406 int func_index); |
405 | 407 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj); | 439 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj); |
438 void ValidateOrphanedInstance(Isolate* isolate, | 440 void ValidateOrphanedInstance(Isolate* isolate, |
439 Handle<WasmInstanceObject> instance); | 441 Handle<WasmInstanceObject> instance); |
440 | 442 |
441 } // namespace testing | 443 } // namespace testing |
442 } // namespace wasm | 444 } // namespace wasm |
443 } // namespace internal | 445 } // namespace internal |
444 } // namespace v8 | 446 } // namespace v8 |
445 | 447 |
446 #endif // V8_WASM_MODULE_H_ | 448 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |