OLD | NEW |
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 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 void RecordComment(const char* msg, bool force = false); | 1163 void RecordComment(const char* msg, bool force = false); |
1164 | 1164 |
1165 // Writes a single byte or word of data in the code stream. Used for | 1165 // Writes a single byte or word of data in the code stream. Used for |
1166 // inline tables, e.g., jump-tables. | 1166 // inline tables, e.g., jump-tables. |
1167 void db(uint8_t data); | 1167 void db(uint8_t data); |
1168 void dd(uint32_t data); | 1168 void dd(uint32_t data); |
1169 | 1169 |
1170 // Check if there is less than kGap bytes available in the buffer. | 1170 // Check if there is less than kGap bytes available in the buffer. |
1171 // If this is the case, we need to grow the buffer before emitting | 1171 // If this is the case, we need to grow the buffer before emitting |
1172 // an instruction or relocation information. | 1172 // an instruction or relocation information. |
1173 inline bool overflow() const { return pc_ >= reloc_info_writer.pos() - kGap; } | 1173 inline bool buffer_overflow() const { |
| 1174 return pc_ >= reloc_info_writer.pos() - kGap; |
| 1175 } |
1174 | 1176 |
1175 // Get the number of bytes available in the buffer. | 1177 // Get the number of bytes available in the buffer. |
1176 inline int available_space() const { return reloc_info_writer.pos() - pc_; } | 1178 inline int available_space() const { return reloc_info_writer.pos() - pc_; } |
1177 | 1179 |
1178 static bool IsNop(Address addr); | 1180 static bool IsNop(Address addr); |
1179 | 1181 |
1180 PositionsRecorder* positions_recorder() { return &positions_recorder_; } | 1182 PositionsRecorder* positions_recorder() { return &positions_recorder_; } |
1181 | 1183 |
1182 int relocation_writer_size() { | 1184 int relocation_writer_size() { |
1183 return (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 1185 return (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 }; | 1261 }; |
1260 | 1262 |
1261 | 1263 |
1262 // Helper class that ensures that there is enough space for generating | 1264 // Helper class that ensures that there is enough space for generating |
1263 // instructions and relocation information. The constructor makes | 1265 // instructions and relocation information. The constructor makes |
1264 // sure that there is enough space and (in debug mode) the destructor | 1266 // sure that there is enough space and (in debug mode) the destructor |
1265 // checks that we did not generate too much. | 1267 // checks that we did not generate too much. |
1266 class EnsureSpace BASE_EMBEDDED { | 1268 class EnsureSpace BASE_EMBEDDED { |
1267 public: | 1269 public: |
1268 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) { | 1270 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) { |
1269 if (assembler_->overflow()) assembler_->GrowBuffer(); | 1271 if (assembler_->buffer_overflow()) assembler_->GrowBuffer(); |
1270 #ifdef DEBUG | 1272 #ifdef DEBUG |
1271 space_before_ = assembler_->available_space(); | 1273 space_before_ = assembler_->available_space(); |
1272 #endif | 1274 #endif |
1273 } | 1275 } |
1274 | 1276 |
1275 #ifdef DEBUG | 1277 #ifdef DEBUG |
1276 ~EnsureSpace() { | 1278 ~EnsureSpace() { |
1277 int bytes_generated = space_before_ - assembler_->available_space(); | 1279 int bytes_generated = space_before_ - assembler_->available_space(); |
1278 ASSERT(bytes_generated < assembler_->kGap); | 1280 ASSERT(bytes_generated < assembler_->kGap); |
1279 } | 1281 } |
1280 #endif | 1282 #endif |
1281 | 1283 |
1282 private: | 1284 private: |
1283 Assembler* assembler_; | 1285 Assembler* assembler_; |
1284 #ifdef DEBUG | 1286 #ifdef DEBUG |
1285 int space_before_; | 1287 int space_before_; |
1286 #endif | 1288 #endif |
1287 }; | 1289 }; |
1288 | 1290 |
1289 } } // namespace v8::internal | 1291 } } // namespace v8::internal |
1290 | 1292 |
1291 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 1293 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
OLD | NEW |