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

Side by Side Diff: src/assembler.h

Issue 2072963003: Simplify AssemblerPositionsRecorder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 bool operator!=(ExternalReference, ExternalReference); 1137 bool operator!=(ExternalReference, ExternalReference);
1138 1138
1139 size_t hash_value(ExternalReference); 1139 size_t hash_value(ExternalReference);
1140 1140
1141 std::ostream& operator<<(std::ostream&, ExternalReference); 1141 std::ostream& operator<<(std::ostream&, ExternalReference);
1142 1142
1143 1143
1144 // ----------------------------------------------------------------------------- 1144 // -----------------------------------------------------------------------------
1145 // Position recording support 1145 // Position recording support
1146 1146
1147 struct PositionState { 1147 struct PositionState {
jgruber 2016/06/17 17:38:52 Can this be removed?
1148 PositionState() : current_position(RelocInfo::kNoPosition), 1148 PositionState() : current_position(RelocInfo::kNoPosition),
1149 written_position(RelocInfo::kNoPosition), 1149 written_position(RelocInfo::kNoPosition),
1150 current_statement_position(RelocInfo::kNoPosition), 1150 current_statement_position(RelocInfo::kNoPosition),
1151 written_statement_position(RelocInfo::kNoPosition) {} 1151 written_statement_position(RelocInfo::kNoPosition) {}
1152 1152
1153 int current_position; 1153 int current_position;
1154 int written_position; 1154 int written_position;
1155 1155
1156 int current_statement_position; 1156 int current_statement_position;
1157 int written_statement_position; 1157 int written_statement_position;
1158 }; 1158 };
1159 1159
1160 class AssemblerPositionsRecorder : public PositionsRecorder { 1160 class AssemblerPositionsRecorder : public PositionsRecorder {
1161 public: 1161 public:
1162 explicit AssemblerPositionsRecorder(Assembler* assembler) 1162 explicit AssemblerPositionsRecorder(Assembler* assembler)
1163 : assembler_(assembler) {} 1163 : assembler_(assembler),
1164 current_position_(RelocInfo::kNoPosition),
1165 written_position_(RelocInfo::kNoPosition),
1166 current_statement_position_(RelocInfo::kNoPosition),
1167 written_statement_position_(RelocInfo::kNoPosition) {}
1164 1168
1165 // Set current position to pos. 1169 // Set current position to pos.
1166 void RecordPosition(int pos); 1170 bool RecordPosition(int pos);
1167 1171
1168 // Set current statement position to pos. 1172 // Set current statement position to pos.
1169 void RecordStatementPosition(int pos); 1173 bool RecordStatementPosition(int pos);
1170 1174
1175 private:
1171 // Write recorded positions to relocation information. 1176 // Write recorded positions to relocation information.
1172 bool WriteRecordedPositions(); 1177 bool WriteRecordedPositions();
1173 1178
1174 int current_position() const { return state_.current_position; } 1179 Assembler* assembler_;
1175 1180
1176 int current_statement_position() const { 1181 int current_position_;
1177 return state_.current_statement_position; 1182 int written_position_;
1178 }
1179 1183
1180 private: 1184 int current_statement_position_;
1181 Assembler* assembler_; 1185 int written_statement_position_;
1182 PositionState state_;
1183 1186
1184 DISALLOW_COPY_AND_ASSIGN(AssemblerPositionsRecorder); 1187 DISALLOW_COPY_AND_ASSIGN(AssemblerPositionsRecorder);
1185 }; 1188 };
1186 1189
1187 1190
1188 // ----------------------------------------------------------------------------- 1191 // -----------------------------------------------------------------------------
1189 // Utility functions 1192 // Utility functions
1190 1193
1191 inline int NumberOfBitsSet(uint32_t x) { 1194 inline int NumberOfBitsSet(uint32_t x) {
1192 unsigned int num_bits_set; 1195 unsigned int num_bits_set;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 std::vector<ConstantPoolEntry> shared_entries; 1355 std::vector<ConstantPoolEntry> shared_entries;
1353 }; 1356 };
1354 1357
1355 Label emitted_label_; // Records pc_offset of emitted pool 1358 Label emitted_label_; // Records pc_offset of emitted pool
1356 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; 1359 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES];
1357 }; 1360 };
1358 1361
1359 } // namespace internal 1362 } // namespace internal
1360 } // namespace v8 1363 } // namespace v8
1361 #endif // V8_ASSEMBLER_H_ 1364 #endif // V8_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/arm64/macro-assembler-arm64.cc ('k') | src/assembler.cc » ('j') | src/assembler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698