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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // unknown pc location. Assembler::bind() is used to bind a label to the | 50 // unknown pc location. Assembler::bind() is used to bind a label to the |
51 // current pc. A label can be bound only once. | 51 // current pc. A label can be bound only once. |
52 | 52 |
53 class Label BASE_EMBEDDED { | 53 class Label BASE_EMBEDDED { |
54 public: | 54 public: |
55 INLINE(Label()) { Unuse(); } | 55 INLINE(Label()) { Unuse(); } |
56 INLINE(~Label()) { ASSERT(!is_linked()); } | 56 INLINE(~Label()) { ASSERT(!is_linked()); } |
57 | 57 |
58 INLINE(void Unuse()) { pos_ = 0; } | 58 INLINE(void Unuse()) { pos_ = 0; } |
59 | 59 |
60 INLINE(bool is_bound() const) { return pos_ < 0; } | 60 INLINE(bool is_bound() const) { return pos_ < 0; } |
61 INLINE(bool is_unused() const) { return pos_ == 0; } | 61 INLINE(bool is_unused() const) { return pos_ == 0; } |
62 INLINE(bool is_linked() const) { return pos_ > 0; } | 62 INLINE(bool is_linked() const) { return pos_ > 0; } |
63 | 63 |
64 // Returns the position of bound or linked labels. Cannot be used | 64 // Returns the position of bound or linked labels. Cannot be used |
65 // for unused labels. | 65 // for unused labels. |
66 int pos() const; | 66 int pos() const; |
67 | 67 |
68 private: | 68 private: |
69 // pos_ encodes both the binding state (via its sign) | 69 // pos_ encodes both the binding state (via its sign) |
70 // and the binding position (via its value) of a label. | 70 // and the binding position (via its value) of a label. |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } | 225 } |
226 static inline bool IsInternalReference(Mode mode) { | 226 static inline bool IsInternalReference(Mode mode) { |
227 return mode == INTERNAL_REFERENCE; | 227 return mode == INTERNAL_REFERENCE; |
228 } | 228 } |
229 static inline bool IsDebugBreakSlot(Mode mode) { | 229 static inline bool IsDebugBreakSlot(Mode mode) { |
230 return mode == DEBUG_BREAK_SLOT; | 230 return mode == DEBUG_BREAK_SLOT; |
231 } | 231 } |
232 static inline int ModeMask(Mode mode) { return 1 << mode; } | 232 static inline int ModeMask(Mode mode) { return 1 << mode; } |
233 | 233 |
234 // Accessors | 234 // Accessors |
235 byte* pc() const { return pc_; } | 235 byte* pc() const { return pc_; } |
236 void set_pc(byte* pc) { pc_ = pc; } | 236 void set_pc(byte* pc) { pc_ = pc; } |
237 Mode rmode() const { return rmode_; } | 237 Mode rmode() const { return rmode_; } |
238 intptr_t data() const { return data_; } | 238 intptr_t data() const { return data_; } |
239 | 239 |
240 // Apply a relocation by delta bytes | 240 // Apply a relocation by delta bytes |
241 INLINE(void apply(intptr_t delta)); | 241 INLINE(void apply(intptr_t delta)); |
242 | 242 |
243 // Is the pointer this relocation info refers to coded like a plain pointer | 243 // Is the pointer this relocation info refers to coded like a plain pointer |
244 // or is it strange in some way (eg relative or patched into a series of | 244 // or is it strange in some way (eg relative or patched into a series of |
245 // instructions). | 245 // instructions). |
246 bool IsCodedSpecially(); | 246 bool IsCodedSpecially(); |
247 | 247 |
248 // Read/modify the code target in the branch/call instruction | 248 // Read/modify the code target in the branch/call instruction |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 class RelocIterator: public Malloced { | 383 class RelocIterator: public Malloced { |
384 public: | 384 public: |
385 // Create a new iterator positioned at | 385 // Create a new iterator positioned at |
386 // the beginning of the reloc info. | 386 // the beginning of the reloc info. |
387 // Relocation information with mode k is included in the | 387 // Relocation information with mode k is included in the |
388 // iteration iff bit k of mode_mask is set. | 388 // iteration iff bit k of mode_mask is set. |
389 explicit RelocIterator(Code* code, int mode_mask = -1); | 389 explicit RelocIterator(Code* code, int mode_mask = -1); |
390 explicit RelocIterator(const CodeDesc& desc, int mode_mask = -1); | 390 explicit RelocIterator(const CodeDesc& desc, int mode_mask = -1); |
391 | 391 |
392 // Iteration | 392 // Iteration |
393 bool done() const { return done_; } | 393 bool done() const { return done_; } |
394 void next(); | 394 void next(); |
395 | 395 |
396 // Return pointer valid until next next(). | 396 // Return pointer valid until next next(). |
397 RelocInfo* rinfo() { | 397 RelocInfo* rinfo() { |
398 ASSERT(!done()); | 398 ASSERT(!done()); |
399 return &rinfo_; | 399 return &rinfo_; |
400 } | 400 } |
401 | 401 |
402 private: | 402 private: |
403 // Advance* moves the position before/after reading. | 403 // Advance* moves the position before/after reading. |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 unsigned int num_bits_set; | 616 unsigned int num_bits_set; |
617 for (num_bits_set = 0; x; x >>= 1) { | 617 for (num_bits_set = 0; x; x >>= 1) { |
618 num_bits_set += x & 1; | 618 num_bits_set += x & 1; |
619 } | 619 } |
620 return num_bits_set; | 620 return num_bits_set; |
621 } | 621 } |
622 | 622 |
623 } } // namespace v8::internal | 623 } } // namespace v8::internal |
624 | 624 |
625 #endif // V8_ASSEMBLER_H_ | 625 #endif // V8_ASSEMBLER_H_ |
OLD | NEW |