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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 // Call sequence is: | 622 // Call sequence is: |
623 // mov lr, pc | 623 // mov lr, pc |
624 // ldr pc, [pc, #...] @ call address | 624 // ldr pc, [pc, #...] @ call address |
625 // @ return address | 625 // @ return address |
626 static const int kCallTargetAddressOffset = kInstrSize; | 626 static const int kCallTargetAddressOffset = kInstrSize; |
627 #endif | 627 #endif |
628 | 628 |
629 // Distance between start of patched return sequence and the emitted address | 629 // Distance between start of patched return sequence and the emitted address |
630 // to jump to. | 630 // to jump to. |
631 #ifdef USE_BLX | 631 #ifdef USE_BLX |
632 // Return sequence is: | 632 // Patched return sequence is: |
633 // ldr ip, [pc, #0] @ emited address and start | 633 // ldr ip, [pc, #0] @ emited address and start |
634 // blx ip | 634 // blx ip |
635 static const int kPatchReturnSequenceAddressOffset = 0 * kInstrSize; | 635 static const int kPatchReturnSequenceAddressOffset = 0 * kInstrSize; |
636 #else | 636 #else |
637 // Return sequence is: | 637 // Patched return sequence is: |
638 // mov lr, pc @ start of sequence | 638 // mov lr, pc @ start of sequence |
639 // ldr pc, [pc, #-4] @ emited address | 639 // ldr pc, [pc, #-4] @ emited address |
640 static const int kPatchReturnSequenceAddressOffset = kInstrSize; | 640 static const int kPatchReturnSequenceAddressOffset = kInstrSize; |
641 #endif | 641 #endif |
642 | 642 |
| 643 // Distance between start of patched debug break slot and the emitted address |
| 644 // to jump to. |
| 645 #ifdef USE_BLX |
| 646 // Patched debug break slot code is: |
| 647 // ldr ip, [pc, #0] @ emited address and start |
| 648 // blx ip |
| 649 static const int kPatchDebugBreakSlotAddressOffset = 0 * kInstrSize; |
| 650 #else |
| 651 // Patched debug break slot code is: |
| 652 // mov lr, pc @ start of sequence |
| 653 // ldr pc, [pc, #-4] @ emited address |
| 654 static const int kPatchDebugBreakSlotAddressOffset = kInstrSize; |
| 655 #endif |
| 656 |
643 // Difference between address of current opcode and value read from pc | 657 // Difference between address of current opcode and value read from pc |
644 // register. | 658 // register. |
645 static const int kPcLoadDelta = 8; | 659 static const int kPcLoadDelta = 8; |
646 | 660 |
647 static const int kJSReturnSequenceLength = 4; | 661 static const int kJSReturnSequenceInstructions = 4; |
| 662 static const int kDebugBreakSlotInstructions = 3; |
| 663 static const int kDebugBreakSlotLength = |
| 664 kDebugBreakSlotInstructions * kInstrSize; |
648 | 665 |
649 // --------------------------------------------------------------------------- | 666 // --------------------------------------------------------------------------- |
650 // Code generation | 667 // Code generation |
651 | 668 |
652 // Insert the smallest number of nop instructions | 669 // Insert the smallest number of nop instructions |
653 // possible to align the pc offset to a multiple | 670 // possible to align the pc offset to a multiple |
654 // of m. m must be a power of 2 (>= 4). | 671 // of m. m must be a power of 2 (>= 4). |
655 void Align(int m); | 672 void Align(int m); |
656 | 673 |
657 // Branch instructions | 674 // Branch instructions |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 | 991 |
975 // Postpone the generation of the constant pool for the specified number of | 992 // Postpone the generation of the constant pool for the specified number of |
976 // instructions. | 993 // instructions. |
977 void BlockConstPoolFor(int instructions); | 994 void BlockConstPoolFor(int instructions); |
978 | 995 |
979 // Debugging | 996 // Debugging |
980 | 997 |
981 // Mark address of the ExitJSFrame code. | 998 // Mark address of the ExitJSFrame code. |
982 void RecordJSReturn(); | 999 void RecordJSReturn(); |
983 | 1000 |
| 1001 // Mark address of a debug break slot. |
| 1002 void RecordDebugBreakSlot(); |
| 1003 |
984 // Record a comment relocation entry that can be used by a disassembler. | 1004 // Record a comment relocation entry that can be used by a disassembler. |
985 // Use --debug_code to enable. | 1005 // Use --debug_code to enable. |
986 void RecordComment(const char* msg); | 1006 void RecordComment(const char* msg); |
987 | 1007 |
988 void RecordPosition(int pos); | 1008 void RecordPosition(int pos); |
989 void RecordStatementPosition(int pos); | 1009 void RecordStatementPosition(int pos); |
990 void WriteRecordedPositions(); | 1010 bool WriteRecordedPositions(); |
991 | 1011 |
992 int pc_offset() const { return pc_ - buffer_; } | 1012 int pc_offset() const { return pc_ - buffer_; } |
993 int current_position() const { return current_position_; } | 1013 int current_position() const { return current_position_; } |
994 int current_statement_position() const { return current_statement_position_; } | 1014 int current_statement_position() const { return current_statement_position_; } |
995 | 1015 |
996 bool can_peephole_optimize(int instructions) { | 1016 bool can_peephole_optimize(int instructions) { |
997 if (!FLAG_peephole_optimization) return false; | 1017 if (!FLAG_peephole_optimization) return false; |
998 if (last_bound_pos_ > pc_offset() - instructions * kInstrSize) return false; | 1018 if (last_bound_pos_ > pc_offset() - instructions * kInstrSize) return false; |
999 return reloc_info_writer.last_pc() <= pc_ - instructions * kInstrSize; | 1019 return reloc_info_writer.last_pc() <= pc_ - instructions * kInstrSize; |
1000 } | 1020 } |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 | 1171 |
1152 friend class RegExpMacroAssemblerARM; | 1172 friend class RegExpMacroAssemblerARM; |
1153 friend class RelocInfo; | 1173 friend class RelocInfo; |
1154 friend class CodePatcher; | 1174 friend class CodePatcher; |
1155 friend class BlockConstPoolScope; | 1175 friend class BlockConstPoolScope; |
1156 }; | 1176 }; |
1157 | 1177 |
1158 } } // namespace v8::internal | 1178 } } // namespace v8::internal |
1159 | 1179 |
1160 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1180 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
OLD | NEW |