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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 debug_info_->shared()->start_position() - 1; | 89 debug_info_->shared()->start_position() - 1; |
| 90 } else { | 90 } else { |
| 91 return 0; | 91 return 0; |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 BreakLocation::CodeIterator::CodeIterator(Handle<DebugInfo> debug_info, | 95 BreakLocation::CodeIterator::CodeIterator(Handle<DebugInfo> debug_info, |
| 96 BreakLocatorType type) | 96 BreakLocatorType type) |
| 97 : Iterator(debug_info), | 97 : Iterator(debug_info), |
| 98 reloc_iterator_(debug_info->abstract_code()->GetCode(), | 98 reloc_iterator_(debug_info->abstract_code()->GetCode(), |
| 99 GetModeMask(type)) { | 99 GetModeMask(type)), |
| 100 source_position_iterator_( | |
| 101 debug_info->abstract_code()->GetCode()->source_position_table()), | |
| 102 start_position_(debug_info_->shared()->start_position()) { | |
| 100 // There is at least one break location. | 103 // There is at least one break location. |
| 101 DCHECK(!Done()); | 104 DCHECK(!Done()); |
| 102 Next(); | 105 Next(); |
| 103 } | 106 } |
| 104 | 107 |
| 105 int BreakLocation::CodeIterator::GetModeMask(BreakLocatorType type) { | 108 int BreakLocation::CodeIterator::GetModeMask(BreakLocatorType type) { |
| 106 int mask = 0; | 109 int mask = 0; |
| 107 mask |= RelocInfo::ModeMask(RelocInfo::POSITION); | |
| 108 mask |= RelocInfo::ModeMask(RelocInfo::STATEMENT_POSITION); | |
| 109 mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_RETURN); | 110 mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_RETURN); |
| 110 mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_CALL); | 111 mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_CALL); |
| 111 if (isolate()->is_tail_call_elimination_enabled()) { | 112 if (isolate()->is_tail_call_elimination_enabled()) { |
| 112 mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_TAIL_CALL); | 113 mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_TAIL_CALL); |
| 113 } | 114 } |
| 114 if (type == ALL_BREAK_LOCATIONS) { | 115 if (type == ALL_BREAK_LOCATIONS) { |
| 115 mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION); | 116 mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION); |
| 116 mask |= RelocInfo::ModeMask(RelocInfo::DEBUGGER_STATEMENT); | 117 mask |= RelocInfo::ModeMask(RelocInfo::DEBUGGER_STATEMENT); |
| 117 } | 118 } |
| 118 return mask; | 119 return mask; |
| 119 } | 120 } |
| 120 | 121 |
| 121 void BreakLocation::CodeIterator::Next() { | 122 void BreakLocation::CodeIterator::Next() { |
| 122 DisallowHeapAllocation no_gc; | 123 DisallowHeapAllocation no_gc; |
| 123 DCHECK(!Done()); | 124 DCHECK(!Done()); |
| 124 | 125 |
| 125 // Iterate through reloc info stopping at each breakable code target. | 126 // Iterate through reloc info stopping at each breakable code target. |
| 126 bool first = break_index_ == -1; | 127 bool first = break_index_ == -1; |
| 127 while (!Done()) { | 128 while (!Done()) { |
| 128 if (!first) reloc_iterator_.next(); | 129 if (!first) reloc_iterator_.next(); |
| 129 first = false; | 130 first = false; |
| 130 if (Done()) return; | 131 if (Done()) return; |
| 131 | 132 |
| 132 // Whenever a statement position or (plain) position is passed update the | 133 int offset = code_offset(); |
| 133 // current value of these. | 134 while (!source_position_iterator_.done() && |
| 134 if (RelocInfo::IsPosition(rmode())) { | 135 source_position_iterator_.code_offset() <= offset) { |
| 135 if (RelocInfo::IsStatementPosition(rmode())) { | 136 position_ = source_position_iterator_.source_position() - start_position_; |
| 136 statement_position_ = static_cast<int>( | 137 if (source_position_iterator_.is_statement()) { |
| 137 rinfo()->data() - debug_info_->shared()->start_position()); | 138 statement_position_ = position_; |
| 138 } | 139 } |
| 139 // Always update the position as we don't want that to be before the | 140 source_position_iterator_.Advance(); |
| 140 // statement position. | |
| 141 position_ = static_cast<int>(rinfo()->data() - | |
| 142 debug_info_->shared()->start_position()); | |
| 143 DCHECK(position_ >= 0); | |
| 144 DCHECK(statement_position_ >= 0); | |
| 145 continue; | |
| 146 } | 141 } |
| 147 | 142 |
| 148 DCHECK(RelocInfo::IsDebugBreakSlot(rmode()) || | 143 DCHECK(RelocInfo::IsDebugBreakSlot(rmode()) || |
| 149 RelocInfo::IsDebuggerStatement(rmode())); | 144 RelocInfo::IsDebuggerStatement(rmode())); |
| 150 | 145 |
| 151 if (RelocInfo::IsDebugBreakSlotAtReturn(rmode())) { | |
|
jgruber
2016/06/27 09:32:42
Just for my understanding, why is this not needed
Yang
2016/06/27 10:30:22
We already have the correct source position attach
| |
| 152 // Set the positions to the end of the function. | |
| 153 statement_position_ = position_ = ReturnPosition(); | |
| 154 } | |
| 155 | |
| 156 break; | 146 break; |
| 157 } | 147 } |
| 158 break_index_++; | 148 break_index_++; |
| 159 } | 149 } |
| 160 | 150 |
| 161 BreakLocation BreakLocation::CodeIterator::GetBreakLocation() { | 151 BreakLocation BreakLocation::CodeIterator::GetBreakLocation() { |
| 162 DebugBreakType type; | 152 DebugBreakType type; |
| 163 if (RelocInfo::IsDebugBreakSlotAtReturn(rmode())) { | 153 if (RelocInfo::IsDebugBreakSlotAtReturn(rmode())) { |
| 164 type = DEBUG_BREAK_SLOT_AT_RETURN; | 154 type = DEBUG_BREAK_SLOT_AT_RETURN; |
| 165 } else if (RelocInfo::IsDebugBreakSlotAtCall(rmode())) { | 155 } else if (RelocInfo::IsDebugBreakSlotAtCall(rmode())) { |
| (...skipping 2430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2596 } | 2586 } |
| 2597 | 2587 |
| 2598 | 2588 |
| 2599 void LockingCommandMessageQueue::Clear() { | 2589 void LockingCommandMessageQueue::Clear() { |
| 2600 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2590 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
| 2601 queue_.Clear(); | 2591 queue_.Clear(); |
| 2602 } | 2592 } |
| 2603 | 2593 |
| 2604 } // namespace internal | 2594 } // namespace internal |
| 2605 } // namespace v8 | 2595 } // namespace v8 |
| OLD | NEW |