Chromium Code Reviews| 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/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 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1661 Script* script; | 1661 Script* script; |
| 1662 while ((script = iterator.Next())) { | 1662 while ((script = iterator.Next())) { |
| 1663 if (script->HasValidSource()) results->set(length++, script); | 1663 if (script->HasValidSource()) results->set(length++, script); |
| 1664 } | 1664 } |
| 1665 } | 1665 } |
| 1666 results->Shrink(length); | 1666 results->Shrink(length); |
| 1667 return results; | 1667 return results; |
| 1668 } | 1668 } |
| 1669 | 1669 |
| 1670 | 1670 |
| 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, | |
|
Yang
2016/03/10 01:48:24
This method can be removed as well, I think.
kozy
2016/03/10 02:05:13
Done!
| |
| 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) { | 1671 void Debug::RecordEvalCaller(Handle<Script> script) { |
| 1711 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL); | 1672 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL); |
| 1712 // For eval scripts add information on the function from which eval was | 1673 // For eval scripts add information on the function from which eval was |
| 1713 // called. | 1674 // called. |
| 1714 StackTraceFrameIterator it(script->GetIsolate()); | 1675 StackTraceFrameIterator it(script->GetIsolate()); |
| 1715 if (!it.done()) { | 1676 if (!it.done()) { |
| 1716 script->set_eval_from_shared(it.frame()->function()->shared()); | 1677 script->set_eval_from_shared(it.frame()->function()->shared()); |
| 1717 Code* code = it.frame()->LookupCode(); | 1678 Code* code = it.frame()->LookupCode(); |
| 1718 int offset = static_cast<int>( | 1679 int offset = static_cast<int>( |
| 1719 it.frame()->pc() - code->instruction_start()); | 1680 it.frame()->pc() - code->instruction_start()); |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2673 } | 2634 } |
| 2674 | 2635 |
| 2675 | 2636 |
| 2676 void LockingCommandMessageQueue::Clear() { | 2637 void LockingCommandMessageQueue::Clear() { |
| 2677 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2638 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
| 2678 queue_.Clear(); | 2639 queue_.Clear(); |
| 2679 } | 2640 } |
| 2680 | 2641 |
| 2681 } // namespace internal | 2642 } // namespace internal |
| 2682 } // namespace v8 | 2643 } // namespace v8 |
| OLD | NEW |