Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(886)

Side by Side Diff: src/api.cc

Issue 2493773003: [inspector] Introduce translation of wasm frames (Closed)
Patch Set: More signed/unsigned Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/debug/debug-interface.h » ('j') | src/debug/debug-interface.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9065 matching lines...) Expand 10 before | Expand all | Expand 10 after
9076 if (script->type() != i::Script::TYPE_NORMAL) continue; 9076 if (script->type() != i::Script::TYPE_NORMAL) continue;
9077 if (script->HasValidSource()) { 9077 if (script->HasValidSource()) {
9078 i::HandleScope handle_scope(isolate); 9078 i::HandleScope handle_scope(isolate);
9079 i::Handle<i::Script> script_handle(script, isolate); 9079 i::Handle<i::Script> script_handle(script, isolate);
9080 scripts.Append(ToApiHandle<Script>(script_handle)); 9080 scripts.Append(ToApiHandle<Script>(script_handle));
9081 } 9081 }
9082 } 9082 }
9083 } 9083 }
9084 } 9084 }
9085 9085
9086 std::pair<std::string, std::vector<std::tuple<uint32_t, int, int>>>
9087 DebugInterface::DisassembleWasmFunction(Isolate* v8_isolate,
9088 Local<Object> v8_script,
9089 int function_index) {
9090 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
9091 if (v8_script.IsEmpty()) return {};
9092 i::Handle<i::Object> script_wrapper = Utils::OpenHandle(*v8_script);
9093 if (!script_wrapper->IsJSValue()) return {};
9094 i::Handle<i::Object> script_obj(
9095 i::Handle<i::JSValue>::cast(script_wrapper)->value(), isolate);
9096 if (!script_obj->IsScript()) return {};
9097 i::Handle<i::Script> script = i::Handle<i::Script>::cast(script_obj);
9098 if (script->type() != i::Script::TYPE_WASM) return {};
9099 i::Handle<i::wasm::WasmCompiledModule> compiled_module(
9100 i::wasm::WasmCompiledModule::cast(script->wasm_compiled_module()),
9101 isolate);
9102 return i::wasm::DisassembleFunction(compiled_module, function_index);
9103 }
9104
9086 Local<String> CpuProfileNode::GetFunctionName() const { 9105 Local<String> CpuProfileNode::GetFunctionName() const {
9087 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 9106 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
9088 i::Isolate* isolate = node->isolate(); 9107 i::Isolate* isolate = node->isolate();
9089 const i::CodeEntry* entry = node->entry(); 9108 const i::CodeEntry* entry = node->entry();
9090 i::Handle<i::String> name = 9109 i::Handle<i::String> name =
9091 isolate->factory()->InternalizeUtf8String(entry->name()); 9110 isolate->factory()->InternalizeUtf8String(entry->name());
9092 if (!entry->has_name_prefix()) { 9111 if (!entry->has_name_prefix()) {
9093 return ToApiHandle<String>(name); 9112 return ToApiHandle<String>(name);
9094 } else { 9113 } else {
9095 // We do not expect this to fail. Change this if it does. 9114 // We do not expect this to fail. Change this if it does.
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
9764 Address callback_address = 9783 Address callback_address =
9765 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9784 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9766 VMState<EXTERNAL> state(isolate); 9785 VMState<EXTERNAL> state(isolate);
9767 ExternalCallbackScope call_scope(isolate, callback_address); 9786 ExternalCallbackScope call_scope(isolate, callback_address);
9768 callback(info); 9787 callback(info);
9769 } 9788 }
9770 9789
9771 9790
9772 } // namespace internal 9791 } // namespace internal
9773 } // namespace v8 9792 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/debug/debug-interface.h » ('j') | src/debug/debug-interface.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698