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

Side by Side Diff: src/assembler.h

Issue 2072963003: Simplify AssemblerPositionsRecorder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comment 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
« no previous file with comments | « src/arm64/macro-assembler-arm64.cc ('k') | src/assembler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 bool operator!=(ExternalReference, ExternalReference); 1135 bool operator!=(ExternalReference, ExternalReference);
1136 1136
1137 size_t hash_value(ExternalReference); 1137 size_t hash_value(ExternalReference);
1138 1138
1139 std::ostream& operator<<(std::ostream&, ExternalReference); 1139 std::ostream& operator<<(std::ostream&, ExternalReference);
1140 1140
1141 1141
1142 // ----------------------------------------------------------------------------- 1142 // -----------------------------------------------------------------------------
1143 // Position recording support 1143 // Position recording support
1144 1144
1145 struct PositionState {
1146 PositionState() : current_position(RelocInfo::kNoPosition),
1147 written_position(RelocInfo::kNoPosition),
1148 current_statement_position(RelocInfo::kNoPosition),
1149 written_statement_position(RelocInfo::kNoPosition) {}
1150
1151 int current_position;
1152 int written_position;
1153
1154 int current_statement_position;
1155 int written_statement_position;
1156 };
1157
1158 class AssemblerPositionsRecorder : public PositionsRecorder { 1145 class AssemblerPositionsRecorder : public PositionsRecorder {
1159 public: 1146 public:
1160 explicit AssemblerPositionsRecorder(Assembler* assembler) 1147 explicit AssemblerPositionsRecorder(Assembler* assembler)
1161 : assembler_(assembler) {} 1148 : assembler_(assembler),
1149 current_position_(RelocInfo::kNoPosition),
1150 written_position_(RelocInfo::kNoPosition),
1151 current_statement_position_(RelocInfo::kNoPosition),
1152 written_statement_position_(RelocInfo::kNoPosition) {}
1162 1153
1163 // Set current position to pos. 1154 // Set current position to pos.
1164 void RecordPosition(int pos); 1155 bool RecordPosition(int pos);
1165 1156
1166 // Set current statement position to pos. 1157 // Set current statement position to pos.
1167 void RecordStatementPosition(int pos); 1158 bool RecordStatementPosition(int pos);
1168 1159
1160 private:
1169 // Write recorded positions to relocation information. 1161 // Write recorded positions to relocation information.
1170 bool WriteRecordedPositions(); 1162 bool WriteRecordedPositions();
1171 1163
1172 int current_position() const { return state_.current_position; } 1164 Assembler* assembler_;
1173 1165
1174 int current_statement_position() const { 1166 int current_position_;
1175 return state_.current_statement_position; 1167 int written_position_;
1176 }
1177 1168
1178 private: 1169 int current_statement_position_;
1179 Assembler* assembler_; 1170 int written_statement_position_;
1180 PositionState state_;
1181 1171
1182 DISALLOW_COPY_AND_ASSIGN(AssemblerPositionsRecorder); 1172 DISALLOW_COPY_AND_ASSIGN(AssemblerPositionsRecorder);
1183 }; 1173 };
1184 1174
1185 1175
1186 // ----------------------------------------------------------------------------- 1176 // -----------------------------------------------------------------------------
1187 // Utility functions 1177 // Utility functions
1188 1178
1189 inline int NumberOfBitsSet(uint32_t x) { 1179 inline int NumberOfBitsSet(uint32_t x) {
1190 unsigned int num_bits_set; 1180 unsigned int num_bits_set;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 std::vector<ConstantPoolEntry> shared_entries; 1340 std::vector<ConstantPoolEntry> shared_entries;
1351 }; 1341 };
1352 1342
1353 Label emitted_label_; // Records pc_offset of emitted pool 1343 Label emitted_label_; // Records pc_offset of emitted pool
1354 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; 1344 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES];
1355 }; 1345 };
1356 1346
1357 } // namespace internal 1347 } // namespace internal
1358 } // namespace v8 1348 } // namespace v8
1359 #endif // V8_ASSEMBLER_H_ 1349 #endif // V8_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/arm64/macro-assembler-arm64.cc ('k') | src/assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698