Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 2fc18115c77c53b36ec8e9017c9b6ec5a20a1412..5f9842581102275adbb9f5b2b24435176b901d26 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -9112,6 +9112,24 @@ void DebugInterface::GetLoadedScripts( |
} |
} |
+std::pair<std::string, std::vector<std::tuple<uint32_t, int, int>>> |
Yang
2016/11/16 20:41:12
I have absolutely no idea what type I'm looking at
Clemens Hammacher
2016/11/16 22:43:31
We can either do this, or clean it up a bit by typ
|
+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 i::wasm::DisassembleFunction(compiled_module, function_index); |
+} |
+ |
Local<String> CpuProfileNode::GetFunctionName() const { |
const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
i::Isolate* isolate = node->isolate(); |