OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 9094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9105 if (script->type() != i::Script::TYPE_NORMAL) continue; | 9105 if (script->type() != i::Script::TYPE_NORMAL) continue; |
9106 if (script->HasValidSource()) { | 9106 if (script->HasValidSource()) { |
9107 i::HandleScope handle_scope(isolate); | 9107 i::HandleScope handle_scope(isolate); |
9108 i::Handle<i::Script> script_handle(script, isolate); | 9108 i::Handle<i::Script> script_handle(script, isolate); |
9109 scripts.Append(ToApiHandle<Script>(script_handle)); | 9109 scripts.Append(ToApiHandle<Script>(script_handle)); |
9110 } | 9110 } |
9111 } | 9111 } |
9112 } | 9112 } |
9113 } | 9113 } |
9114 | 9114 |
9115 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
| |
9116 DebugInterface::DisassembleWasmFunction(Isolate* v8_isolate, | |
9117 Local<Object> v8_script, | |
9118 int function_index) { | |
9119 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | |
9120 if (v8_script.IsEmpty()) return {}; | |
9121 i::Handle<i::Object> script_wrapper = Utils::OpenHandle(*v8_script); | |
9122 if (!script_wrapper->IsJSValue()) return {}; | |
9123 i::Handle<i::Object> script_obj( | |
9124 i::Handle<i::JSValue>::cast(script_wrapper)->value(), isolate); | |
9125 if (!script_obj->IsScript()) return {}; | |
9126 i::Handle<i::Script> script = i::Handle<i::Script>::cast(script_obj); | |
9127 if (script->type() != i::Script::TYPE_WASM) return {}; | |
9128 i::Handle<i::WasmCompiledModule> compiled_module( | |
9129 i::WasmCompiledModule::cast(script->wasm_compiled_module()), isolate); | |
9130 return i::wasm::DisassembleFunction(compiled_module, function_index); | |
9131 } | |
9132 | |
9115 Local<String> CpuProfileNode::GetFunctionName() const { | 9133 Local<String> CpuProfileNode::GetFunctionName() const { |
9116 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 9134 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
9117 i::Isolate* isolate = node->isolate(); | 9135 i::Isolate* isolate = node->isolate(); |
9118 const i::CodeEntry* entry = node->entry(); | 9136 const i::CodeEntry* entry = node->entry(); |
9119 i::Handle<i::String> name = | 9137 i::Handle<i::String> name = |
9120 isolate->factory()->InternalizeUtf8String(entry->name()); | 9138 isolate->factory()->InternalizeUtf8String(entry->name()); |
9121 if (!entry->has_name_prefix()) { | 9139 if (!entry->has_name_prefix()) { |
9122 return ToApiHandle<String>(name); | 9140 return ToApiHandle<String>(name); |
9123 } else { | 9141 } else { |
9124 // We do not expect this to fail. Change this if it does. | 9142 // We do not expect this to fail. Change this if it does. |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9793 Address callback_address = | 9811 Address callback_address = |
9794 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9812 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
9795 VMState<EXTERNAL> state(isolate); | 9813 VMState<EXTERNAL> state(isolate); |
9796 ExternalCallbackScope call_scope(isolate, callback_address); | 9814 ExternalCallbackScope call_scope(isolate, callback_address); |
9797 callback(info); | 9815 callback(info); |
9798 } | 9816 } |
9799 | 9817 |
9800 | 9818 |
9801 } // namespace internal | 9819 } // namespace internal |
9802 } // namespace v8 | 9820 } // namespace v8 |
OLD | NEW |