| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 363     // Please note the order is important (see IsCodeTarget, IsGCRelocMode). | 363     // Please note the order is important (see IsCodeTarget, IsGCRelocMode). | 
| 364     CODE_TARGET,  // Code target which is not any of the above. | 364     CODE_TARGET,  // Code target which is not any of the above. | 
| 365     CODE_TARGET_WITH_ID, | 365     CODE_TARGET_WITH_ID, | 
| 366     CONSTRUCT_CALL,  // code target that is a call to a JavaScript constructor. | 366     CONSTRUCT_CALL,  // code target that is a call to a JavaScript constructor. | 
| 367     DEBUGGER_STATEMENT,  // Code target for the debugger statement. | 367     DEBUGGER_STATEMENT,  // Code target for the debugger statement. | 
| 368     EMBEDDED_OBJECT, | 368     EMBEDDED_OBJECT, | 
| 369     CELL, | 369     CELL, | 
| 370 | 370 | 
| 371     // Everything after runtime_entry (inclusive) is not GC'ed. | 371     // Everything after runtime_entry (inclusive) is not GC'ed. | 
| 372     RUNTIME_ENTRY, | 372     RUNTIME_ENTRY, | 
| 373     JS_RETURN,  // Marks start of the ExitJSFrame code. |  | 
| 374     COMMENT, | 373     COMMENT, | 
| 375     POSITION,            // See comment for kNoPosition above. | 374     POSITION,            // See comment for kNoPosition above. | 
| 376     STATEMENT_POSITION,  // See comment for kNoPosition above. | 375     STATEMENT_POSITION,  // See comment for kNoPosition above. | 
| 377 | 376 | 
| 378     // Additional code inserted for debug break slot. | 377     // Additional code inserted for debug break slot. | 
| 379     DEBUG_BREAK_SLOT_AT_POSITION, | 378     DEBUG_BREAK_SLOT_AT_POSITION, | 
|  | 379     DEBUG_BREAK_SLOT_AT_RETURN, | 
| 380     DEBUG_BREAK_SLOT_AT_CALL, | 380     DEBUG_BREAK_SLOT_AT_CALL, | 
| 381     DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL, | 381     DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL, | 
| 382 | 382 | 
| 383     EXTERNAL_REFERENCE,  // The address of an external C++ function. | 383     EXTERNAL_REFERENCE,  // The address of an external C++ function. | 
| 384     INTERNAL_REFERENCE,  // An address inside the same function. | 384     INTERNAL_REFERENCE,  // An address inside the same function. | 
| 385 | 385 | 
| 386     // Encoded internal reference, used only on MIPS, MIPS64 and PPC. | 386     // Encoded internal reference, used only on MIPS, MIPS64 and PPC. | 
| 387     INTERNAL_REFERENCE_ENCODED, | 387     INTERNAL_REFERENCE_ENCODED, | 
| 388 | 388 | 
| 389     // Continuation points for a generator yield. | 389     // Continuation points for a generator yield. | 
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 435     return mode == EMBEDDED_OBJECT; | 435     return mode == EMBEDDED_OBJECT; | 
| 436   } | 436   } | 
| 437   static inline bool IsCell(Mode mode) { return mode == CELL; } | 437   static inline bool IsCell(Mode mode) { return mode == CELL; } | 
| 438   static inline bool IsRuntimeEntry(Mode mode) { | 438   static inline bool IsRuntimeEntry(Mode mode) { | 
| 439     return mode == RUNTIME_ENTRY; | 439     return mode == RUNTIME_ENTRY; | 
| 440   } | 440   } | 
| 441   // Is the relocation mode affected by GC? | 441   // Is the relocation mode affected by GC? | 
| 442   static inline bool IsGCRelocMode(Mode mode) { | 442   static inline bool IsGCRelocMode(Mode mode) { | 
| 443     return mode <= LAST_GCED_ENUM; | 443     return mode <= LAST_GCED_ENUM; | 
| 444   } | 444   } | 
| 445   static inline bool IsJSReturn(Mode mode) { |  | 
| 446     return mode == JS_RETURN; |  | 
| 447   } |  | 
| 448   static inline bool IsComment(Mode mode) { | 445   static inline bool IsComment(Mode mode) { | 
| 449     return mode == COMMENT; | 446     return mode == COMMENT; | 
| 450   } | 447   } | 
| 451   static inline bool IsConstPool(Mode mode) { | 448   static inline bool IsConstPool(Mode mode) { | 
| 452     return mode == CONST_POOL; | 449     return mode == CONST_POOL; | 
| 453   } | 450   } | 
| 454   static inline bool IsVeneerPool(Mode mode) { | 451   static inline bool IsVeneerPool(Mode mode) { | 
| 455     return mode == VENEER_POOL; | 452     return mode == VENEER_POOL; | 
| 456   } | 453   } | 
| 457   static inline bool IsDeoptReason(Mode mode) { | 454   static inline bool IsDeoptReason(Mode mode) { | 
| 458     return mode == DEOPT_REASON; | 455     return mode == DEOPT_REASON; | 
| 459   } | 456   } | 
| 460   static inline bool IsPosition(Mode mode) { | 457   static inline bool IsPosition(Mode mode) { | 
| 461     return mode == POSITION || mode == STATEMENT_POSITION; | 458     return mode == POSITION || mode == STATEMENT_POSITION; | 
| 462   } | 459   } | 
| 463   static inline bool IsStatementPosition(Mode mode) { | 460   static inline bool IsStatementPosition(Mode mode) { | 
| 464     return mode == STATEMENT_POSITION; | 461     return mode == STATEMENT_POSITION; | 
| 465   } | 462   } | 
| 466   static inline bool IsExternalReference(Mode mode) { | 463   static inline bool IsExternalReference(Mode mode) { | 
| 467     return mode == EXTERNAL_REFERENCE; | 464     return mode == EXTERNAL_REFERENCE; | 
| 468   } | 465   } | 
| 469   static inline bool IsInternalReference(Mode mode) { | 466   static inline bool IsInternalReference(Mode mode) { | 
| 470     return mode == INTERNAL_REFERENCE; | 467     return mode == INTERNAL_REFERENCE; | 
| 471   } | 468   } | 
| 472   static inline bool IsInternalReferenceEncoded(Mode mode) { | 469   static inline bool IsInternalReferenceEncoded(Mode mode) { | 
| 473     return mode == INTERNAL_REFERENCE_ENCODED; | 470     return mode == INTERNAL_REFERENCE_ENCODED; | 
| 474   } | 471   } | 
| 475   static inline bool IsDebugBreakSlot(Mode mode) { | 472   static inline bool IsDebugBreakSlot(Mode mode) { | 
| 476     return IsDebugBreakSlotAtPosition(mode) || IsDebugBreakSlotAtCall(mode) || | 473     return IsDebugBreakSlotAtPosition(mode) || IsDebugBreakSlotAtReturn(mode) || | 
|  | 474            IsDebugBreakSlotAtCall(mode) || | 
| 477            IsDebugBreakSlotAtConstructCall(mode); | 475            IsDebugBreakSlotAtConstructCall(mode); | 
| 478   } | 476   } | 
| 479   static inline bool IsDebugBreakSlotAtPosition(Mode mode) { | 477   static inline bool IsDebugBreakSlotAtPosition(Mode mode) { | 
| 480     return mode == DEBUG_BREAK_SLOT_AT_POSITION; | 478     return mode == DEBUG_BREAK_SLOT_AT_POSITION; | 
| 481   } | 479   } | 
|  | 480   static inline bool IsDebugBreakSlotAtReturn(Mode mode) { | 
|  | 481     return mode == DEBUG_BREAK_SLOT_AT_RETURN; | 
|  | 482   } | 
| 482   static inline bool IsDebugBreakSlotAtCall(Mode mode) { | 483   static inline bool IsDebugBreakSlotAtCall(Mode mode) { | 
| 483     return mode == DEBUG_BREAK_SLOT_AT_CALL; | 484     return mode == DEBUG_BREAK_SLOT_AT_CALL; | 
| 484   } | 485   } | 
| 485   static inline bool IsDebugBreakSlotAtConstructCall(Mode mode) { | 486   static inline bool IsDebugBreakSlotAtConstructCall(Mode mode) { | 
| 486     return mode == DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL; | 487     return mode == DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL; | 
| 487   } | 488   } | 
| 488   static inline bool IsDebuggerStatement(Mode mode) { | 489   static inline bool IsDebuggerStatement(Mode mode) { | 
| 489     return mode == DEBUGGER_STATEMENT; | 490     return mode == DEBUGGER_STATEMENT; | 
| 490   } | 491   } | 
| 491   static inline bool IsNone(Mode mode) { | 492   static inline bool IsNone(Mode mode) { | 
| 492     return mode == NONE32 || mode == NONE64; | 493     return mode == NONE32 || mode == NONE64; | 
| 493   } | 494   } | 
| 494   static inline bool IsCodeAgeSequence(Mode mode) { | 495   static inline bool IsCodeAgeSequence(Mode mode) { | 
| 495     return mode == CODE_AGE_SEQUENCE; | 496     return mode == CODE_AGE_SEQUENCE; | 
| 496   } | 497   } | 
| 497   static inline bool IsGeneratorContinuation(Mode mode) { | 498   static inline bool IsGeneratorContinuation(Mode mode) { | 
| 498     return mode == GENERATOR_CONTINUATION; | 499     return mode == GENERATOR_CONTINUATION; | 
| 499   } | 500   } | 
| 500   static inline int ModeMask(Mode mode) { return 1 << mode; } | 501   static inline int ModeMask(Mode mode) { return 1 << mode; } | 
| 501 | 502 | 
| 502   // Accessors | 503   // Accessors | 
| 503   byte* pc() const { return pc_; } | 504   byte* pc() const { return pc_; } | 
| 504   void set_pc(byte* pc) { pc_ = pc; } | 505   void set_pc(byte* pc) { pc_ = pc; } | 
| 505   Mode rmode() const {  return rmode_; } | 506   Mode rmode() const {  return rmode_; } | 
| 506   intptr_t data() const { return data_; } | 507   intptr_t data() const { return data_; } | 
| 507   Code* host() const { return host_; } | 508   Code* host() const { return host_; } | 
| 508   void set_host(Code* host) { host_ = host; } | 509   void set_host(Code* host) { host_ = host; } | 
| 509 | 510 | 
| 510   // Apply a relocation by delta bytes | 511   // Apply a relocation by delta bytes. When the code object is moved, PC | 
| 511   INLINE(void apply(intptr_t delta, | 512   // relative addresses have to be updated as well as absolute addresses | 
| 512                     ICacheFlushMode icache_flush_mode = | 513   // inside the code (internal references). | 
| 513                         FLUSH_ICACHE_IF_NEEDED)); | 514   // Do not forget to flush the icache afterwards! | 
|  | 515   INLINE(void apply(intptr_t delta)); | 
| 514 | 516 | 
| 515   // Is the pointer this relocation info refers to coded like a plain pointer | 517   // Is the pointer this relocation info refers to coded like a plain pointer | 
| 516   // or is it strange in some way (e.g. relative or patched into a series of | 518   // or is it strange in some way (e.g. relative or patched into a series of | 
| 517   // instructions). | 519   // instructions). | 
| 518   bool IsCodedSpecially(); | 520   bool IsCodedSpecially(); | 
| 519 | 521 | 
| 520   // If true, the pointer this relocation info refers to is an entry in the | 522   // If true, the pointer this relocation info refers to is an entry in the | 
| 521   // constant pool, otherwise the pointer is embedded in the instruction stream. | 523   // constant pool, otherwise the pointer is embedded in the instruction stream. | 
| 522   bool IsInConstantPool(); | 524   bool IsInConstantPool(); | 
| 523 | 525 | 
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 589   // applies to; can only be called if rmode_ is INTERNAL_REFERENCE. | 591   // applies to; can only be called if rmode_ is INTERNAL_REFERENCE. | 
| 590   INLINE(Address target_internal_reference()); | 592   INLINE(Address target_internal_reference()); | 
| 591 | 593 | 
| 592   // Return the reference address this relocation applies to; | 594   // Return the reference address this relocation applies to; | 
| 593   // can only be called if rmode_ is INTERNAL_REFERENCE. | 595   // can only be called if rmode_ is INTERNAL_REFERENCE. | 
| 594   INLINE(Address target_internal_reference_address()); | 596   INLINE(Address target_internal_reference_address()); | 
| 595 | 597 | 
| 596   // Read/modify the address of a call instruction. This is used to relocate | 598   // Read/modify the address of a call instruction. This is used to relocate | 
| 597   // the break points where straight-line code is patched with a call | 599   // the break points where straight-line code is patched with a call | 
| 598   // instruction. | 600   // instruction. | 
| 599   INLINE(Address call_address()); | 601   INLINE(Address debug_call_address()); | 
| 600   INLINE(void set_call_address(Address target)); | 602   INLINE(void set_debug_call_address(Address target)); | 
| 601   INLINE(Object* call_object()); |  | 
| 602   INLINE(void set_call_object(Object* target)); |  | 
| 603   INLINE(Object** call_object_address()); |  | 
| 604 | 603 | 
| 605   // Wipe out a relocation to a fixed value, used for making snapshots | 604   // Wipe out a relocation to a fixed value, used for making snapshots | 
| 606   // reproducible. | 605   // reproducible. | 
| 607   INLINE(void WipeOut()); | 606   INLINE(void WipeOut()); | 
| 608 | 607 | 
| 609   template<typename StaticVisitor> inline void Visit(Heap* heap); | 608   template<typename StaticVisitor> inline void Visit(Heap* heap); | 
| 610   inline void Visit(Isolate* isolate, ObjectVisitor* v); | 609   inline void Visit(Isolate* isolate, ObjectVisitor* v); | 
| 611 | 610 | 
| 612   // Patch the code with a call. | 611   // Patch the code with a call. | 
| 613   void PatchCodeWithCall(Address target, int guard_bytes); | 612   void PatchCodeWithCall(Address target, int guard_bytes); | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 633 #endif  // ENABLE_DISASSEMBLER | 632 #endif  // ENABLE_DISASSEMBLER | 
| 634 #ifdef VERIFY_HEAP | 633 #ifdef VERIFY_HEAP | 
| 635   void Verify(Isolate* isolate); | 634   void Verify(Isolate* isolate); | 
| 636 #endif | 635 #endif | 
| 637 | 636 | 
| 638   static const int kCodeTargetMask = (1 << (LAST_CODE_ENUM + 1)) - 1; | 637   static const int kCodeTargetMask = (1 << (LAST_CODE_ENUM + 1)) - 1; | 
| 639   static const int kPositionMask = 1 << POSITION | 1 << STATEMENT_POSITION; | 638   static const int kPositionMask = 1 << POSITION | 1 << STATEMENT_POSITION; | 
| 640   static const int kDataMask = | 639   static const int kDataMask = | 
| 641       (1 << CODE_TARGET_WITH_ID) | kPositionMask | (1 << COMMENT); | 640       (1 << CODE_TARGET_WITH_ID) | kPositionMask | (1 << COMMENT); | 
| 642   static const int kDebugBreakSlotMask = | 641   static const int kDebugBreakSlotMask = | 
| 643       1 << DEBUG_BREAK_SLOT_AT_POSITION | 1 << DEBUG_BREAK_SLOT_AT_CALL | | 642       1 << DEBUG_BREAK_SLOT_AT_POSITION | 1 << DEBUG_BREAK_SLOT_AT_RETURN | | 
| 644       1 << DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL; | 643       1 << DEBUG_BREAK_SLOT_AT_CALL | 1 << DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL; | 
| 645   static const int kApplyMask;  // Modes affected by apply. Depends on arch. | 644   static const int kApplyMask;  // Modes affected by apply.  Depends on arch. | 
| 646 | 645 | 
| 647  private: | 646  private: | 
| 648   // On ARM, note that pc_ is the address of the constant pool entry | 647   // On ARM, note that pc_ is the address of the constant pool entry | 
| 649   // to be relocated and not the address of the instruction | 648   // to be relocated and not the address of the instruction | 
| 650   // referencing the constant pool entry (except when rmode_ == | 649   // referencing the constant pool entry (except when rmode_ == | 
| 651   // comment). | 650   // comment). | 
| 652   byte* pc_; | 651   byte* pc_; | 
| 653   Mode rmode_; | 652   Mode rmode_; | 
| 654   intptr_t data_; | 653   intptr_t data_; | 
| 655   Code* host_; | 654   Code* host_; | 
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1270   }; | 1269   }; | 
| 1271 | 1270 | 
| 1272   Label emitted_label_;  // Records pc_offset of emitted pool | 1271   Label emitted_label_;  // Records pc_offset of emitted pool | 
| 1273   PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; | 1272   PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; | 
| 1274 }; | 1273 }; | 
| 1275 | 1274 | 
| 1276 | 1275 | 
| 1277 } }  // namespace v8::internal | 1276 } }  // namespace v8::internal | 
| 1278 | 1277 | 
| 1279 #endif  // V8_ASSEMBLER_H_ | 1278 #endif  // V8_ASSEMBLER_H_ | 
| OLD | NEW | 
|---|