Chromium Code Reviews| Index: src/api.cc |
| diff --git a/src/api.cc b/src/api.cc |
| index 688e96136e91517a1fe9844af3980ff38313ca20..45cc7f91e206b9c240b1dde76288d59e232d28bd 100644 |
| --- a/src/api.cc |
| +++ b/src/api.cc |
| @@ -9101,6 +9101,42 @@ MaybeLocal<DebugInterface::Script> DebugInterface::Script::Wrap( |
| handle_scope.CloseAndEscape(script_obj)); |
| } |
| +DebugInterface::WasmScript* DebugInterface::WasmScript::Cast( |
| + DebugInterface::Script* script) { |
| + CHECK(script->IsWasm()); |
| + return static_cast<WasmScript*>(script); |
| +} |
| + |
| +int DebugInterface::WasmScript::NumFunction() const { |
|
titzer
2016/12/02 09:52:36
NumFunctions?
Clemens Hammacher
2016/12/02 10:38:09
Doh! Thanks.
|
| + i::DisallowHeapAllocation no_gc; |
| + i::Handle<i::Script> script = Utils::OpenHandle(this); |
| + DCHECK_EQ(i::Script::TYPE_WASM, script->type()); |
| + i::WasmCompiledModule* compiled_module = |
| + i::WasmCompiledModule::cast(script->wasm_compiled_module()); |
| + DCHECK_GE(i::kMaxInt, compiled_module->module()->functions.size()); |
| + return static_cast<int>(compiled_module->module()->functions.size()); |
| +} |
| + |
| +int DebugInterface::WasmScript::NumImportedFunction() const { |
| + i::DisallowHeapAllocation no_gc; |
| + i::Handle<i::Script> script = Utils::OpenHandle(this); |
| + DCHECK_EQ(i::Script::TYPE_WASM, script->type()); |
| + i::WasmCompiledModule* compiled_module = |
| + i::WasmCompiledModule::cast(script->wasm_compiled_module()); |
| + DCHECK_GE(i::kMaxInt, compiled_module->module()->num_imported_functions); |
| + return static_cast<int>(compiled_module->module()->num_imported_functions); |
| +} |
| + |
| +std::pair<std::string, std::vector<std::tuple<uint32_t, int, int>>> |
| +DebugInterface::WasmScript::DisassembleFunction(int function_index) { |
| + i::DisallowHeapAllocation no_gc; |
| + i::Handle<i::Script> script = Utils::OpenHandle(this); |
| + DCHECK_EQ(i::Script::TYPE_WASM, script->type()); |
| + i::WasmCompiledModule* compiled_module = |
| + i::WasmCompiledModule::cast(script->wasm_compiled_module()); |
| + return compiled_module->DisassembleFunction(function_index); |
| +} |
| + |
| DebugInterface::Location::Location(int lineNumber, int columnNumber) |
| : lineNumber_(lineNumber), columnNumber_(columnNumber) { |
| CHECK(lineNumber >= 0); |
| @@ -9146,24 +9182,6 @@ void DebugInterface::GetLoadedScripts( |
| } |
| } |
| -std::pair<std::string, std::vector<std::tuple<uint32_t, int, int>>> |
| -DebugInterface::DisassembleWasmFunction(Isolate* v8_isolate, |
| - Local<Object> v8_script, |
| - int function_index) { |
| - i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
| - if (v8_script.IsEmpty()) return {}; |
| - i::Handle<i::Object> script_wrapper = Utils::OpenHandle(*v8_script); |
| - if (!script_wrapper->IsJSValue()) return {}; |
| - i::Handle<i::Object> script_obj( |
| - i::Handle<i::JSValue>::cast(script_wrapper)->value(), isolate); |
| - if (!script_obj->IsScript()) return {}; |
| - i::Handle<i::Script> script = i::Handle<i::Script>::cast(script_obj); |
| - if (script->type() != i::Script::TYPE_WASM) return {}; |
| - i::Handle<i::WasmCompiledModule> compiled_module( |
| - i::WasmCompiledModule::cast(script->wasm_compiled_module()), isolate); |
| - return compiled_module->DisassembleFunction(function_index); |
| -} |
| - |
| MaybeLocal<UnboundScript> DebugInterface::CompileInspectorScript( |
| Isolate* v8_isolate, Local<String> source) { |
| i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |