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

Side by Side Diff: src/api.cc

Issue 2536763002: [inspector] [wasm] Implement GetPossibleBreakpoints (Closed)
Patch Set: Rebase Created 4 years 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') | no next file with comments »
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 8990 matching lines...) Expand 10 before | Expand all | Expand 10 after
9001 return i::Smi::cast(array->get(index))->value(); 9001 return i::Smi::cast(array->get(index))->value();
9002 } 9002 }
9003 } // namespace 9003 } // namespace
9004 9004
9005 bool DebugInterface::Script::GetPossibleBreakpoints( 9005 bool DebugInterface::Script::GetPossibleBreakpoints(
9006 const Location& start, const Location& end, 9006 const Location& start, const Location& end,
9007 std::vector<Location>* locations) const { 9007 std::vector<Location>* locations) const {
9008 CHECK(!start.IsEmpty()); 9008 CHECK(!start.IsEmpty());
9009 i::Handle<i::Script> script = Utils::OpenHandle(this); 9009 i::Handle<i::Script> script = Utils::OpenHandle(this);
9010 if (script->type() == i::Script::TYPE_WASM) { 9010 if (script->type() == i::Script::TYPE_WASM) {
9011 // TODO(clemensh): Return the proper thing once we support wasm breakpoints. 9011 i::Handle<i::WasmCompiledModule> compiled_module(
9012 return false; 9012 i::WasmCompiledModule::cast(script->wasm_compiled_module()));
9013 return compiled_module->GetPossibleBreakpoints(start, end, locations);
9013 } 9014 }
9014 9015
9015 i::Script::InitLineEnds(script); 9016 i::Script::InitLineEnds(script);
9016 CHECK(script->line_ends()->IsFixedArray()); 9017 CHECK(script->line_ends()->IsFixedArray());
9017 i::Isolate* isolate = script->GetIsolate(); 9018 i::Isolate* isolate = script->GetIsolate();
9018 i::Handle<i::FixedArray> line_ends = 9019 i::Handle<i::FixedArray> line_ends =
9019 i::Handle<i::FixedArray>::cast(i::handle(script->line_ends(), isolate)); 9020 i::Handle<i::FixedArray>::cast(i::handle(script->line_ends(), isolate));
9020 CHECK(line_ends->length()); 9021 CHECK(line_ends->length());
9021 9022
9022 int start_offset = GetSourcePosition(start); 9023 int start_offset = GetSourcePosition(start);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
9120 int DebugInterface::WasmScript::NumImportedFunctions() const { 9121 int DebugInterface::WasmScript::NumImportedFunctions() const {
9121 i::DisallowHeapAllocation no_gc; 9122 i::DisallowHeapAllocation no_gc;
9122 i::Handle<i::Script> script = Utils::OpenHandle(this); 9123 i::Handle<i::Script> script = Utils::OpenHandle(this);
9123 DCHECK_EQ(i::Script::TYPE_WASM, script->type()); 9124 DCHECK_EQ(i::Script::TYPE_WASM, script->type());
9124 i::WasmCompiledModule* compiled_module = 9125 i::WasmCompiledModule* compiled_module =
9125 i::WasmCompiledModule::cast(script->wasm_compiled_module()); 9126 i::WasmCompiledModule::cast(script->wasm_compiled_module());
9126 DCHECK_GE(i::kMaxInt, compiled_module->module()->num_imported_functions); 9127 DCHECK_GE(i::kMaxInt, compiled_module->module()->num_imported_functions);
9127 return static_cast<int>(compiled_module->module()->num_imported_functions); 9128 return static_cast<int>(compiled_module->module()->num_imported_functions);
9128 } 9129 }
9129 9130
9131 std::pair<int, int> DebugInterface::WasmScript::GetFunctionRange(
9132 int function_index) const {
9133 i::DisallowHeapAllocation no_gc;
9134 i::Handle<i::Script> script = Utils::OpenHandle(this);
9135 DCHECK_EQ(i::Script::TYPE_WASM, script->type());
9136 i::WasmCompiledModule* compiled_module =
9137 i::WasmCompiledModule::cast(script->wasm_compiled_module());
9138 DCHECK_LE(0, function_index);
9139 DCHECK_GT(compiled_module->module()->functions.size(), function_index);
9140 i::wasm::WasmFunction& func =
9141 compiled_module->module()->functions[function_index];
9142 DCHECK_GE(i::kMaxInt, func.code_start_offset);
9143 DCHECK_GE(i::kMaxInt, func.code_end_offset);
9144 return std::make_pair(static_cast<int>(func.code_start_offset),
9145 static_cast<int>(func.code_end_offset));
9146 }
9147
9130 std::pair<std::string, std::vector<std::tuple<uint32_t, int, int>>> 9148 std::pair<std::string, std::vector<std::tuple<uint32_t, int, int>>>
9131 DebugInterface::WasmScript::DisassembleFunction(int function_index) { 9149 DebugInterface::WasmScript::DisassembleFunction(int function_index) {
9132 i::DisallowHeapAllocation no_gc; 9150 i::DisallowHeapAllocation no_gc;
9133 i::Handle<i::Script> script = Utils::OpenHandle(this); 9151 i::Handle<i::Script> script = Utils::OpenHandle(this);
9134 DCHECK_EQ(i::Script::TYPE_WASM, script->type()); 9152 DCHECK_EQ(i::Script::TYPE_WASM, script->type());
9135 i::WasmCompiledModule* compiled_module = 9153 i::WasmCompiledModule* compiled_module =
9136 i::WasmCompiledModule::cast(script->wasm_compiled_module()); 9154 i::WasmCompiledModule::cast(script->wasm_compiled_module());
9137 return compiled_module->DisassembleFunction(function_index); 9155 return compiled_module->DisassembleFunction(function_index);
9138 } 9156 }
9139 9157
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
9882 Address callback_address = 9900 Address callback_address =
9883 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9901 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9884 VMState<EXTERNAL> state(isolate); 9902 VMState<EXTERNAL> state(isolate);
9885 ExternalCallbackScope call_scope(isolate, callback_address); 9903 ExternalCallbackScope call_scope(isolate, callback_address);
9886 callback(info); 9904 callback(info);
9887 } 9905 }
9888 9906
9889 9907
9890 } // namespace internal 9908 } // namespace internal
9891 } // namespace v8 9909 } // namespace v8
OLDNEW
« 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