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

Side by Side Diff: src/debug/debug.cc

Issue 1770383006: [debugger] Removed unused GetStepInPositions method (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Removed BreakLocation::FromCodeOffsetSameStatement Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « src/debug/debug.h ('k') | src/debug/mirrors.js » ('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/debug/debug.h" 5 #include "src/debug/debug.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 } 264 }
265 265
266 BreakLocation BreakLocation::FromFrame(Handle<DebugInfo> debug_info, 266 BreakLocation BreakLocation::FromFrame(Handle<DebugInfo> debug_info,
267 JavaScriptFrame* frame) { 267 JavaScriptFrame* frame) {
268 FrameSummary summary = GetFirstFrameSummary(frame); 268 FrameSummary summary = GetFirstFrameSummary(frame);
269 int call_offset = 269 int call_offset =
270 CallOffsetFromCodeOffset(summary.code_offset(), frame->is_interpreted()); 270 CallOffsetFromCodeOffset(summary.code_offset(), frame->is_interpreted());
271 return FromCodeOffset(debug_info, call_offset); 271 return FromCodeOffset(debug_info, call_offset);
272 } 272 }
273 273
274 // Find the break point at the supplied address, or the closest one before
275 // the address.
276 void BreakLocation::FromCodeOffsetSameStatement(
277 Handle<DebugInfo> debug_info, int offset, List<BreakLocation>* result_out) {
278 int break_index = BreakIndexFromCodeOffset(debug_info, offset);
279 base::SmartPointer<Iterator> it(GetIterator(debug_info));
280 it->SkipTo(break_index);
281 int statement_position = it->statement_position();
282 while (!it->Done() && it->statement_position() == statement_position) {
283 result_out->Add(it->GetBreakLocation());
284 it->Next();
285 }
286 }
287
288
289 void BreakLocation::AllForStatementPosition(Handle<DebugInfo> debug_info, 274 void BreakLocation::AllForStatementPosition(Handle<DebugInfo> debug_info,
290 int statement_position, 275 int statement_position,
291 List<BreakLocation>* result_out) { 276 List<BreakLocation>* result_out) {
292 for (base::SmartPointer<Iterator> it(GetIterator(debug_info)); !it->Done(); 277 for (base::SmartPointer<Iterator> it(GetIterator(debug_info)); !it->Done();
293 it->Next()) { 278 it->Next()) {
294 if (it->statement_position() == statement_position) { 279 if (it->statement_position() == statement_position) {
295 result_out->Add(it->GetBreakLocation()); 280 result_out->Add(it->GetBreakLocation());
296 } 281 }
297 } 282 }
298 } 283 }
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 Script* script; 1646 Script* script;
1662 while ((script = iterator.Next())) { 1647 while ((script = iterator.Next())) {
1663 if (script->HasValidSource()) results->set(length++, script); 1648 if (script->HasValidSource()) results->set(length++, script);
1664 } 1649 }
1665 } 1650 }
1666 results->Shrink(length); 1651 results->Shrink(length);
1667 return results; 1652 return results;
1668 } 1653 }
1669 1654
1670 1655
1671 void Debug::GetStepinPositions(JavaScriptFrame* frame, StackFrame::Id frame_id,
1672 List<int>* results_out) {
1673 FrameSummary summary = GetFirstFrameSummary(frame);
1674
1675 Handle<JSFunction> fun = Handle<JSFunction>(summary.function());
1676 Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo>(fun->shared());
1677
1678 if (!EnsureDebugInfo(shared, fun)) return;
1679
1680 Handle<DebugInfo> debug_info(shared->GetDebugInfo());
1681 // Refresh frame summary if the code has been recompiled for debugging.
1682 if (AbstractCode::cast(shared->code()) != *summary.abstract_code()) {
1683 summary = GetFirstFrameSummary(frame);
1684 }
1685
1686 int call_offset =
1687 CallOffsetFromCodeOffset(summary.code_offset(), frame->is_interpreted());
1688 List<BreakLocation> locations;
1689 BreakLocation::FromCodeOffsetSameStatement(debug_info, call_offset,
1690 &locations);
1691
1692 for (BreakLocation location : locations) {
1693 if (location.code_offset() <= summary.code_offset()) {
1694 // The break point is near our pc. Could be a step-in possibility,
1695 // that is currently taken by active debugger call.
1696 if (break_frame_id() == StackFrame::NO_ID) {
1697 continue; // We are not stepping.
1698 } else {
1699 JavaScriptFrameIterator frame_it(isolate_, break_frame_id());
1700 // If our frame is a top frame and we are stepping, we can do step-in
1701 // at this place.
1702 if (frame_it.frame()->id() != frame_id) continue;
1703 }
1704 }
1705 if (location.IsCall()) results_out->Add(location.position());
1706 }
1707 }
1708
1709
1710 void Debug::RecordEvalCaller(Handle<Script> script) { 1656 void Debug::RecordEvalCaller(Handle<Script> script) {
1711 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL); 1657 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL);
1712 // For eval scripts add information on the function from which eval was 1658 // For eval scripts add information on the function from which eval was
1713 // called. 1659 // called.
1714 StackTraceFrameIterator it(script->GetIsolate()); 1660 StackTraceFrameIterator it(script->GetIsolate());
1715 if (!it.done()) { 1661 if (!it.done()) {
1716 script->set_eval_from_shared(it.frame()->function()->shared()); 1662 script->set_eval_from_shared(it.frame()->function()->shared());
1717 Code* code = it.frame()->LookupCode(); 1663 Code* code = it.frame()->LookupCode();
1718 int offset = static_cast<int>( 1664 int offset = static_cast<int>(
1719 it.frame()->pc() - code->instruction_start()); 1665 it.frame()->pc() - code->instruction_start());
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
2673 } 2619 }
2674 2620
2675 2621
2676 void LockingCommandMessageQueue::Clear() { 2622 void LockingCommandMessageQueue::Clear() {
2677 base::LockGuard<base::Mutex> lock_guard(&mutex_); 2623 base::LockGuard<base::Mutex> lock_guard(&mutex_);
2678 queue_.Clear(); 2624 queue_.Clear();
2679 } 2625 }
2680 2626
2681 } // namespace internal 2627 } // namespace internal
2682 } // namespace v8 2628 } // namespace v8
OLDNEW
« no previous file with comments | « src/debug/debug.h ('k') | src/debug/mirrors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698