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

Unified Diff: src/api.cc

Issue 2655653003: [inspector] Expose GetPossibleBreakpoints for wasm (Closed)
Patch Set: Introduce Init method and clang-format wasm-translation.cc Created 3 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/debug/debug-interface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 8aa64cf93ee21cd187f829f3cc72e8bed9c133a5..598e575c624f519bf4166318d77c710df42402d7 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -9151,8 +9151,9 @@ bool debug::Script::GetPossibleBreakpoints(
CHECK(!start.IsEmpty());
i::Handle<i::Script> script = Utils::OpenHandle(this);
if (script->type() == i::Script::TYPE_WASM) {
- // TODO(clemensh): Return the proper thing once we support wasm breakpoints.
- return false;
+ i::Handle<i::WasmCompiledModule> compiled_module(
+ i::WasmCompiledModule::cast(script->wasm_compiled_module()));
+ return compiled_module->GetPossibleBreakpoints(start, end, locations);
}
i::Script::InitLineEnds(script);
@@ -9248,8 +9249,26 @@ int debug::WasmScript::NumImportedFunctions() const {
return static_cast<int>(compiled_module->module()->num_imported_functions);
}
+std::pair<int, int> debug::WasmScript::GetFunctionRange(
+ int function_index) 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_LE(0, function_index);
+ DCHECK_GT(compiled_module->module()->functions.size(), function_index);
+ i::wasm::WasmFunction& func =
+ compiled_module->module()->functions[function_index];
+ DCHECK_GE(i::kMaxInt, func.code_start_offset);
+ DCHECK_GE(i::kMaxInt, func.code_end_offset);
+ return std::make_pair(static_cast<int>(func.code_start_offset),
+ static_cast<int>(func.code_end_offset));
+}
+
debug::WasmDisassembly debug::WasmScript::DisassembleFunction(
int function_index) 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 =
« no previous file with comments | « no previous file | src/debug/debug-interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698