Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(679)

Unified Diff: src/assembler.h

Issue 4469002: Improve positions recording for calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/assembler.h
diff --git a/src/assembler.h b/src/assembler.h
index 66811777fad6a93e98239c3172e462aea33e0e79..b71c5704daa0f3684448a13915a21794f7ac9976 100644
--- a/src/assembler.h
+++ b/src/assembler.h
@@ -585,6 +585,67 @@ class ExternalReference BASE_EMBEDDED {
// -----------------------------------------------------------------------------
+// Position recording support
+
+enum PositionRecordingType { FORCED_POSITION, NORMAL_POSITION };
Søren Thygesen Gjesse 2010/11/04 15:08:24 Thanks for using an enum instead of a boolean.
+
+class PositionsRecorder BASE_EMBEDDED {
+ public:
+ explicit PositionsRecorder(Assembler* assembler)
+ : assembler_(assembler),
+ current_position_(RelocInfo::kNoPosition),
+ current_position_recording_type_(NORMAL_POSITION),
+ written_position_(RelocInfo::kNoPosition),
+ current_statement_position_(RelocInfo::kNoPosition),
+ written_statement_position_(RelocInfo::kNoPosition) { }
+
+ // Set current position to pos. If recording_type is FORCED_POSITION then
+ // WriteRecordedPositions will write this position even if it is equal to
+ // statement position previously written for another pc.
+ void RecordPosition(int pos,
+ PositionRecordingType recording_type = NORMAL_POSITION);
+
+ // Set current statement position to pos.
+ void RecordStatementPosition(int pos);
+
+ // Write recorded positions to relocation information.
+ bool WriteRecordedPositions();
+
+ int current_position() const { return current_position_; }
+
+ int current_statement_position() const { return current_statement_position_; }
+
+ private:
+ Assembler* assembler_;
+
+ int current_position_;
+ PositionRecordingType current_position_recording_type_;
+ int written_position_;
+
+ int current_statement_position_;
+ int written_statement_position_;
+};
+
+
+class PreserveStatementPositionScope BASE_EMBEDDED {
+ public:
+ PreserveStatementPositionScope(PositionsRecorder* positions_recorder)
+ : positions_recorder_(positions_recorder),
+ statement_position_(positions_recorder->current_statement_position()) {}
+
+ ~PreserveStatementPositionScope() {
+ if (statement_position_ != RelocInfo::kNoPosition) {
+ positions_recorder_->RecordStatementPosition(statement_position_);
+ }
+ }
+
+ private:
+ PositionsRecorder* positions_recorder_;
+ int statement_position_;
+};
+
+
+// -----------------------------------------------------------------------------
// Utility functions
static inline bool is_intn(int x, int n) {
« src/arm/assembler-arm.cc ('K') | « src/arm/macro-assembler-arm.cc ('k') | src/assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698