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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 | 636 |
637 | 637 |
638 // Debugging | 638 // Debugging |
639 | 639 |
640 // Record a comment relocation entry that can be used by a disassembler. | 640 // Record a comment relocation entry that can be used by a disassembler. |
641 // Use --debug_code to enable. | 641 // Use --debug_code to enable. |
642 void RecordComment(const char* msg); | 642 void RecordComment(const char* msg); |
643 | 643 |
644 void RecordPosition(int pos); | 644 void RecordPosition(int pos); |
645 void RecordStatementPosition(int pos); | 645 void RecordStatementPosition(int pos); |
| 646 void WriteRecordedPositions(); |
646 | 647 |
647 int pc_offset() const { return pc_ - buffer_; } | 648 int pc_offset() const { return pc_ - buffer_; } |
648 int last_position() const { return last_position_; } | 649 int current_position() const { return current_position_; } |
649 bool last_position_is_statement() const { | 650 int current_statement_position() const { return current_position_; } |
650 return last_position_is_statement_; | |
651 } | |
652 | |
653 // Temporary helper function. Used by codegen.cc. | |
654 int last_statement_position() const { return last_position_; } | |
655 | 651 |
656 protected: | 652 protected: |
657 int buffer_space() const { return reloc_info_writer.pos() - pc_; } | 653 int buffer_space() const { return reloc_info_writer.pos() - pc_; } |
658 | 654 |
659 // Read/patch instructions | 655 // Read/patch instructions |
660 Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); } | 656 Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); } |
661 void instr_at_put(byte* pc, Instr instr) { | 657 void instr_at_put(byte* pc, Instr instr) { |
662 *reinterpret_cast<Instr*>(pc) = instr; | 658 *reinterpret_cast<Instr*>(pc) = instr; |
663 } | 659 } |
664 Instr instr_at(int pos) { return *reinterpret_cast<Instr*>(buffer_ + pos); } | 660 Instr instr_at(int pos) { return *reinterpret_cast<Instr*>(buffer_ + pos); } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 // If every instruction in a long sequence is accessing the pool, we need one | 743 // If every instruction in a long sequence is accessing the pool, we need one |
748 // pending relocation entry per instruction. | 744 // pending relocation entry per instruction. |
749 static const int kMaxNumPRInfo = kMaxDistBetweenPools/kInstrSize; | 745 static const int kMaxNumPRInfo = kMaxDistBetweenPools/kInstrSize; |
750 RelocInfo prinfo_[kMaxNumPRInfo]; // the buffer of pending relocation info | 746 RelocInfo prinfo_[kMaxNumPRInfo]; // the buffer of pending relocation info |
751 int num_prinfo_; // number of pending reloc info entries in the buffer | 747 int num_prinfo_; // number of pending reloc info entries in the buffer |
752 | 748 |
753 // The bound position, before this we cannot do instruction elimination. | 749 // The bound position, before this we cannot do instruction elimination. |
754 int last_bound_pos_; | 750 int last_bound_pos_; |
755 | 751 |
756 // source position information | 752 // source position information |
757 int last_position_; | 753 int current_position_; |
758 bool last_position_is_statement_; | 754 int current_statement_position_; |
| 755 int written_position_; |
| 756 int written_statement_position_; |
759 | 757 |
760 // Code emission | 758 // Code emission |
761 inline void CheckBuffer(); | 759 inline void CheckBuffer(); |
762 void GrowBuffer(); | 760 void GrowBuffer(); |
763 inline void emit(Instr x); | 761 inline void emit(Instr x); |
764 | 762 |
765 // Instruction generation | 763 // Instruction generation |
766 void addrmod1(Instr instr, Register rn, Register rd, const Operand& x); | 764 void addrmod1(Instr instr, Register rn, Register rd, const Operand& x); |
767 void addrmod2(Instr instr, Register rd, const MemOperand& x); | 765 void addrmod2(Instr instr, Register rd, const MemOperand& x); |
768 void addrmod3(Instr instr, Register rd, const MemOperand& x); | 766 void addrmod3(Instr instr, Register rd, const MemOperand& x); |
769 void addrmod4(Instr instr, Register rn, RegList rl); | 767 void addrmod4(Instr instr, Register rn, RegList rl); |
770 void addrmod5(Instr instr, CRegister crd, const MemOperand& x); | 768 void addrmod5(Instr instr, CRegister crd, const MemOperand& x); |
771 | 769 |
772 // Labels | 770 // Labels |
773 void print(Label* L); | 771 void print(Label* L); |
774 void bind_to(Label* L, int pos); | 772 void bind_to(Label* L, int pos); |
775 void link_to(Label* L, Label* appendix); | 773 void link_to(Label* L, Label* appendix); |
776 void next(Label* L); | 774 void next(Label* L); |
777 | 775 |
778 // Record reloc info for current pc_ | 776 // Record reloc info for current pc_ |
779 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); | 777 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); |
780 }; | 778 }; |
781 | 779 |
782 } } // namespace v8::internal | 780 } } // namespace v8::internal |
783 | 781 |
784 #endif // V8_ASSEMBLER_ARM_H_ | 782 #endif // V8_ASSEMBLER_ARM_H_ |
OLD | NEW |