Index: src/assembler.cc |
diff --git a/src/assembler.cc b/src/assembler.cc |
index ce90dceacbc9f8b0e3651efd5fb4f18f50cc6d24..7493673e8191f68e74fcbb6b465591897d832b3b 100644 |
--- a/src/assembler.cc |
+++ b/src/assembler.cc |
@@ -804,4 +804,53 @@ ExternalReference ExternalReference::debug_step_in_fp_address() { |
} |
#endif |
+ |
+void PositionsRecorder::RecordPosition(int pos, |
+ PositionRecordingType recording_type) { |
+ ASSERT(pos != RelocInfo::kNoPosition); |
+ ASSERT(pos >= 0); |
+ current_position_ = pos; |
+ current_position_recording_type_ = recording_type; |
+} |
+ |
+ |
+void PositionsRecorder::RecordStatementPosition(int pos) { |
+ ASSERT(pos != RelocInfo::kNoPosition); |
+ ASSERT(pos >= 0); |
+ current_statement_position_ = pos; |
+} |
+ |
+ |
+bool PositionsRecorder::WriteRecordedPositions() { |
+ bool written = false; |
+ |
+ // Write the statement position if it is different from what was written last |
+ // time. |
+ if (current_statement_position_ != written_statement_position_) { |
+ EnsureSpace ensure_space(assembler_); |
+ assembler_->RecordRelocInfo(RelocInfo::STATEMENT_POSITION, |
+ current_statement_position_); |
+ written_statement_position_ = current_statement_position_; |
+ written = true; |
+ } |
+ |
+ // Write the position if it is different from what was written last time and |
+ // also different from the written statement position or was forced. |
+ if (current_position_ != written_position_ && |
+ (current_position_ != current_statement_position_ || !written) && |
+ (current_position_ != written_statement_position_ |
+ || current_position_recording_type_ == FORCED_POSITION)) { |
+ EnsureSpace ensure_space(assembler_); |
+ assembler_->RecordRelocInfo(RelocInfo::POSITION, current_position_); |
+ written_position_ = current_position_; |
+ written = true; |
+ } |
+ |
+ current_position_recording_type_ = NORMAL_POSITION; |
+ |
+ // Return whether something was written. |
+ return written; |
+} |
+ |
+ |
} } // namespace v8::internal |