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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // Everything after runtime_entry (inclusive) is not GC'ed. | 197 // Everything after runtime_entry (inclusive) is not GC'ed. |
198 RUNTIME_ENTRY, | 198 RUNTIME_ENTRY, |
199 JS_RETURN, // Marks start of the ExitJSFrame code. | 199 JS_RETURN, // Marks start of the ExitJSFrame code. |
200 COMMENT, | 200 COMMENT, |
201 POSITION, // See comment for kNoPosition above. | 201 POSITION, // See comment for kNoPosition above. |
202 STATEMENT_POSITION, // See comment for kNoPosition above. | 202 STATEMENT_POSITION, // See comment for kNoPosition above. |
203 DEBUG_BREAK_SLOT, // Additional code inserted for debug break slot. | 203 DEBUG_BREAK_SLOT, // Additional code inserted for debug break slot. |
204 EXTERNAL_REFERENCE, // The address of an external C++ function. | 204 EXTERNAL_REFERENCE, // The address of an external C++ function. |
205 INTERNAL_REFERENCE, // An address inside the same function. | 205 INTERNAL_REFERENCE, // An address inside the same function. |
206 | 206 |
| 207 // Marks a constant pool. Only used on ARM. |
| 208 // It uses a custom noncompact encoding. |
| 209 CONST_POOL, |
| 210 |
207 // add more as needed | 211 // add more as needed |
208 // Pseudo-types | 212 // Pseudo-types |
209 NUMBER_OF_MODES, // There are at most 14 modes with noncompact encoding. | 213 NUMBER_OF_MODES, // There are at most 15 modes with noncompact encoding. |
210 NONE, // never recorded | 214 NONE, // never recorded |
211 LAST_CODE_ENUM = DEBUG_BREAK, | 215 LAST_CODE_ENUM = DEBUG_BREAK, |
212 LAST_GCED_ENUM = GLOBAL_PROPERTY_CELL, | 216 LAST_GCED_ENUM = GLOBAL_PROPERTY_CELL, |
213 // Modes <= LAST_COMPACT_ENUM are guaranteed to have compact encoding. | 217 // Modes <= LAST_COMPACT_ENUM are guaranteed to have compact encoding. |
214 LAST_COMPACT_ENUM = CODE_TARGET_WITH_ID | 218 LAST_COMPACT_ENUM = CODE_TARGET_WITH_ID, |
| 219 LAST_STANDARD_NONCOMPACT_ENUM = INTERNAL_REFERENCE |
215 }; | 220 }; |
216 | 221 |
217 | 222 |
218 RelocInfo() {} | 223 RelocInfo() {} |
219 | 224 |
220 RelocInfo(byte* pc, Mode rmode, intptr_t data, Code* host) | 225 RelocInfo(byte* pc, Mode rmode, intptr_t data, Code* host) |
221 : pc_(pc), rmode_(rmode), data_(data), host_(host) { | 226 : pc_(pc), rmode_(rmode), data_(data), host_(host) { |
222 } | 227 } |
223 | 228 |
224 static inline bool IsConstructCall(Mode mode) { | 229 static inline bool IsConstructCall(Mode mode) { |
225 return mode == CONSTRUCT_CALL; | 230 return mode == CONSTRUCT_CALL; |
226 } | 231 } |
227 static inline bool IsCodeTarget(Mode mode) { | 232 static inline bool IsCodeTarget(Mode mode) { |
228 return mode <= LAST_CODE_ENUM; | 233 return mode <= LAST_CODE_ENUM; |
229 } | 234 } |
230 static inline bool IsEmbeddedObject(Mode mode) { | 235 static inline bool IsEmbeddedObject(Mode mode) { |
231 return mode == EMBEDDED_OBJECT; | 236 return mode == EMBEDDED_OBJECT; |
232 } | 237 } |
233 // Is the relocation mode affected by GC? | 238 // Is the relocation mode affected by GC? |
234 static inline bool IsGCRelocMode(Mode mode) { | 239 static inline bool IsGCRelocMode(Mode mode) { |
235 return mode <= LAST_GCED_ENUM; | 240 return mode <= LAST_GCED_ENUM; |
236 } | 241 } |
237 static inline bool IsJSReturn(Mode mode) { | 242 static inline bool IsJSReturn(Mode mode) { |
238 return mode == JS_RETURN; | 243 return mode == JS_RETURN; |
239 } | 244 } |
240 static inline bool IsComment(Mode mode) { | 245 static inline bool IsComment(Mode mode) { |
241 return mode == COMMENT; | 246 return mode == COMMENT; |
242 } | 247 } |
| 248 static inline bool IsConstPool(Mode mode) { |
| 249 return mode == CONST_POOL; |
| 250 } |
243 static inline bool IsPosition(Mode mode) { | 251 static inline bool IsPosition(Mode mode) { |
244 return mode == POSITION || mode == STATEMENT_POSITION; | 252 return mode == POSITION || mode == STATEMENT_POSITION; |
245 } | 253 } |
246 static inline bool IsStatementPosition(Mode mode) { | 254 static inline bool IsStatementPosition(Mode mode) { |
247 return mode == STATEMENT_POSITION; | 255 return mode == STATEMENT_POSITION; |
248 } | 256 } |
249 static inline bool IsExternalReference(Mode mode) { | 257 static inline bool IsExternalReference(Mode mode) { |
250 return mode == EXTERNAL_REFERENCE; | 258 return mode == EXTERNAL_REFERENCE; |
251 } | 259 } |
252 static inline bool IsInternalReference(Mode mode) { | 260 static inline bool IsInternalReference(Mode mode) { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 // On ia32 and arm this is 1 + 4 + 1 + 1 + 1 + 4 = 12. | 417 // On ia32 and arm this is 1 + 4 + 1 + 1 + 1 + 4 = 12. |
410 // On x64 this is 1 + 4 + 1 + 1 + 1 + 8 == 16; | 418 // On x64 this is 1 + 4 + 1 + 1 + 1 + 8 == 16; |
411 // Here we use the maximum of the two. | 419 // Here we use the maximum of the two. |
412 static const int kMaxSize = 16; | 420 static const int kMaxSize = 16; |
413 | 421 |
414 private: | 422 private: |
415 inline uint32_t WriteVariableLengthPCJump(uint32_t pc_delta); | 423 inline uint32_t WriteVariableLengthPCJump(uint32_t pc_delta); |
416 inline void WriteTaggedPC(uint32_t pc_delta, int tag); | 424 inline void WriteTaggedPC(uint32_t pc_delta, int tag); |
417 inline void WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag); | 425 inline void WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag); |
418 inline void WriteExtraTaggedIntData(int data_delta, int top_tag); | 426 inline void WriteExtraTaggedIntData(int data_delta, int top_tag); |
| 427 inline void WriteExtraTaggedConstPoolData(int data); |
419 inline void WriteExtraTaggedData(intptr_t data_delta, int top_tag); | 428 inline void WriteExtraTaggedData(intptr_t data_delta, int top_tag); |
420 inline void WriteTaggedData(intptr_t data_delta, int tag); | 429 inline void WriteTaggedData(intptr_t data_delta, int tag); |
421 inline void WriteExtraTag(int extra_tag, int top_tag); | 430 inline void WriteExtraTag(int extra_tag, int top_tag); |
422 | 431 |
423 byte* pos_; | 432 byte* pos_; |
424 byte* last_pc_; | 433 byte* last_pc_; |
425 int last_id_; | 434 int last_id_; |
426 int last_position_; | 435 int last_position_; |
427 DISALLOW_COPY_AND_ASSIGN(RelocInfoWriter); | 436 DISALLOW_COPY_AND_ASSIGN(RelocInfoWriter); |
428 }; | 437 }; |
(...skipping 30 matching lines...) Expand all Loading... |
459 // Advance* moves the position before/after reading. | 468 // Advance* moves the position before/after reading. |
460 // *Read* reads from current byte(s) into rinfo_. | 469 // *Read* reads from current byte(s) into rinfo_. |
461 // *Get* just reads and returns info on current byte. | 470 // *Get* just reads and returns info on current byte. |
462 void Advance(int bytes = 1) { pos_ -= bytes; } | 471 void Advance(int bytes = 1) { pos_ -= bytes; } |
463 int AdvanceGetTag(); | 472 int AdvanceGetTag(); |
464 int GetExtraTag(); | 473 int GetExtraTag(); |
465 int GetTopTag(); | 474 int GetTopTag(); |
466 void ReadTaggedPC(); | 475 void ReadTaggedPC(); |
467 void AdvanceReadPC(); | 476 void AdvanceReadPC(); |
468 void AdvanceReadId(); | 477 void AdvanceReadId(); |
| 478 void AdvanceReadConstPoolData(); |
469 void AdvanceReadPosition(); | 479 void AdvanceReadPosition(); |
470 void AdvanceReadData(); | 480 void AdvanceReadData(); |
471 void AdvanceReadVariableLengthPCJump(); | 481 void AdvanceReadVariableLengthPCJump(); |
472 int GetLocatableTypeTag(); | 482 int GetLocatableTypeTag(); |
473 void ReadTaggedId(); | 483 void ReadTaggedId(); |
474 void ReadTaggedPosition(); | 484 void ReadTaggedPosition(); |
475 | 485 |
476 // If the given mode is wanted, set it in rinfo_ and return true. | 486 // If the given mode is wanted, set it in rinfo_ and return true. |
477 // Else return false. Used for efficiently skipping unwanted modes. | 487 // Else return false. Used for efficiently skipping unwanted modes. |
478 bool SetMode(RelocInfo::Mode mode) { | 488 bool SetMode(RelocInfo::Mode mode) { |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 public: | 891 public: |
882 NullCallWrapper() { } | 892 NullCallWrapper() { } |
883 virtual ~NullCallWrapper() { } | 893 virtual ~NullCallWrapper() { } |
884 virtual void BeforeCall(int call_size) const { } | 894 virtual void BeforeCall(int call_size) const { } |
885 virtual void AfterCall() const { } | 895 virtual void AfterCall() const { } |
886 }; | 896 }; |
887 | 897 |
888 } } // namespace v8::internal | 898 } } // namespace v8::internal |
889 | 899 |
890 #endif // V8_ASSEMBLER_H_ | 900 #endif // V8_ASSEMBLER_H_ |
OLD | NEW |