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 | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are 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 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1211 static bool IsStrRegFpNegOffset(Instr instr); | 1211 static bool IsStrRegFpNegOffset(Instr instr); |
1212 static bool IsLdrRegFpNegOffset(Instr instr); | 1212 static bool IsLdrRegFpNegOffset(Instr instr); |
1213 static bool IsLdrPcImmediateOffset(Instr instr); | 1213 static bool IsLdrPcImmediateOffset(Instr instr); |
1214 static bool IsTstImmediate(Instr instr); | 1214 static bool IsTstImmediate(Instr instr); |
1215 static bool IsCmpRegister(Instr instr); | 1215 static bool IsCmpRegister(Instr instr); |
1216 static bool IsCmpImmediate(Instr instr); | 1216 static bool IsCmpImmediate(Instr instr); |
1217 static Register GetCmpImmediateRegister(Instr instr); | 1217 static Register GetCmpImmediateRegister(Instr instr); |
1218 static int GetCmpImmediateRawImmediate(Instr instr); | 1218 static int GetCmpImmediateRawImmediate(Instr instr); |
1219 static bool IsNop(Instr instr, int type = NON_MARKING_NOP); | 1219 static bool IsNop(Instr instr, int type = NON_MARKING_NOP); |
1220 | 1220 |
| 1221 // Buffer size and constant pool distance are checked together at regular |
| 1222 // intervals of kBufferCheckInterval emitted bytes |
| 1223 static const int kBufferCheckInterval = 1*KB/2; |
| 1224 // Constants in pools are accessed via pc relative addressing, which can |
| 1225 // reach +/-4KB thereby defining a maximum distance between the instruction |
| 1226 // and the accessed constant. We satisfy this constraint by limiting the |
| 1227 // distance between pools. |
| 1228 static const int kMaxDistBetweenPools = 4*KB - 2*kBufferCheckInterval; |
| 1229 static const int kMaxNumPRInfo = kMaxDistBetweenPools/kInstrSize; |
| 1230 |
1221 // Check if is time to emit a constant pool for pending reloc info entries | 1231 // Check if is time to emit a constant pool for pending reloc info entries |
1222 void CheckConstPool(bool force_emit, bool require_jump); | 1232 void CheckConstPool(bool force_emit, bool require_jump); |
1223 | 1233 |
1224 protected: | 1234 protected: |
1225 // Relocation for a type-recording IC has the AST id added to it. This | 1235 // Relocation for a type-recording IC has the AST id added to it. This |
1226 // member variable is a way to pass the information from the call site to | 1236 // member variable is a way to pass the information from the call site to |
1227 // the relocation info. | 1237 // the relocation info. |
1228 unsigned ast_id_for_reloc_info_; | 1238 unsigned ast_id_for_reloc_info_; |
1229 | 1239 |
1230 bool emit_debug_code() const { return emit_debug_code_; } | 1240 bool emit_debug_code() const { return emit_debug_code_; } |
(...skipping 26 matching lines...) Expand all Loading... |
1257 bool is_const_pool_blocked() const { return const_pool_blocked_nesting_ > 0; } | 1267 bool is_const_pool_blocked() const { return const_pool_blocked_nesting_ > 0; } |
1258 | 1268 |
1259 private: | 1269 private: |
1260 // Code buffer: | 1270 // Code buffer: |
1261 // The buffer into which code and relocation info are generated. | 1271 // The buffer into which code and relocation info are generated. |
1262 byte* buffer_; | 1272 byte* buffer_; |
1263 int buffer_size_; | 1273 int buffer_size_; |
1264 // True if the assembler owns the buffer, false if buffer is external. | 1274 // True if the assembler owns the buffer, false if buffer is external. |
1265 bool own_buffer_; | 1275 bool own_buffer_; |
1266 | 1276 |
1267 // Buffer size and constant pool distance are checked together at regular | |
1268 // intervals of kBufferCheckInterval emitted bytes | |
1269 static const int kBufferCheckInterval = 1*KB/2; | |
1270 int next_buffer_check_; // pc offset of next buffer check | 1277 int next_buffer_check_; // pc offset of next buffer check |
1271 | 1278 |
1272 // Code generation | 1279 // Code generation |
1273 // The relocation writer's position is at least kGap bytes below the end of | 1280 // The relocation writer's position is at least kGap bytes below the end of |
1274 // the generated instructions. This is so that multi-instruction sequences do | 1281 // the generated instructions. This is so that multi-instruction sequences do |
1275 // not have to check for overflow. The same is true for writes of large | 1282 // not have to check for overflow. The same is true for writes of large |
1276 // relocation info entries. | 1283 // relocation info entries. |
1277 static const int kGap = 32; | 1284 static const int kGap = 32; |
1278 byte* pc_; // the program counter; moves forward | 1285 byte* pc_; // the program counter; moves forward |
1279 | 1286 |
(...skipping 12 matching lines...) Expand all Loading... |
1292 // has been generated. That also means that the sizing of the buffers is not | 1299 // has been generated. That also means that the sizing of the buffers is not |
1293 // an exact science, and that we rely on some slop to not overrun buffers. | 1300 // an exact science, and that we rely on some slop to not overrun buffers. |
1294 static const int kCheckConstIntervalInst = 32; | 1301 static const int kCheckConstIntervalInst = 32; |
1295 static const int kCheckConstInterval = kCheckConstIntervalInst * kInstrSize; | 1302 static const int kCheckConstInterval = kCheckConstIntervalInst * kInstrSize; |
1296 | 1303 |
1297 | 1304 |
1298 // Pools are emitted after function return and in dead code at (more or less) | 1305 // Pools are emitted after function return and in dead code at (more or less) |
1299 // regular intervals of kDistBetweenPools bytes | 1306 // regular intervals of kDistBetweenPools bytes |
1300 static const int kDistBetweenPools = 1*KB; | 1307 static const int kDistBetweenPools = 1*KB; |
1301 | 1308 |
1302 // Constants in pools are accessed via pc relative addressing, which can | |
1303 // reach +/-4KB thereby defining a maximum distance between the instruction | |
1304 // and the accessed constant. We satisfy this constraint by limiting the | |
1305 // distance between pools. | |
1306 static const int kMaxDistBetweenPools = 4*KB - 2*kBufferCheckInterval; | |
1307 | |
1308 // Emission of the constant pool may be blocked in some code sequences. | 1309 // Emission of the constant pool may be blocked in some code sequences. |
1309 int const_pool_blocked_nesting_; // Block emission if this is not zero. | 1310 int const_pool_blocked_nesting_; // Block emission if this is not zero. |
1310 int no_const_pool_before_; // Block emission before this pc offset. | 1311 int no_const_pool_before_; // Block emission before this pc offset. |
1311 | 1312 |
1312 // Keep track of the last emitted pool to guarantee a maximal distance | 1313 // Keep track of the last emitted pool to guarantee a maximal distance |
1313 int last_const_pool_end_; // pc offset following the last constant pool | 1314 int last_const_pool_end_; // pc offset following the last constant pool |
1314 | 1315 |
1315 // Relocation info generation | 1316 // Relocation info generation |
1316 // Each relocation is encoded as a variable size value | 1317 // Each relocation is encoded as a variable size value |
1317 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize; | 1318 static const int kMaxRelocSize = RelocInfoWriter::kMaxSize; |
1318 RelocInfoWriter reloc_info_writer; | 1319 RelocInfoWriter reloc_info_writer; |
1319 // Relocation info records are also used during code generation as temporary | 1320 // Relocation info records are also used during code generation as temporary |
1320 // containers for constants and code target addresses until they are emitted | 1321 // containers for constants and code target addresses until they are emitted |
1321 // to the constant pool. These pending relocation info records are temporarily | 1322 // to the constant pool. These pending relocation info records are temporarily |
1322 // stored in a separate buffer until a constant pool is emitted. | 1323 // stored in a separate buffer until a constant pool is emitted. |
1323 // If every instruction in a long sequence is accessing the pool, we need one | 1324 // If every instruction in a long sequence is accessing the pool, we need one |
1324 // pending relocation entry per instruction. | 1325 // pending relocation entry per instruction. |
1325 static const int kMaxNumPRInfo = kMaxDistBetweenPools/kInstrSize; | |
1326 RelocInfo prinfo_[kMaxNumPRInfo]; // the buffer of pending relocation info | 1326 RelocInfo prinfo_[kMaxNumPRInfo]; // the buffer of pending relocation info |
1327 int num_prinfo_; // number of pending reloc info entries in the buffer | 1327 int num_prinfo_; // number of pending reloc info entries in the buffer |
1328 | 1328 |
1329 // The bound position, before this we cannot do instruction elimination. | 1329 // The bound position, before this we cannot do instruction elimination. |
1330 int last_bound_pos_; | 1330 int last_bound_pos_; |
1331 | 1331 |
1332 // Code emission | 1332 // Code emission |
1333 inline void CheckBuffer(); | 1333 inline void CheckBuffer(); |
1334 void GrowBuffer(); | 1334 void GrowBuffer(); |
1335 inline void emit(Instr x); | 1335 inline void emit(Instr x); |
(...skipping 30 matching lines...) Expand all Loading... |
1366 public: | 1366 public: |
1367 explicit EnsureSpace(Assembler* assembler) { | 1367 explicit EnsureSpace(Assembler* assembler) { |
1368 assembler->CheckBuffer(); | 1368 assembler->CheckBuffer(); |
1369 } | 1369 } |
1370 }; | 1370 }; |
1371 | 1371 |
1372 | 1372 |
1373 } } // namespace v8::internal | 1373 } } // namespace v8::internal |
1374 | 1374 |
1375 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1375 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
OLD | NEW |