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 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 // for inline tables, e.g., jump-tables. The constant pool should be | 1179 // for inline tables, e.g., jump-tables. The constant pool should be |
1180 // emitted before any use of db and dd to ensure that constant pools | 1180 // emitted before any use of db and dd to ensure that constant pools |
1181 // are not emitted as part of the tables generated. | 1181 // are not emitted as part of the tables generated. |
1182 void db(uint8_t data); | 1182 void db(uint8_t data); |
1183 void dd(uint32_t data); | 1183 void dd(uint32_t data); |
1184 | 1184 |
1185 int pc_offset() const { return pc_ - buffer_; } | 1185 int pc_offset() const { return pc_ - buffer_; } |
1186 | 1186 |
1187 PositionsRecorder* positions_recorder() { return &positions_recorder_; } | 1187 PositionsRecorder* positions_recorder() { return &positions_recorder_; } |
1188 | 1188 |
1189 bool can_peephole_optimize(int instructions) { | |
1190 if (!allow_peephole_optimization_) return false; | |
1191 if (last_bound_pos_ > pc_offset() - instructions * kInstrSize) return false; | |
1192 return reloc_info_writer.last_pc() <= pc_ - instructions * kInstrSize; | |
1193 } | |
1194 | |
1195 // Read/patch instructions | 1189 // Read/patch instructions |
1196 static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); } | 1190 static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); } |
1197 static void instr_at_put(byte* pc, Instr instr) { | 1191 static void instr_at_put(byte* pc, Instr instr) { |
1198 *reinterpret_cast<Instr*>(pc) = instr; | 1192 *reinterpret_cast<Instr*>(pc) = instr; |
1199 } | 1193 } |
1200 static Condition GetCondition(Instr instr); | 1194 static Condition GetCondition(Instr instr); |
1201 static bool IsBranch(Instr instr); | 1195 static bool IsBranch(Instr instr); |
1202 static int GetBranchOffset(Instr instr); | 1196 static int GetBranchOffset(Instr instr); |
1203 static bool IsLdrRegisterImmediate(Instr instr); | 1197 static bool IsLdrRegisterImmediate(Instr instr); |
1204 static int GetLdrRegisterImmediateOffset(Instr instr); | 1198 static int GetLdrRegisterImmediateOffset(Instr instr); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 | 1349 |
1356 // Record reloc info for current pc_ | 1350 // Record reloc info for current pc_ |
1357 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); | 1351 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); |
1358 | 1352 |
1359 friend class RegExpMacroAssemblerARM; | 1353 friend class RegExpMacroAssemblerARM; |
1360 friend class RelocInfo; | 1354 friend class RelocInfo; |
1361 friend class CodePatcher; | 1355 friend class CodePatcher; |
1362 friend class BlockConstPoolScope; | 1356 friend class BlockConstPoolScope; |
1363 | 1357 |
1364 PositionsRecorder positions_recorder_; | 1358 PositionsRecorder positions_recorder_; |
1365 bool allow_peephole_optimization_; | |
1366 bool emit_debug_code_; | 1359 bool emit_debug_code_; |
1367 friend class PositionsRecorder; | 1360 friend class PositionsRecorder; |
1368 friend class EnsureSpace; | 1361 friend class EnsureSpace; |
1369 }; | 1362 }; |
1370 | 1363 |
1371 | 1364 |
1372 class EnsureSpace BASE_EMBEDDED { | 1365 class EnsureSpace BASE_EMBEDDED { |
1373 public: | 1366 public: |
1374 explicit EnsureSpace(Assembler* assembler) { | 1367 explicit EnsureSpace(Assembler* assembler) { |
1375 assembler->CheckBuffer(); | 1368 assembler->CheckBuffer(); |
1376 } | 1369 } |
1377 }; | 1370 }; |
1378 | 1371 |
1379 | 1372 |
1380 } } // namespace v8::internal | 1373 } } // namespace v8::internal |
1381 | 1374 |
1382 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1375 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
OLD | NEW |