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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 // Find the break point at the supplied address, or the closest one before | 143 // Find the break point at the supplied address, or the closest one before |
144 // the address. | 144 // the address. |
145 BreakLocation BreakLocation::FromCodeOffset(Handle<DebugInfo> debug_info, | 145 BreakLocation BreakLocation::FromCodeOffset(Handle<DebugInfo> debug_info, |
146 int offset) { | 146 int offset) { |
147 Iterator it(debug_info, ALL_BREAK_LOCATIONS); | 147 Iterator it(debug_info, ALL_BREAK_LOCATIONS); |
148 it.SkipTo(BreakIndexFromCodeOffset(debug_info, offset)); | 148 it.SkipTo(BreakIndexFromCodeOffset(debug_info, offset)); |
149 return it.GetBreakLocation(); | 149 return it.GetBreakLocation(); |
150 } | 150 } |
151 | 151 |
| 152 // Move GetFirstFrameSummary Definition to here as FromFrame use it. |
| 153 FrameSummary GetFirstFrameSummary(JavaScriptFrame* frame) { |
| 154 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); |
| 155 frame->Summarize(&frames); |
| 156 return frames.first(); |
| 157 } |
| 158 |
152 BreakLocation BreakLocation::FromFrame(Handle<DebugInfo> debug_info, | 159 BreakLocation BreakLocation::FromFrame(Handle<DebugInfo> debug_info, |
153 JavaScriptFrame* frame) { | 160 JavaScriptFrame* frame) { |
154 // Code offset to the instruction after the current one, possibly a break | 161 // Code offset to the instruction after the current one, possibly a break |
155 // location as well. So the "- 1" to exclude it from the search. | 162 // location as well. So the "- 1" to exclude it from the search. |
156 Code* code = frame->LookupCode(); | 163 // Get code offset from the unoptimized code. |
157 int code_offset = static_cast<int>(frame->pc() - code->instruction_start()); | 164 FrameSummary summary = GetFirstFrameSummary(frame); |
158 return FromCodeOffset(debug_info, code_offset - 1); | 165 return FromCodeOffset(debug_info, summary.code_offset() - 1); |
159 } | 166 } |
160 | 167 |
161 // Find the break point at the supplied address, or the closest one before | 168 // Find the break point at the supplied address, or the closest one before |
162 // the address. | 169 // the address. |
163 void BreakLocation::FromCodeOffsetSameStatement( | 170 void BreakLocation::FromCodeOffsetSameStatement( |
164 Handle<DebugInfo> debug_info, int offset, List<BreakLocation>* result_out) { | 171 Handle<DebugInfo> debug_info, int offset, List<BreakLocation>* result_out) { |
165 int break_index = BreakIndexFromCodeOffset(debug_info, offset); | 172 int break_index = BreakIndexFromCodeOffset(debug_info, offset); |
166 Iterator it(debug_info, ALL_BREAK_LOCATIONS); | 173 Iterator it(debug_info, ALL_BREAK_LOCATIONS); |
167 it.SkipTo(break_index); | 174 it.SkipTo(break_index); |
168 int statement_position = it.statement_position(); | 175 int statement_position = it.statement_position(); |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 | 794 |
788 bool Debug::IsBreakOnException(ExceptionBreakType type) { | 795 bool Debug::IsBreakOnException(ExceptionBreakType type) { |
789 if (type == BreakUncaughtException) { | 796 if (type == BreakUncaughtException) { |
790 return break_on_uncaught_exception_; | 797 return break_on_uncaught_exception_; |
791 } else { | 798 } else { |
792 return break_on_exception_; | 799 return break_on_exception_; |
793 } | 800 } |
794 } | 801 } |
795 | 802 |
796 | 803 |
797 FrameSummary GetFirstFrameSummary(JavaScriptFrame* frame) { | |
798 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); | |
799 frame->Summarize(&frames); | |
800 return frames.first(); | |
801 } | |
802 | |
803 | |
804 void Debug::PrepareStepIn(Handle<JSFunction> function) { | 804 void Debug::PrepareStepIn(Handle<JSFunction> function) { |
805 if (!is_active()) return; | 805 if (!is_active()) return; |
806 if (last_step_action() < StepIn) return; | 806 if (last_step_action() < StepIn) return; |
807 if (in_debug_scope()) return; | 807 if (in_debug_scope()) return; |
808 if (thread_local_.step_in_enabled_) { | 808 if (thread_local_.step_in_enabled_) { |
809 FloodWithOneShot(function); | 809 FloodWithOneShot(function); |
810 } | 810 } |
811 } | 811 } |
812 | 812 |
813 | 813 |
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2460 } | 2460 } |
2461 | 2461 |
2462 | 2462 |
2463 void LockingCommandMessageQueue::Clear() { | 2463 void LockingCommandMessageQueue::Clear() { |
2464 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2464 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2465 queue_.Clear(); | 2465 queue_.Clear(); |
2466 } | 2466 } |
2467 | 2467 |
2468 } // namespace internal | 2468 } // namespace internal |
2469 } // namespace v8 | 2469 } // namespace v8 |
OLD | NEW |