| 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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 }; | 501 }; |
| 502 | 502 |
| 503 private: | 503 private: |
| 504 static unsigned supported_; | 504 static unsigned supported_; |
| 505 static unsigned enabled_; | 505 static unsigned enabled_; |
| 506 static unsigned found_by_runtime_probing_; | 506 static unsigned found_by_runtime_probing_; |
| 507 }; | 507 }; |
| 508 | 508 |
| 509 | 509 |
| 510 typedef int32_t Instr; | 510 typedef int32_t Instr; |
| 511 typedef int16_t ThumbInstr; |
| 511 | 512 |
| 512 | 513 |
| 513 extern const Instr kMovLrPc; | 514 extern const Instr kMovLrPc; |
| 514 extern const Instr kLdrPCPattern; | 515 extern const Instr kLdrPCPattern; |
| 515 | 516 |
| 516 | 517 |
| 517 class Assembler : public Malloced { | 518 class Assembler : public Malloced { |
| 518 public: | 519 public: |
| 519 // Create an assembler. Instructions and relocation information are emitted | 520 // Create an assembler. Instructions and relocation information are emitted |
| 520 // into a buffer, with the instructions starting from the beginning and the | 521 // into a buffer, with the instructions starting from the beginning and the |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 } | 584 } |
| 584 | 585 |
| 585 // Here we are patching the address in the constant pool, not the actual call | 586 // Here we are patching the address in the constant pool, not the actual call |
| 586 // instruction. The address in the constant pool is the same size as a | 587 // instruction. The address in the constant pool is the same size as a |
| 587 // pointer. | 588 // pointer. |
| 588 static const int kCallTargetSize = kPointerSize; | 589 static const int kCallTargetSize = kPointerSize; |
| 589 static const int kExternalTargetSize = kPointerSize; | 590 static const int kExternalTargetSize = kPointerSize; |
| 590 | 591 |
| 591 // Size of an instruction. | 592 // Size of an instruction. |
| 592 static const int kInstrSize = sizeof(Instr); | 593 static const int kInstrSize = sizeof(Instr); |
| 594 static const int kThumbSize = sizeof(ThumbInstr); |
| 593 | 595 |
| 594 // Distance between the instruction referring to the address of the call | 596 // Distance between the instruction referring to the address of the call |
| 595 // target (ldr pc, [target addr in const pool]) and the return address | 597 // target (ldr pc, [target addr in const pool]) and the return address |
| 596 static const int kCallTargetAddressOffset = kInstrSize; | 598 static const int kCallTargetAddressOffset = kInstrSize; |
| 597 | 599 |
| 598 // Distance between start of patched return sequence and the emitted address | 600 // Distance between start of patched return sequence and the emitted address |
| 599 // to jump to. | 601 // to jump to. |
| 600 static const int kPatchReturnSequenceAddressOffset = kInstrSize; | 602 static const int kPatchReturnSequenceAddressOffset = kInstrSize; |
| 601 | 603 |
| 602 // Difference between address of current opcode and value read from pc | 604 // Difference between address of current opcode and value read from pc |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 | 991 |
| 990 // The bound position, before this we cannot do instruction elimination. | 992 // The bound position, before this we cannot do instruction elimination. |
| 991 int last_bound_pos_; | 993 int last_bound_pos_; |
| 992 | 994 |
| 993 // source position information | 995 // source position information |
| 994 int current_position_; | 996 int current_position_; |
| 995 int current_statement_position_; | 997 int current_statement_position_; |
| 996 int written_position_; | 998 int written_position_; |
| 997 int written_statement_position_; | 999 int written_statement_position_; |
| 998 | 1000 |
| 1001 bool thumb_mode_; |
| 1002 |
| 999 // Code emission | 1003 // Code emission |
| 1000 inline void CheckBuffer(); | 1004 inline void CheckBuffer(); |
| 1001 void GrowBuffer(); | 1005 void GrowBuffer(); |
| 1002 inline void emit(Instr x); | 1006 inline void emit(Instr x); |
| 1007 inline void emitThumb(ThumbInstr x); |
| 1008 |
| 1009 void forceThumbMode(); |
| 1010 void forceArmMode(); |
| 1003 | 1011 |
| 1004 // Instruction generation | 1012 // Instruction generation |
| 1005 void addrmod1(Instr instr, Register rn, Register rd, const Operand& x); | 1013 void addrmod1(Instr instr, Register rn, Register rd, const Operand& x); |
| 1006 void addrmod2(Instr instr, Register rd, const MemOperand& x); | 1014 void addrmod2(Instr instr, Register rd, const MemOperand& x); |
| 1007 void addrmod3(Instr instr, Register rd, const MemOperand& x); | 1015 void addrmod3(Instr instr, Register rd, const MemOperand& x); |
| 1008 void addrmod4(Instr instr, Register rn, RegList rl); | 1016 void addrmod4(Instr instr, Register rn, RegList rl); |
| 1009 void addrmod5(Instr instr, CRegister crd, const MemOperand& x); | 1017 void addrmod5(Instr instr, CRegister crd, const MemOperand& x); |
| 1010 | 1018 |
| 1011 // Labels | 1019 // Labels |
| 1012 void print(Label* L); | 1020 void print(Label* L); |
| 1013 void bind_to(Label* L, int pos); | 1021 void bind_to(Label* L, int pos); |
| 1014 void link_to(Label* L, Label* appendix); | 1022 void link_to(Label* L, Label* appendix); |
| 1015 void next(Label* L); | 1023 void next(Label* L); |
| 1016 | 1024 |
| 1017 // Record reloc info for current pc_ | 1025 // Record reloc info for current pc_ |
| 1018 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); | 1026 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); |
| 1019 | 1027 |
| 1020 friend class RegExpMacroAssemblerARM; | 1028 friend class RegExpMacroAssemblerARM; |
| 1021 friend class RelocInfo; | 1029 friend class RelocInfo; |
| 1022 friend class CodePatcher; | 1030 friend class CodePatcher; |
| 1023 }; | 1031 }; |
| 1024 | 1032 |
| 1025 } } // namespace v8::internal | 1033 } } // namespace v8::internal |
| 1026 | 1034 |
| 1027 #endif // V8_ARM_ASSEMBLER_THUMB2_H_ | 1035 #endif // V8_ARM_ASSEMBLER_THUMB2_H_ |
| OLD | NEW |