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 are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // 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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 // is: should we always use Operands instead of Registers where an | 652 // is: should we always use Operands instead of Registers where an |
653 // Operand is possible, or should we have a Register (overloaded) form | 653 // Operand is possible, or should we have a Register (overloaded) form |
654 // instead? We must be careful to make sure that the selected instruction | 654 // instead? We must be careful to make sure that the selected instruction |
655 // is obvious from the parameters to avoid hard-to-find code generation | 655 // is obvious from the parameters to avoid hard-to-find code generation |
656 // bugs. | 656 // bugs. |
657 | 657 |
658 // Insert the smallest number of nop instructions | 658 // Insert the smallest number of nop instructions |
659 // possible to align the pc offset to a multiple | 659 // possible to align the pc offset to a multiple |
660 // of m. m must be a power of 2. | 660 // of m. m must be a power of 2. |
661 void Align(int m); | 661 void Align(int m); |
| 662 void Nop(int bytes = 1); |
662 // Aligns code to something that's optimal for a jump target for the platform. | 663 // Aligns code to something that's optimal for a jump target for the platform. |
663 void CodeTargetAlign(); | 664 void CodeTargetAlign(); |
664 | 665 |
665 // Stack | 666 // Stack |
666 void pushad(); | 667 void pushad(); |
667 void popad(); | 668 void popad(); |
668 | 669 |
669 void pushfd(); | 670 void pushfd(); |
670 void popfd(); | 671 void popfd(); |
671 | 672 |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 int pc_offset() const { return pc_ - buffer_; } | 1074 int pc_offset() const { return pc_ - buffer_; } |
1074 | 1075 |
1075 // Check if there is less than kGap bytes available in the buffer. | 1076 // Check if there is less than kGap bytes available in the buffer. |
1076 // If this is the case, we need to grow the buffer before emitting | 1077 // If this is the case, we need to grow the buffer before emitting |
1077 // an instruction or relocation information. | 1078 // an instruction or relocation information. |
1078 inline bool overflow() const { return pc_ >= reloc_info_writer.pos() - kGap; } | 1079 inline bool overflow() const { return pc_ >= reloc_info_writer.pos() - kGap; } |
1079 | 1080 |
1080 // Get the number of bytes available in the buffer. | 1081 // Get the number of bytes available in the buffer. |
1081 inline int available_space() const { return reloc_info_writer.pos() - pc_; } | 1082 inline int available_space() const { return reloc_info_writer.pos() - pc_; } |
1082 | 1083 |
1083 static bool IsNop(Address addr) { return *addr == 0x90; } | 1084 static bool IsNop(Address addr); |
1084 | 1085 |
1085 PositionsRecorder* positions_recorder() { return &positions_recorder_; } | 1086 PositionsRecorder* positions_recorder() { return &positions_recorder_; } |
1086 | 1087 |
1087 int relocation_writer_size() { | 1088 int relocation_writer_size() { |
1088 return (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 1089 return (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
1089 } | 1090 } |
1090 | 1091 |
1091 // Avoid overflows for displacements etc. | 1092 // Avoid overflows for displacements etc. |
1092 static const int kMaximalBufferSize = 512*MB; | 1093 static const int kMaximalBufferSize = 512*MB; |
1093 static const int kMinimalBufferSize = 4*KB; | 1094 static const int kMinimalBufferSize = 4*KB; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 private: | 1201 private: |
1201 Assembler* assembler_; | 1202 Assembler* assembler_; |
1202 #ifdef DEBUG | 1203 #ifdef DEBUG |
1203 int space_before_; | 1204 int space_before_; |
1204 #endif | 1205 #endif |
1205 }; | 1206 }; |
1206 | 1207 |
1207 } } // namespace v8::internal | 1208 } } // namespace v8::internal |
1208 | 1209 |
1209 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 1210 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
OLD | NEW |