| 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 9133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9144 return i::Smi::cast(array->get(index))->value(); | 9144 return i::Smi::cast(array->get(index))->value(); |
| 9145 } | 9145 } |
| 9146 } // namespace | 9146 } // namespace |
| 9147 | 9147 |
| 9148 bool debug::Script::GetPossibleBreakpoints( | 9148 bool debug::Script::GetPossibleBreakpoints( |
| 9149 const debug::Location& start, const debug::Location& end, | 9149 const debug::Location& start, const debug::Location& end, |
| 9150 std::vector<debug::Location>* locations) const { | 9150 std::vector<debug::Location>* locations) const { |
| 9151 CHECK(!start.IsEmpty()); | 9151 CHECK(!start.IsEmpty()); |
| 9152 i::Handle<i::Script> script = Utils::OpenHandle(this); | 9152 i::Handle<i::Script> script = Utils::OpenHandle(this); |
| 9153 if (script->type() == i::Script::TYPE_WASM) { | 9153 if (script->type() == i::Script::TYPE_WASM) { |
| 9154 // TODO(clemensh): Return the proper thing once we support wasm breakpoints. | 9154 i::Handle<i::WasmCompiledModule> compiled_module( |
| 9155 return false; | 9155 i::WasmCompiledModule::cast(script->wasm_compiled_module())); |
| 9156 return compiled_module->GetPossibleBreakpoints(start, end, locations); |
| 9156 } | 9157 } |
| 9157 | 9158 |
| 9158 i::Script::InitLineEnds(script); | 9159 i::Script::InitLineEnds(script); |
| 9159 CHECK(script->line_ends()->IsFixedArray()); | 9160 CHECK(script->line_ends()->IsFixedArray()); |
| 9160 i::Isolate* isolate = script->GetIsolate(); | 9161 i::Isolate* isolate = script->GetIsolate(); |
| 9161 i::Handle<i::FixedArray> line_ends = | 9162 i::Handle<i::FixedArray> line_ends = |
| 9162 i::Handle<i::FixedArray>::cast(i::handle(script->line_ends(), isolate)); | 9163 i::Handle<i::FixedArray>::cast(i::handle(script->line_ends(), isolate)); |
| 9163 CHECK(line_ends->length()); | 9164 CHECK(line_ends->length()); |
| 9164 | 9165 |
| 9165 int start_offset = GetSourcePosition(start); | 9166 int start_offset = GetSourcePosition(start); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9241 int debug::WasmScript::NumImportedFunctions() const { | 9242 int debug::WasmScript::NumImportedFunctions() const { |
| 9242 i::DisallowHeapAllocation no_gc; | 9243 i::DisallowHeapAllocation no_gc; |
| 9243 i::Handle<i::Script> script = Utils::OpenHandle(this); | 9244 i::Handle<i::Script> script = Utils::OpenHandle(this); |
| 9244 DCHECK_EQ(i::Script::TYPE_WASM, script->type()); | 9245 DCHECK_EQ(i::Script::TYPE_WASM, script->type()); |
| 9245 i::WasmCompiledModule* compiled_module = | 9246 i::WasmCompiledModule* compiled_module = |
| 9246 i::WasmCompiledModule::cast(script->wasm_compiled_module()); | 9247 i::WasmCompiledModule::cast(script->wasm_compiled_module()); |
| 9247 DCHECK_GE(i::kMaxInt, compiled_module->module()->num_imported_functions); | 9248 DCHECK_GE(i::kMaxInt, compiled_module->module()->num_imported_functions); |
| 9248 return static_cast<int>(compiled_module->module()->num_imported_functions); | 9249 return static_cast<int>(compiled_module->module()->num_imported_functions); |
| 9249 } | 9250 } |
| 9250 | 9251 |
| 9252 std::pair<int, int> debug::WasmScript::GetFunctionRange( |
| 9253 int function_index) const { |
| 9254 i::DisallowHeapAllocation no_gc; |
| 9255 i::Handle<i::Script> script = Utils::OpenHandle(this); |
| 9256 DCHECK_EQ(i::Script::TYPE_WASM, script->type()); |
| 9257 i::WasmCompiledModule* compiled_module = |
| 9258 i::WasmCompiledModule::cast(script->wasm_compiled_module()); |
| 9259 DCHECK_LE(0, function_index); |
| 9260 DCHECK_GT(compiled_module->module()->functions.size(), function_index); |
| 9261 i::wasm::WasmFunction& func = |
| 9262 compiled_module->module()->functions[function_index]; |
| 9263 DCHECK_GE(i::kMaxInt, func.code_start_offset); |
| 9264 DCHECK_GE(i::kMaxInt, func.code_end_offset); |
| 9265 return std::make_pair(static_cast<int>(func.code_start_offset), |
| 9266 static_cast<int>(func.code_end_offset)); |
| 9267 } |
| 9268 |
| 9251 debug::WasmDisassembly debug::WasmScript::DisassembleFunction( | 9269 debug::WasmDisassembly debug::WasmScript::DisassembleFunction( |
| 9252 int function_index) const { | 9270 int function_index) const { |
| 9271 i::DisallowHeapAllocation no_gc; |
| 9253 i::Handle<i::Script> script = Utils::OpenHandle(this); | 9272 i::Handle<i::Script> script = Utils::OpenHandle(this); |
| 9254 DCHECK_EQ(i::Script::TYPE_WASM, script->type()); | 9273 DCHECK_EQ(i::Script::TYPE_WASM, script->type()); |
| 9255 i::WasmCompiledModule* compiled_module = | 9274 i::WasmCompiledModule* compiled_module = |
| 9256 i::WasmCompiledModule::cast(script->wasm_compiled_module()); | 9275 i::WasmCompiledModule::cast(script->wasm_compiled_module()); |
| 9257 return compiled_module->DisassembleFunction(function_index); | 9276 return compiled_module->DisassembleFunction(function_index); |
| 9258 } | 9277 } |
| 9259 | 9278 |
| 9260 debug::Location::Location(int line_number, int column_number) | 9279 debug::Location::Location(int line_number, int column_number) |
| 9261 : line_number_(line_number), column_number_(column_number) { | 9280 : line_number_(line_number), column_number_(column_number) { |
| 9262 CHECK(line_number >= 0); | 9281 CHECK(line_number >= 0); |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10023 Address callback_address = | 10042 Address callback_address = |
| 10024 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10043 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 10025 VMState<EXTERNAL> state(isolate); | 10044 VMState<EXTERNAL> state(isolate); |
| 10026 ExternalCallbackScope call_scope(isolate, callback_address); | 10045 ExternalCallbackScope call_scope(isolate, callback_address); |
| 10027 callback(info); | 10046 callback(info); |
| 10028 } | 10047 } |
| 10029 | 10048 |
| 10030 | 10049 |
| 10031 } // namespace internal | 10050 } // namespace internal |
| 10032 } // namespace v8 | 10051 } // namespace v8 |
| OLD | NEW |