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 // Put GetFirstFrameSummary Declaration here as FromFrame use it. | |
153 FrameSummary GetFirstFrameSummary(JavaScriptFrame* frame); | |
Yang
2016/02/05 08:49:34
Can you simply move the function definition to her
| |
152 BreakLocation BreakLocation::FromFrame(Handle<DebugInfo> debug_info, | 154 BreakLocation BreakLocation::FromFrame(Handle<DebugInfo> debug_info, |
153 JavaScriptFrame* frame) { | 155 JavaScriptFrame* frame) { |
154 // Code offset to the instruction after the current one, possibly a break | 156 // 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. | 157 // location as well. So the "- 1" to exclude it from the search. |
156 Code* code = frame->LookupCode(); | 158 // Get code offset from the unoptimized code. |
157 int code_offset = static_cast<int>(frame->pc() - code->instruction_start()); | 159 FrameSummary summary = GetFirstFrameSummary(frame); |
158 return FromCodeOffset(debug_info, code_offset - 1); | 160 Handle<JSFunction> function(summary.function()); |
Yang
2016/02/05 08:49:34
You don't need to refresh the frame summary here.
| |
161 Handle<SharedFunctionInfo> shared(function->shared()); | |
162 // Refresh frame summary if the code has been recompiled for debugging. | |
163 if (AbstractCode::cast(shared->code()) != *summary.abstract_code()) { | |
164 summary = GetFirstFrameSummary(frame); | |
165 } | |
166 | |
167 return FromCodeOffset(debug_info, summary.code_offset() - 1); | |
159 } | 168 } |
160 | 169 |
161 // Find the break point at the supplied address, or the closest one before | 170 // Find the break point at the supplied address, or the closest one before |
162 // the address. | 171 // the address. |
163 void BreakLocation::FromCodeOffsetSameStatement( | 172 void BreakLocation::FromCodeOffsetSameStatement( |
164 Handle<DebugInfo> debug_info, int offset, List<BreakLocation>* result_out) { | 173 Handle<DebugInfo> debug_info, int offset, List<BreakLocation>* result_out) { |
165 int break_index = BreakIndexFromCodeOffset(debug_info, offset); | 174 int break_index = BreakIndexFromCodeOffset(debug_info, offset); |
166 Iterator it(debug_info, ALL_BREAK_LOCATIONS); | 175 Iterator it(debug_info, ALL_BREAK_LOCATIONS); |
167 it.SkipTo(break_index); | 176 it.SkipTo(break_index); |
168 int statement_position = it.statement_position(); | 177 int statement_position = it.statement_position(); |
(...skipping 2291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2460 } | 2469 } |
2461 | 2470 |
2462 | 2471 |
2463 void LockingCommandMessageQueue::Clear() { | 2472 void LockingCommandMessageQueue::Clear() { |
2464 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2473 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2465 queue_.Clear(); | 2474 queue_.Clear(); |
2466 } | 2475 } |
2467 | 2476 |
2468 } // namespace internal | 2477 } // namespace internal |
2469 } // namespace v8 | 2478 } // namespace v8 |
OLD | NEW |