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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 176 } |
177 static inline int ModeMask(Mode mode) { return 1 << mode; } | 177 static inline int ModeMask(Mode mode) { return 1 << mode; } |
178 | 178 |
179 // Accessors | 179 // Accessors |
180 byte* pc() const { return pc_; } | 180 byte* pc() const { return pc_; } |
181 void set_pc(byte* pc) { pc_ = pc; } | 181 void set_pc(byte* pc) { pc_ = pc; } |
182 Mode rmode() const { return rmode_; } | 182 Mode rmode() const { return rmode_; } |
183 intptr_t data() const { return data_; } | 183 intptr_t data() const { return data_; } |
184 | 184 |
185 // Apply a relocation by delta bytes | 185 // Apply a relocation by delta bytes |
186 INLINE(void apply(int delta)); | 186 INLINE(void apply(intptr_t delta)); |
187 | 187 |
188 // Read/modify the code target in the branch/call instruction | 188 // Read/modify the code target in the branch/call instruction |
189 // this relocation applies to; | 189 // this relocation applies to; |
190 // can only be called if IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY | 190 // can only be called if IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY |
191 INLINE(Address target_address()); | 191 INLINE(Address target_address()); |
192 INLINE(void set_target_address(Address target)); | 192 INLINE(void set_target_address(Address target)); |
193 INLINE(Object* target_object()); | 193 INLINE(Object* target_object()); |
194 INLINE(Object** target_object_address()); | 194 INLINE(Object** target_object_address()); |
195 INLINE(void set_target_object(Object* target)); | 195 INLINE(void set_target_object(Object* target)); |
196 | 196 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 void Write(const RelocInfo* rinfo); | 259 void Write(const RelocInfo* rinfo); |
260 | 260 |
261 // Update the state of the stream after reloc info buffer | 261 // Update the state of the stream after reloc info buffer |
262 // and/or code is moved while the stream is active. | 262 // and/or code is moved while the stream is active. |
263 void Reposition(byte* pos, byte* pc) { | 263 void Reposition(byte* pos, byte* pc) { |
264 pos_ = pos; | 264 pos_ = pos; |
265 last_pc_ = pc; | 265 last_pc_ = pc; |
266 } | 266 } |
267 | 267 |
268 // Max size (bytes) of a written RelocInfo. | 268 // Max size (bytes) of a written RelocInfo. Longest encoding is |
269 static const int kMaxSize = 12; | 269 // ExtraTag, VariableLengthPCJump, ExtraTag, pc_delta, ExtraTag, data_delta. |
| 270 // On ia32 and arm this is 1 + 4 + 1 + 1 + 1 + 4 = 12. |
| 271 // On x64 this is 1 + 4 + 1 + 1 + 1 + 8 == 16; |
| 272 // Here we use the maximum of the two. |
| 273 static const int kMaxSize = 16; |
270 | 274 |
271 private: | 275 private: |
272 inline uint32_t WriteVariableLengthPCJump(uint32_t pc_delta); | 276 inline uint32_t WriteVariableLengthPCJump(uint32_t pc_delta); |
273 inline void WriteTaggedPC(uint32_t pc_delta, int tag); | 277 inline void WriteTaggedPC(uint32_t pc_delta, int tag); |
274 inline void WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag); | 278 inline void WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag); |
275 inline void WriteExtraTaggedData(intptr_t data_delta, int top_tag); | 279 inline void WriteExtraTaggedData(intptr_t data_delta, int top_tag); |
276 inline void WriteTaggedData(intptr_t data_delta, int tag); | 280 inline void WriteTaggedData(intptr_t data_delta, int tag); |
277 inline void WriteExtraTag(int extra_tag, int top_tag); | 281 inline void WriteExtraTag(int extra_tag, int top_tag); |
278 | 282 |
279 byte* pos_; | 283 byte* pos_; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 static inline bool is_uint5(int x) { return is_uintn(x, 5); } | 471 static inline bool is_uint5(int x) { return is_uintn(x, 5); } |
468 static inline bool is_uint6(int x) { return is_uintn(x, 6); } | 472 static inline bool is_uint6(int x) { return is_uintn(x, 6); } |
469 static inline bool is_uint8(int x) { return is_uintn(x, 8); } | 473 static inline bool is_uint8(int x) { return is_uintn(x, 8); } |
470 static inline bool is_uint12(int x) { return is_uintn(x, 12); } | 474 static inline bool is_uint12(int x) { return is_uintn(x, 12); } |
471 static inline bool is_uint16(int x) { return is_uintn(x, 16); } | 475 static inline bool is_uint16(int x) { return is_uintn(x, 16); } |
472 static inline bool is_uint24(int x) { return is_uintn(x, 24); } | 476 static inline bool is_uint24(int x) { return is_uintn(x, 24); } |
473 | 477 |
474 } } // namespace v8::internal | 478 } } // namespace v8::internal |
475 | 479 |
476 #endif // V8_ASSEMBLER_H_ | 480 #endif // V8_ASSEMBLER_H_ |
OLD | NEW |