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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } else { | 91 } else { |
92 return 0; | 92 return 0; |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 BreakLocation::CodeIterator::CodeIterator(Handle<DebugInfo> debug_info, | 96 BreakLocation::CodeIterator::CodeIterator(Handle<DebugInfo> debug_info, |
97 BreakLocatorType type) | 97 BreakLocatorType type) |
98 : Iterator(debug_info), | 98 : Iterator(debug_info), |
99 reloc_iterator_(debug_info->abstract_code()->GetCode(), | 99 reloc_iterator_(debug_info->abstract_code()->GetCode(), |
100 GetModeMask(type)) { | 100 GetModeMask(type)) { |
101 if (!Done()) Next(); | 101 // There is at least one break location. |
| 102 DCHECK(!Done()); |
| 103 Next(); |
102 } | 104 } |
103 | 105 |
104 int BreakLocation::CodeIterator::GetModeMask(BreakLocatorType type) { | 106 int BreakLocation::CodeIterator::GetModeMask(BreakLocatorType type) { |
105 int mask = 0; | 107 int mask = 0; |
106 mask |= RelocInfo::ModeMask(RelocInfo::POSITION); | 108 mask |= RelocInfo::ModeMask(RelocInfo::POSITION); |
107 mask |= RelocInfo::ModeMask(RelocInfo::STATEMENT_POSITION); | 109 mask |= RelocInfo::ModeMask(RelocInfo::STATEMENT_POSITION); |
108 mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_RETURN); | 110 mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_RETURN); |
109 mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_CALL); | 111 mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_CALL); |
110 if (type == ALL_BREAK_LOCATIONS) { | 112 if (type == ALL_BREAK_LOCATIONS) { |
111 mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION); | 113 mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 174 } |
173 | 175 |
174 BreakLocation::BytecodeArrayIterator::BytecodeArrayIterator( | 176 BreakLocation::BytecodeArrayIterator::BytecodeArrayIterator( |
175 Handle<DebugInfo> debug_info, BreakLocatorType type) | 177 Handle<DebugInfo> debug_info, BreakLocatorType type) |
176 : Iterator(debug_info), | 178 : Iterator(debug_info), |
177 source_position_iterator_(debug_info->abstract_code() | 179 source_position_iterator_(debug_info->abstract_code() |
178 ->GetBytecodeArray() | 180 ->GetBytecodeArray() |
179 ->source_position_table()), | 181 ->source_position_table()), |
180 break_locator_type_(type), | 182 break_locator_type_(type), |
181 start_position_(debug_info->shared()->start_position()) { | 183 start_position_(debug_info->shared()->start_position()) { |
182 if (!Done()) Next(); | 184 // There is at least one break location. |
| 185 DCHECK(!Done()); |
| 186 Next(); |
183 } | 187 } |
184 | 188 |
185 void BreakLocation::BytecodeArrayIterator::Next() { | 189 void BreakLocation::BytecodeArrayIterator::Next() { |
186 DisallowHeapAllocation no_gc; | 190 DisallowHeapAllocation no_gc; |
187 DCHECK(!Done()); | 191 DCHECK(!Done()); |
188 bool first = break_index_ == -1; | 192 bool first = break_index_ == -1; |
189 while (!Done()) { | 193 while (!Done()) { |
190 if (!first) source_position_iterator_.Advance(); | 194 if (!first) source_position_iterator_.Advance(); |
191 first = false; | 195 first = false; |
192 if (Done()) return; | 196 if (Done()) return; |
(...skipping 2471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2664 } | 2668 } |
2665 | 2669 |
2666 | 2670 |
2667 void LockingCommandMessageQueue::Clear() { | 2671 void LockingCommandMessageQueue::Clear() { |
2668 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2672 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2669 queue_.Clear(); | 2673 queue_.Clear(); |
2670 } | 2674 } |
2671 | 2675 |
2672 } // namespace internal | 2676 } // namespace internal |
2673 } // namespace v8 | 2677 } // namespace v8 |
OLD | NEW |