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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 WasmCompiledModule* GetCompiledModule(Object* wasm_instance); | 380 WasmCompiledModule* GetCompiledModule(Object* wasm_instance); |
381 | 381 |
382 // Check whether the wasm module was generated from asm.js code. | 382 // Check whether the wasm module was generated from asm.js code. |
383 bool WasmIsAsmJs(Object* instance, Isolate* isolate); | 383 bool WasmIsAsmJs(Object* instance, Isolate* isolate); |
384 | 384 |
385 // Get the script of the wasm module. If the origin of the module is asm.js, the | 385 // Get the script of the wasm module. If the origin of the module is asm.js, the |
386 // returned Script will be a JavaScript Script of Script::TYPE_NORMAL, otherwise | 386 // returned Script will be a JavaScript Script of Script::TYPE_NORMAL, otherwise |
387 // it's of type TYPE_WASM. | 387 // it's of type TYPE_WASM. |
388 Handle<Script> GetScript(Handle<JSObject> instance); | 388 Handle<Script> GetScript(Handle<JSObject> instance); |
389 | 389 |
| 390 // Compute the disassembly of a wasm function. |
| 391 // Returns the disassembly string and a list of <byte_offset, line, column> |
| 392 // entries, mapping wasm byte offsets to line and column in the disassembly. |
| 393 // The list is guaranteed to be ordered by the byte_offset. |
| 394 std::pair<std::string, std::vector<std::tuple<uint32_t, int, int>>> |
| 395 DisassembleFunction(Handle<WasmCompiledModule> compiled_module, int func_index); |
| 396 |
390 // Get the asm.js source position for the given byte offset in the given | 397 // Get the asm.js source position for the given byte offset in the given |
391 // function. | 398 // function. |
392 int GetAsmWasmSourcePosition(Handle<JSObject> instance, int func_index, | 399 int GetAsmWasmSourcePosition(Handle<JSObject> instance, int func_index, |
393 int byte_offset); | 400 int byte_offset); |
394 | 401 |
395 V8_EXPORT_PRIVATE MaybeHandle<WasmModuleObject> CreateModuleObjectFromBytes( | 402 V8_EXPORT_PRIVATE MaybeHandle<WasmModuleObject> CreateModuleObjectFromBytes( |
396 Isolate* isolate, const byte* start, const byte* end, ErrorThrower* thrower, | 403 Isolate* isolate, const byte* start, const byte* end, ErrorThrower* thrower, |
397 ModuleOrigin origin, Handle<Script> asm_js_script, | 404 ModuleOrigin origin, Handle<Script> asm_js_script, |
398 const byte* asm_offset_tables_start, const byte* asm_offset_tables_end); | 405 const byte* asm_offset_tables_start, const byte* asm_offset_tables_end); |
399 | 406 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj); | 443 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj); |
437 void ValidateOrphanedInstance(Isolate* isolate, | 444 void ValidateOrphanedInstance(Isolate* isolate, |
438 Handle<WasmInstanceObject> instance); | 445 Handle<WasmInstanceObject> instance); |
439 | 446 |
440 } // namespace testing | 447 } // namespace testing |
441 } // namespace wasm | 448 } // namespace wasm |
442 } // namespace internal | 449 } // namespace internal |
443 } // namespace v8 | 450 } // namespace v8 |
444 | 451 |
445 #endif // V8_WASM_MODULE_H_ | 452 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |