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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return new CodeIterator(debug_info, type); | 77 return new CodeIterator(debug_info, type); |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 BreakLocation::Iterator::Iterator(Handle<DebugInfo> debug_info) | 81 BreakLocation::Iterator::Iterator(Handle<DebugInfo> debug_info) |
82 : debug_info_(debug_info), | 82 : debug_info_(debug_info), |
83 break_index_(-1), | 83 break_index_(-1), |
84 position_(1), | 84 position_(1), |
85 statement_position_(1) {} | 85 statement_position_(1) {} |
86 | 86 |
| 87 int BreakLocation::Iterator::ReturnPosition() { |
| 88 if (debug_info_->shared()->HasSourceCode()) { |
| 89 return debug_info_->shared()->end_position() - |
| 90 debug_info_->shared()->start_position() - 1; |
| 91 } else { |
| 92 return 0; |
| 93 } |
| 94 } |
| 95 |
87 BreakLocation::CodeIterator::CodeIterator(Handle<DebugInfo> debug_info, | 96 BreakLocation::CodeIterator::CodeIterator(Handle<DebugInfo> debug_info, |
88 BreakLocatorType type) | 97 BreakLocatorType type) |
89 : Iterator(debug_info), | 98 : Iterator(debug_info), |
90 reloc_iterator_(debug_info->abstract_code()->GetCode(), | 99 reloc_iterator_(debug_info->abstract_code()->GetCode(), |
91 GetModeMask(type)) { | 100 GetModeMask(type)) { |
92 if (!Done()) Next(); | 101 if (!Done()) Next(); |
93 } | 102 } |
94 | 103 |
95 int BreakLocation::CodeIterator::GetModeMask(BreakLocatorType type) { | 104 int BreakLocation::CodeIterator::GetModeMask(BreakLocatorType type) { |
96 int mask = 0; | 105 int mask = 0; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 DCHECK(position_ >= 0); | 139 DCHECK(position_ >= 0); |
131 DCHECK(statement_position_ >= 0); | 140 DCHECK(statement_position_ >= 0); |
132 continue; | 141 continue; |
133 } | 142 } |
134 | 143 |
135 DCHECK(RelocInfo::IsDebugBreakSlot(rmode()) || | 144 DCHECK(RelocInfo::IsDebugBreakSlot(rmode()) || |
136 RelocInfo::IsDebuggerStatement(rmode())); | 145 RelocInfo::IsDebuggerStatement(rmode())); |
137 | 146 |
138 if (RelocInfo::IsDebugBreakSlotAtReturn(rmode())) { | 147 if (RelocInfo::IsDebugBreakSlotAtReturn(rmode())) { |
139 // Set the positions to the end of the function. | 148 // Set the positions to the end of the function. |
140 if (debug_info_->shared()->HasSourceCode()) { | 149 statement_position_ = position_ = ReturnPosition(); |
141 position_ = debug_info_->shared()->end_position() - | |
142 debug_info_->shared()->start_position() - 1; | |
143 } else { | |
144 position_ = 0; | |
145 } | |
146 statement_position_ = position_; | |
147 } | 150 } |
148 | 151 |
149 break; | 152 break; |
150 } | 153 } |
151 break_index_++; | 154 break_index_++; |
152 } | 155 } |
153 | 156 |
154 BreakLocation BreakLocation::CodeIterator::GetBreakLocation() { | 157 BreakLocation BreakLocation::CodeIterator::GetBreakLocation() { |
155 DebugBreakType type; | 158 DebugBreakType type; |
156 if (RelocInfo::IsDebugBreakSlotAtReturn(rmode())) { | 159 if (RelocInfo::IsDebugBreakSlotAtReturn(rmode())) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 DCHECK(position_ >= 0); | 197 DCHECK(position_ >= 0); |
195 DCHECK(statement_position_ >= 0); | 198 DCHECK(statement_position_ >= 0); |
196 break_index_++; | 199 break_index_++; |
197 | 200 |
198 enum DebugBreakType type = GetDebugBreakType(); | 201 enum DebugBreakType type = GetDebugBreakType(); |
199 if (type == NOT_DEBUG_BREAK) continue; | 202 if (type == NOT_DEBUG_BREAK) continue; |
200 | 203 |
201 if (break_locator_type_ == ALL_BREAK_LOCATIONS) break; | 204 if (break_locator_type_ == ALL_BREAK_LOCATIONS) break; |
202 | 205 |
203 DCHECK_EQ(CALLS_AND_RETURNS, break_locator_type_); | 206 DCHECK_EQ(CALLS_AND_RETURNS, break_locator_type_); |
204 if (type == DEBUG_BREAK_SLOT_AT_CALL || | 207 if (type == DEBUG_BREAK_SLOT_AT_CALL) break; |
205 type == DEBUG_BREAK_SLOT_AT_RETURN) { | 208 if (type == DEBUG_BREAK_SLOT_AT_RETURN) { |
| 209 DCHECK_EQ(ReturnPosition(), position_); |
| 210 DCHECK_EQ(ReturnPosition(), statement_position_); |
206 break; | 211 break; |
207 } | 212 } |
208 } | 213 } |
209 } | 214 } |
210 | 215 |
211 BreakLocation::DebugBreakType | 216 BreakLocation::DebugBreakType |
212 BreakLocation::BytecodeArrayIterator::GetDebugBreakType() { | 217 BreakLocation::BytecodeArrayIterator::GetDebugBreakType() { |
213 BytecodeArray* bytecode_array = debug_info_->original_bytecode_array(); | 218 BytecodeArray* bytecode_array = debug_info_->original_bytecode_array(); |
214 interpreter::Bytecode bytecode = | 219 interpreter::Bytecode bytecode = |
215 interpreter::Bytecodes::FromByte(bytecode_array->get(code_offset())); | 220 interpreter::Bytecodes::FromByte(bytecode_array->get(code_offset())); |
(...skipping 2443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2659 } | 2664 } |
2660 | 2665 |
2661 | 2666 |
2662 void LockingCommandMessageQueue::Clear() { | 2667 void LockingCommandMessageQueue::Clear() { |
2663 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2668 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2664 queue_.Clear(); | 2669 queue_.Clear(); |
2665 } | 2670 } |
2666 | 2671 |
2667 } // namespace internal | 2672 } // namespace internal |
2668 } // namespace v8 | 2673 } // namespace v8 |
OLD | NEW |