| 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 #include <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "src/base/atomic-utils.h" | 7 #include "src/base/atomic-utils.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 | 9 |
| 10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
| (...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1979 return compiled_module->has_asm_js_offset_tables(); | 1979 return compiled_module->has_asm_js_offset_tables(); |
| 1980 } | 1980 } |
| 1981 | 1981 |
| 1982 Handle<Script> wasm::GetScript(Handle<JSObject> instance) { | 1982 Handle<Script> wasm::GetScript(Handle<JSObject> instance) { |
| 1983 WasmCompiledModule* compiled_module = | 1983 WasmCompiledModule* compiled_module = |
| 1984 WasmInstanceObject::cast(*instance)->get_compiled_module(); | 1984 WasmInstanceObject::cast(*instance)->get_compiled_module(); |
| 1985 DCHECK(compiled_module->has_script()); | 1985 DCHECK(compiled_module->has_script()); |
| 1986 return compiled_module->script(); | 1986 return compiled_module->script(); |
| 1987 } | 1987 } |
| 1988 | 1988 |
| 1989 std::pair<std::string, std::vector<std::tuple<uint32_t, int, int>>> | 1989 v8::DebugInterface::WasmDisassembly wasm::DisassembleFunction( |
| 1990 wasm::DisassembleFunction(Handle<WasmCompiledModule> compiled_module, | 1990 Handle<WasmCompiledModule> compiled_module, int func_index) { |
| 1991 int func_index) { | |
| 1992 if (func_index < 0 || | 1991 if (func_index < 0 || |
| 1993 static_cast<uint32_t>(func_index) >= | 1992 static_cast<uint32_t>(func_index) >= |
| 1994 compiled_module->module()->functions.size()) | 1993 compiled_module->module()->functions.size()) |
| 1995 return {}; | 1994 return {}; |
| 1996 | 1995 |
| 1997 std::ostringstream disassembly_os; | 1996 std::ostringstream disassembly_os; |
| 1998 std::vector<std::tuple<uint32_t, int, int>> offset_table; | 1997 std::vector<std::tuple<uint32_t, int, int>> offset_table; |
| 1999 | 1998 |
| 2000 PrintWasmText(compiled_module->module(), static_cast<uint32_t>(func_index), | 1999 PrintWasmText(compiled_module->module(), static_cast<uint32_t>(func_index), |
| 2001 disassembly_os, &offset_table); | 2000 disassembly_os, &offset_table); |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2372 MaybeHandle<String> WasmCompiledModule::GetFunctionName( | 2371 MaybeHandle<String> WasmCompiledModule::GetFunctionName( |
| 2373 Handle<WasmCompiledModule> compiled_module, uint32_t func_index) { | 2372 Handle<WasmCompiledModule> compiled_module, uint32_t func_index) { |
| 2374 DCHECK_LT(func_index, compiled_module->module()->functions.size()); | 2373 DCHECK_LT(func_index, compiled_module->module()->functions.size()); |
| 2375 WasmFunction& function = compiled_module->module()->functions[func_index]; | 2374 WasmFunction& function = compiled_module->module()->functions[func_index]; |
| 2376 Isolate* isolate = compiled_module->GetIsolate(); | 2375 Isolate* isolate = compiled_module->GetIsolate(); |
| 2377 MaybeHandle<String> string = ExtractStringFromModuleBytes( | 2376 MaybeHandle<String> string = ExtractStringFromModuleBytes( |
| 2378 isolate, compiled_module, function.name_offset, function.name_length); | 2377 isolate, compiled_module, function.name_offset, function.name_length); |
| 2379 if (!string.is_null()) return string.ToHandleChecked(); | 2378 if (!string.is_null()) return string.ToHandleChecked(); |
| 2380 return {}; | 2379 return {}; |
| 2381 } | 2380 } |
| OLD | NEW |