| 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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 // buffer, and buffer_size determines the initial buffer size. The buffer is | 547 // buffer, and buffer_size determines the initial buffer size. The buffer is |
| 548 // owned by the assembler and deallocated upon destruction of the assembler. | 548 // owned by the assembler and deallocated upon destruction of the assembler. |
| 549 // | 549 // |
| 550 // If the provided buffer is not NULL, the assembler uses the provided buffer | 550 // If the provided buffer is not NULL, the assembler uses the provided buffer |
| 551 // for code generation and assumes its size to be buffer_size. If the buffer | 551 // for code generation and assumes its size to be buffer_size. If the buffer |
| 552 // is too small, a fatal error occurs. No deallocation of the buffer is done | 552 // is too small, a fatal error occurs. No deallocation of the buffer is done |
| 553 // upon destruction of the assembler. | 553 // upon destruction of the assembler. |
| 554 Assembler(void* buffer, int buffer_size); | 554 Assembler(void* buffer, int buffer_size); |
| 555 ~Assembler(); | 555 ~Assembler(); |
| 556 | 556 |
| 557 // Overrides the default provided by FLAG_debug_code. |
| 558 void set_emit_debug_code(bool value) { emit_debug_code_ = value; } |
| 559 |
| 557 // GetCode emits any pending (non-emitted) code and fills the descriptor | 560 // GetCode emits any pending (non-emitted) code and fills the descriptor |
| 558 // desc. GetCode() is idempotent; it returns the same result if no other | 561 // desc. GetCode() is idempotent; it returns the same result if no other |
| 559 // Assembler functions are invoked in between GetCode() calls. | 562 // Assembler functions are invoked in between GetCode() calls. |
| 560 void GetCode(CodeDesc* desc); | 563 void GetCode(CodeDesc* desc); |
| 561 | 564 |
| 562 // Label operations & relative jumps (PPUM Appendix D) | 565 // Label operations & relative jumps (PPUM Appendix D) |
| 563 // | 566 // |
| 564 // Takes a branch opcode (cc) and a label (L) and generates | 567 // Takes a branch opcode (cc) and a label (L) and generates |
| 565 // either a backward branch or a forward branch and links it | 568 // either a backward branch or a forward branch and links it |
| 566 // to the label fixup chain. Usage: | 569 // to the label fixup chain. Usage: |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 static bool IsCmpRegister(Instr instr); | 1150 static bool IsCmpRegister(Instr instr); |
| 1148 static bool IsCmpImmediate(Instr instr); | 1151 static bool IsCmpImmediate(Instr instr); |
| 1149 static Register GetCmpImmediateRegister(Instr instr); | 1152 static Register GetCmpImmediateRegister(Instr instr); |
| 1150 static int GetCmpImmediateRawImmediate(Instr instr); | 1153 static int GetCmpImmediateRawImmediate(Instr instr); |
| 1151 static bool IsNop(Instr instr, int type = NON_MARKING_NOP); | 1154 static bool IsNop(Instr instr, int type = NON_MARKING_NOP); |
| 1152 | 1155 |
| 1153 // Check if is time to emit a constant pool for pending reloc info entries | 1156 // Check if is time to emit a constant pool for pending reloc info entries |
| 1154 void CheckConstPool(bool force_emit, bool require_jump); | 1157 void CheckConstPool(bool force_emit, bool require_jump); |
| 1155 | 1158 |
| 1156 protected: | 1159 protected: |
| 1160 bool emit_debug_code() const { return emit_debug_code_; } |
| 1161 |
| 1157 int buffer_space() const { return reloc_info_writer.pos() - pc_; } | 1162 int buffer_space() const { return reloc_info_writer.pos() - pc_; } |
| 1158 | 1163 |
| 1159 // Read/patch instructions | 1164 // Read/patch instructions |
| 1160 Instr instr_at(int pos) { return *reinterpret_cast<Instr*>(buffer_ + pos); } | 1165 Instr instr_at(int pos) { return *reinterpret_cast<Instr*>(buffer_ + pos); } |
| 1161 void instr_at_put(int pos, Instr instr) { | 1166 void instr_at_put(int pos, Instr instr) { |
| 1162 *reinterpret_cast<Instr*>(buffer_ + pos) = instr; | 1167 *reinterpret_cast<Instr*>(buffer_ + pos) = instr; |
| 1163 } | 1168 } |
| 1164 | 1169 |
| 1165 // Decode branch instruction at pos and return branch target pos | 1170 // Decode branch instruction at pos and return branch target pos |
| 1166 int target_at(int pos); | 1171 int target_at(int pos); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 // Record reloc info for current pc_ | 1280 // Record reloc info for current pc_ |
| 1276 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); | 1281 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); |
| 1277 | 1282 |
| 1278 friend class RegExpMacroAssemblerARM; | 1283 friend class RegExpMacroAssemblerARM; |
| 1279 friend class RelocInfo; | 1284 friend class RelocInfo; |
| 1280 friend class CodePatcher; | 1285 friend class CodePatcher; |
| 1281 friend class BlockConstPoolScope; | 1286 friend class BlockConstPoolScope; |
| 1282 | 1287 |
| 1283 PositionsRecorder positions_recorder_; | 1288 PositionsRecorder positions_recorder_; |
| 1284 bool allow_peephole_optimization_; | 1289 bool allow_peephole_optimization_; |
| 1290 bool emit_debug_code_; |
| 1285 friend class PositionsRecorder; | 1291 friend class PositionsRecorder; |
| 1286 friend class EnsureSpace; | 1292 friend class EnsureSpace; |
| 1287 }; | 1293 }; |
| 1288 | 1294 |
| 1289 | 1295 |
| 1290 class EnsureSpace BASE_EMBEDDED { | 1296 class EnsureSpace BASE_EMBEDDED { |
| 1291 public: | 1297 public: |
| 1292 explicit EnsureSpace(Assembler* assembler) { | 1298 explicit EnsureSpace(Assembler* assembler) { |
| 1293 assembler->CheckBuffer(); | 1299 assembler->CheckBuffer(); |
| 1294 } | 1300 } |
| 1295 }; | 1301 }; |
| 1296 | 1302 |
| 1297 | 1303 |
| 1298 } } // namespace v8::internal | 1304 } } // namespace v8::internal |
| 1299 | 1305 |
| 1300 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1306 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
| OLD | NEW |