Index: src/debug/debug.cc |
diff --git a/src/debug/debug.cc b/src/debug/debug.cc |
index c69b04b0c8327f5dd95a90a8b8ddb945b2ecbe07..3eea5a12a7316103eff1988bb1c47702de85b155 100644 |
--- a/src/debug/debug.cc |
+++ b/src/debug/debug.cc |
@@ -96,7 +96,10 @@ BreakLocation::CodeIterator::CodeIterator(Handle<DebugInfo> debug_info, |
BreakLocatorType type) |
: Iterator(debug_info), |
reloc_iterator_(debug_info->abstract_code()->GetCode(), |
- GetModeMask(type)) { |
+ GetModeMask(type)), |
+ source_position_iterator_( |
+ debug_info->abstract_code()->GetCode()->source_position_table()), |
+ start_position_(debug_info_->shared()->start_position()) { |
// There is at least one break location. |
DCHECK(!Done()); |
Next(); |
@@ -104,8 +107,6 @@ BreakLocation::CodeIterator::CodeIterator(Handle<DebugInfo> debug_info, |
int BreakLocation::CodeIterator::GetModeMask(BreakLocatorType type) { |
int mask = 0; |
- mask |= RelocInfo::ModeMask(RelocInfo::POSITION); |
- mask |= RelocInfo::ModeMask(RelocInfo::STATEMENT_POSITION); |
mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_RETURN); |
mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_CALL); |
if (isolate()->is_tail_call_elimination_enabled()) { |
@@ -129,30 +130,19 @@ void BreakLocation::CodeIterator::Next() { |
first = false; |
if (Done()) return; |
- // Whenever a statement position or (plain) position is passed update the |
- // current value of these. |
- if (RelocInfo::IsPosition(rmode())) { |
- if (RelocInfo::IsStatementPosition(rmode())) { |
- statement_position_ = static_cast<int>( |
- rinfo()->data() - debug_info_->shared()->start_position()); |
+ int offset = code_offset(); |
+ while (!source_position_iterator_.done() && |
+ source_position_iterator_.code_offset() <= offset) { |
+ position_ = source_position_iterator_.source_position() - start_position_; |
+ if (source_position_iterator_.is_statement()) { |
+ statement_position_ = position_; |
} |
- // Always update the position as we don't want that to be before the |
- // statement position. |
- position_ = static_cast<int>(rinfo()->data() - |
- debug_info_->shared()->start_position()); |
- DCHECK(position_ >= 0); |
- DCHECK(statement_position_ >= 0); |
- continue; |
+ source_position_iterator_.Advance(); |
} |
DCHECK(RelocInfo::IsDebugBreakSlot(rmode()) || |
RelocInfo::IsDebuggerStatement(rmode())); |
- if (RelocInfo::IsDebugBreakSlotAtReturn(rmode())) { |
- // Set the positions to the end of the function. |
- statement_position_ = position_ = ReturnPosition(); |
- } |
- |
break; |
} |
break_index_++; |