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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 bool IsWasmInstance(Object* instance); | 403 bool IsWasmInstance(Object* instance); |
404 | 404 |
405 // Check whether the wasm module was generated from asm.js code. | 405 // Check whether the wasm module was generated from asm.js code. |
406 bool WasmIsAsmJs(Object* instance, Isolate* isolate); | 406 bool WasmIsAsmJs(Object* instance, Isolate* isolate); |
407 | 407 |
408 // Get the script of the wasm module. If the origin of the module is asm.js, the | 408 // Get the script of the wasm module. If the origin of the module is asm.js, the |
409 // returned Script will be a JavaScript Script of Script::TYPE_NORMAL, otherwise | 409 // returned Script will be a JavaScript Script of Script::TYPE_NORMAL, otherwise |
410 // it's of type TYPE_WASM. | 410 // it's of type TYPE_WASM. |
411 Handle<Script> GetScript(Handle<JSObject> instance); | 411 Handle<Script> GetScript(Handle<JSObject> instance); |
412 | 412 |
413 // Compute the disassembly of a wasm function. | |
414 // Returns the disassembly string and a list of <byte_offset, line, column> | |
415 // entries, mapping wasm byte offsets to line and column in the disassembly. | |
416 // The list is guaranteed to be ordered by the byte_offset. | |
417 // Returns an empty string and empty vector if the function index is invalid. | |
418 std::pair<std::string, std::vector<std::tuple<uint32_t, int, int>>> | |
419 DisassembleFunction(Handle<WasmCompiledModule> compiled_module, int func_index); | |
420 | |
421 V8_EXPORT_PRIVATE MaybeHandle<WasmModuleObject> CreateModuleObjectFromBytes( | 413 V8_EXPORT_PRIVATE MaybeHandle<WasmModuleObject> CreateModuleObjectFromBytes( |
422 Isolate* isolate, const byte* start, const byte* end, ErrorThrower* thrower, | 414 Isolate* isolate, const byte* start, const byte* end, ErrorThrower* thrower, |
423 ModuleOrigin origin, Handle<Script> asm_js_script, | 415 ModuleOrigin origin, Handle<Script> asm_js_script, |
424 const byte* asm_offset_tables_start, const byte* asm_offset_tables_end); | 416 const byte* asm_offset_tables_start, const byte* asm_offset_tables_end); |
425 | 417 |
426 V8_EXPORT_PRIVATE bool ValidateModuleBytes(Isolate* isolate, const byte* start, | 418 V8_EXPORT_PRIVATE bool ValidateModuleBytes(Isolate* isolate, const byte* start, |
427 const byte* end, | 419 const byte* end, |
428 ErrorThrower* thrower, | 420 ErrorThrower* thrower, |
429 ModuleOrigin origin); | 421 ModuleOrigin origin); |
430 | 422 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj); | 458 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj); |
467 void ValidateOrphanedInstance(Isolate* isolate, | 459 void ValidateOrphanedInstance(Isolate* isolate, |
468 Handle<WasmInstanceObject> instance); | 460 Handle<WasmInstanceObject> instance); |
469 | 461 |
470 } // namespace testing | 462 } // namespace testing |
471 } // namespace wasm | 463 } // namespace wasm |
472 } // namespace internal | 464 } // namespace internal |
473 } // namespace v8 | 465 } // namespace v8 |
474 | 466 |
475 #endif // V8_WASM_MODULE_H_ | 467 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |