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 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 // an instruction or relocation information. | 983 // an instruction or relocation information. |
984 inline bool buffer_overflow() const { | 984 inline bool buffer_overflow() const { |
985 return pc_ >= reloc_info_writer.pos() - kGap; | 985 return pc_ >= reloc_info_writer.pos() - kGap; |
986 } | 986 } |
987 | 987 |
988 // Get the number of bytes available in the buffer. | 988 // Get the number of bytes available in the buffer. |
989 inline int available_space() const { return reloc_info_writer.pos() - pc_; } | 989 inline int available_space() const { return reloc_info_writer.pos() - pc_; } |
990 | 990 |
991 static bool IsNop(Address addr); | 991 static bool IsNop(Address addr); |
992 | 992 |
993 AssemblerPositionsRecorder* positions_recorder() { | |
994 return &positions_recorder_; | |
995 } | |
996 | |
997 int relocation_writer_size() { | 993 int relocation_writer_size() { |
998 return (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 994 return (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
999 } | 995 } |
1000 | 996 |
1001 // Avoid overflows for displacements etc. | 997 // Avoid overflows for displacements etc. |
1002 static const int kMaximalBufferSize = 512*MB; | 998 static const int kMaximalBufferSize = 512*MB; |
1003 | 999 |
1004 byte byte_at(int pos) { return buffer_[pos]; } | 1000 byte byte_at(int pos) { return buffer_[pos]; } |
1005 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } | 1001 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } |
1006 | 1002 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 friend class CodePatcher; | 1068 friend class CodePatcher; |
1073 friend class EnsureSpace; | 1069 friend class EnsureSpace; |
1074 | 1070 |
1075 // Internal reference positions, required for (potential) patching in | 1071 // Internal reference positions, required for (potential) patching in |
1076 // GrowBuffer(); contains only those internal references whose labels | 1072 // GrowBuffer(); contains only those internal references whose labels |
1077 // are already bound. | 1073 // are already bound. |
1078 std::deque<int> internal_reference_positions_; | 1074 std::deque<int> internal_reference_positions_; |
1079 | 1075 |
1080 // code generation | 1076 // code generation |
1081 RelocInfoWriter reloc_info_writer; | 1077 RelocInfoWriter reloc_info_writer; |
1082 | |
1083 AssemblerPositionsRecorder positions_recorder_; | |
1084 friend class AssemblerPositionsRecorder; | |
1085 }; | 1078 }; |
1086 | 1079 |
1087 | 1080 |
1088 // Helper class that ensures that there is enough space for generating | 1081 // Helper class that ensures that there is enough space for generating |
1089 // instructions and relocation information. The constructor makes | 1082 // instructions and relocation information. The constructor makes |
1090 // sure that there is enough space and (in debug mode) the destructor | 1083 // sure that there is enough space and (in debug mode) the destructor |
1091 // checks that we did not generate too much. | 1084 // checks that we did not generate too much. |
1092 class EnsureSpace BASE_EMBEDDED { | 1085 class EnsureSpace BASE_EMBEDDED { |
1093 public: | 1086 public: |
1094 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) { | 1087 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) { |
(...skipping 14 matching lines...) Expand all Loading... |
1109 Assembler* assembler_; | 1102 Assembler* assembler_; |
1110 #ifdef DEBUG | 1103 #ifdef DEBUG |
1111 int space_before_; | 1104 int space_before_; |
1112 #endif | 1105 #endif |
1113 }; | 1106 }; |
1114 | 1107 |
1115 } // namespace internal | 1108 } // namespace internal |
1116 } // namespace v8 | 1109 } // namespace v8 |
1117 | 1110 |
1118 #endif // V8_X87_ASSEMBLER_X87_H_ | 1111 #endif // V8_X87_ASSEMBLER_X87_H_ |
OLD | NEW |