Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: src/assembler.h

Issue 2951473002: Remove enum RelocInfo::CODE_TARGET_WITH_ID. (Closed)
Patch Set: Review update. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm64/assembler-arm64.cc ('k') | src/assembler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 339
340 // The maximum size for a call instruction including pc-jump. 340 // The maximum size for a call instruction including pc-jump.
341 static const int kMaxCallSize = 6; 341 static const int kMaxCallSize = 6;
342 342
343 // The maximum pc delta that will use the short encoding. 343 // The maximum pc delta that will use the short encoding.
344 static const int kMaxSmallPCDelta; 344 static const int kMaxSmallPCDelta;
345 345
346 enum Mode { 346 enum Mode {
347 // Please note the order is important (see IsCodeTarget, IsGCRelocMode). 347 // Please note the order is important (see IsCodeTarget, IsGCRelocMode).
348 CODE_TARGET, 348 CODE_TARGET,
349 CODE_TARGET_WITH_ID,
350 EMBEDDED_OBJECT, 349 EMBEDDED_OBJECT,
351 // Wasm entries are to relocate pointers into the wasm memory embedded in 350 // Wasm entries are to relocate pointers into the wasm memory embedded in
352 // wasm code. Everything after WASM_MEMORY_REFERENCE (inclusive) is not 351 // wasm code. Everything after WASM_MEMORY_REFERENCE (inclusive) is not
353 // GC'ed. 352 // GC'ed.
354 WASM_MEMORY_REFERENCE, 353 WASM_MEMORY_REFERENCE,
355 WASM_GLOBAL_REFERENCE, 354 WASM_GLOBAL_REFERENCE,
356 WASM_MEMORY_SIZE_REFERENCE, 355 WASM_MEMORY_SIZE_REFERENCE,
357 WASM_FUNCTION_TABLE_SIZE_REFERENCE, 356 WASM_FUNCTION_TABLE_SIZE_REFERENCE,
358 WASM_PROTECTED_INSTRUCTION_LANDING, 357 WASM_PROTECTED_INSTRUCTION_LANDING,
359 CELL, 358 CELL,
(...skipping 29 matching lines...) Expand all
389 388
390 // Pseudo-types 389 // Pseudo-types
391 NUMBER_OF_MODES, 390 NUMBER_OF_MODES,
392 NONE32, // never recorded 32-bit value 391 NONE32, // never recorded 32-bit value
393 NONE64, // never recorded 64-bit value 392 NONE64, // never recorded 64-bit value
394 CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by 393 CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by
395 // code aging. 394 // code aging.
396 395
397 FIRST_REAL_RELOC_MODE = CODE_TARGET, 396 FIRST_REAL_RELOC_MODE = CODE_TARGET,
398 LAST_REAL_RELOC_MODE = VENEER_POOL, 397 LAST_REAL_RELOC_MODE = VENEER_POOL,
399 LAST_CODE_ENUM = CODE_TARGET_WITH_ID, 398 LAST_CODE_ENUM = CODE_TARGET,
400 LAST_GCED_ENUM = EMBEDDED_OBJECT, 399 LAST_GCED_ENUM = EMBEDDED_OBJECT,
401 FIRST_SHAREABLE_RELOC_MODE = CELL, 400 FIRST_SHAREABLE_RELOC_MODE = CELL,
402 }; 401 };
403 402
404 STATIC_ASSERT(NUMBER_OF_MODES <= kBitsPerInt); 403 STATIC_ASSERT(NUMBER_OF_MODES <= kBitsPerInt);
405 404
406 RelocInfo() = default; 405 RelocInfo() = default;
407 406
408 RelocInfo(byte* pc, Mode rmode, intptr_t data, Code* host) 407 RelocInfo(byte* pc, Mode rmode, intptr_t data, Code* host)
409 : pc_(pc), rmode_(rmode), data_(data), host_(host) {} 408 : pc_(pc), rmode_(rmode), data_(data), host_(host) {}
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 #ifdef ENABLE_DISASSEMBLER 634 #ifdef ENABLE_DISASSEMBLER
636 // Printing 635 // Printing
637 static const char* RelocModeName(Mode rmode); 636 static const char* RelocModeName(Mode rmode);
638 void Print(Isolate* isolate, std::ostream& os); // NOLINT 637 void Print(Isolate* isolate, std::ostream& os); // NOLINT
639 #endif // ENABLE_DISASSEMBLER 638 #endif // ENABLE_DISASSEMBLER
640 #ifdef VERIFY_HEAP 639 #ifdef VERIFY_HEAP
641 void Verify(Isolate* isolate); 640 void Verify(Isolate* isolate);
642 #endif 641 #endif
643 642
644 static const int kCodeTargetMask = (1 << (LAST_CODE_ENUM + 1)) - 1; 643 static const int kCodeTargetMask = (1 << (LAST_CODE_ENUM + 1)) - 1;
645 static const int kDataMask = (1 << CODE_TARGET_WITH_ID) | (1 << COMMENT);
646 static const int kDebugBreakSlotMask = 1 << DEBUG_BREAK_SLOT_AT_POSITION | 644 static const int kDebugBreakSlotMask = 1 << DEBUG_BREAK_SLOT_AT_POSITION |
647 1 << DEBUG_BREAK_SLOT_AT_RETURN | 645 1 << DEBUG_BREAK_SLOT_AT_RETURN |
648 1 << DEBUG_BREAK_SLOT_AT_CALL; 646 1 << DEBUG_BREAK_SLOT_AT_CALL;
649 static const int kApplyMask; // Modes affected by apply. Depends on arch. 647 static const int kApplyMask; // Modes affected by apply. Depends on arch.
650 648
651 private: 649 private:
652 void unchecked_update_wasm_memory_reference(Isolate* isolate, Address address, 650 void unchecked_update_wasm_memory_reference(Isolate* isolate, Address address,
653 ICacheFlushMode flush_mode); 651 ICacheFlushMode flush_mode);
654 void unchecked_update_wasm_size(Isolate* isolate, uint32_t size, 652 void unchecked_update_wasm_size(Isolate* isolate, uint32_t size,
655 ICacheFlushMode flush_mode); 653 ICacheFlushMode flush_mode);
656 654
657 // On ARM, note that pc_ is the address of the constant pool entry 655 // On ARM, note that pc_ is the address of the constant pool entry
658 // to be relocated and not the address of the instruction 656 // to be relocated and not the address of the instruction
659 // referencing the constant pool entry (except when rmode_ == 657 // referencing the constant pool entry (except when rmode_ ==
660 // comment). 658 // comment).
661 byte* pc_; 659 byte* pc_;
662 Mode rmode_; 660 Mode rmode_;
663 intptr_t data_; 661 intptr_t data_;
664 Code* host_; 662 Code* host_;
665 friend class RelocIterator; 663 friend class RelocIterator;
666 }; 664 };
667 665
668 666
669 // RelocInfoWriter serializes a stream of relocation info. It writes towards 667 // RelocInfoWriter serializes a stream of relocation info. It writes towards
670 // lower addresses. 668 // lower addresses.
671 class RelocInfoWriter BASE_EMBEDDED { 669 class RelocInfoWriter BASE_EMBEDDED {
672 public: 670 public:
673 RelocInfoWriter() : pos_(NULL), last_pc_(NULL), last_id_(0) {} 671 RelocInfoWriter() : pos_(NULL), last_pc_(NULL) {}
674 RelocInfoWriter(byte* pos, byte* pc) : pos_(pos), last_pc_(pc), last_id_(0) {} 672 RelocInfoWriter(byte* pos, byte* pc) : pos_(pos), last_pc_(pc) {}
675 673
676 byte* pos() const { return pos_; } 674 byte* pos() const { return pos_; }
677 byte* last_pc() const { return last_pc_; } 675 byte* last_pc() const { return last_pc_; }
678 676
679 void Write(const RelocInfo* rinfo); 677 void Write(const RelocInfo* rinfo);
680 678
681 // Update the state of the stream after reloc info buffer 679 // Update the state of the stream after reloc info buffer
682 // and/or code is moved while the stream is active. 680 // and/or code is moved while the stream is active.
683 void Reposition(byte* pos, byte* pc) { 681 void Reposition(byte* pos, byte* pc) {
684 pos_ = pos; 682 pos_ = pos;
685 last_pc_ = pc; 683 last_pc_ = pc;
686 } 684 }
687 685
688 // Max size (bytes) of a written RelocInfo. Longest encoding is 686 // Max size (bytes) of a written RelocInfo. Longest encoding is
689 // ExtraTag, VariableLengthPCJump, ExtraTag, pc_delta, data_delta. 687 // ExtraTag, VariableLengthPCJump, ExtraTag, pc_delta, data_delta.
690 // On ia32 and arm this is 1 + 4 + 1 + 1 + 4 = 11. 688 // On ia32 and arm this is 1 + 4 + 1 + 1 + 4 = 11.
691 // On x64 this is 1 + 4 + 1 + 1 + 8 == 15; 689 // On x64 this is 1 + 4 + 1 + 1 + 8 == 15;
692 // Here we use the maximum of the two. 690 // Here we use the maximum of the two.
693 static const int kMaxSize = 15; 691 static const int kMaxSize = 15;
694 692
695 private: 693 private:
696 inline uint32_t WriteLongPCJump(uint32_t pc_delta); 694 inline uint32_t WriteLongPCJump(uint32_t pc_delta);
697 695
698 inline void WriteShortTaggedPC(uint32_t pc_delta, int tag); 696 inline void WriteShortTaggedPC(uint32_t pc_delta, int tag);
699 inline void WriteShortTaggedData(intptr_t data_delta, int tag); 697 inline void WriteShortData(intptr_t data_delta);
700 698
701 inline void WriteMode(RelocInfo::Mode rmode); 699 inline void WriteMode(RelocInfo::Mode rmode);
702 inline void WriteModeAndPC(uint32_t pc_delta, RelocInfo::Mode rmode); 700 inline void WriteModeAndPC(uint32_t pc_delta, RelocInfo::Mode rmode);
703 inline void WriteIntData(int data_delta); 701 inline void WriteIntData(int data_delta);
704 inline void WriteData(intptr_t data_delta); 702 inline void WriteData(intptr_t data_delta);
705 703
706 byte* pos_; 704 byte* pos_;
707 byte* last_pc_; 705 byte* last_pc_;
708 int last_id_;
709 RelocInfo::Mode last_mode_; 706 RelocInfo::Mode last_mode_;
710 707
711 DISALLOW_COPY_AND_ASSIGN(RelocInfoWriter); 708 DISALLOW_COPY_AND_ASSIGN(RelocInfoWriter);
712 }; 709 };
713 710
714 711
715 // A RelocIterator iterates over relocation information. 712 // A RelocIterator iterates over relocation information.
716 // Typical use: 713 // Typical use:
717 // 714 //
718 // for (RelocIterator it(code); !it.done(); it.next()) { 715 // for (RelocIterator it(code); !it.done(); it.next()) {
(...skipping 23 matching lines...) Expand all
742 private: 739 private:
743 // Advance* moves the position before/after reading. 740 // Advance* moves the position before/after reading.
744 // *Read* reads from current byte(s) into rinfo_. 741 // *Read* reads from current byte(s) into rinfo_.
745 // *Get* just reads and returns info on current byte. 742 // *Get* just reads and returns info on current byte.
746 void Advance(int bytes = 1) { pos_ -= bytes; } 743 void Advance(int bytes = 1) { pos_ -= bytes; }
747 int AdvanceGetTag(); 744 int AdvanceGetTag();
748 RelocInfo::Mode GetMode(); 745 RelocInfo::Mode GetMode();
749 746
750 void AdvanceReadLongPCJump(); 747 void AdvanceReadLongPCJump();
751 748
752 int GetShortDataTypeTag();
753 void ReadShortTaggedPC(); 749 void ReadShortTaggedPC();
754 void ReadShortTaggedId(); 750 void ReadShortData();
755 void ReadShortTaggedData();
756 751
757 void AdvanceReadPC(); 752 void AdvanceReadPC();
758 void AdvanceReadId();
759 void AdvanceReadInt(); 753 void AdvanceReadInt();
760 void AdvanceReadData(); 754 void AdvanceReadData();
761 755
762 // If the given mode is wanted, set it in rinfo_ and return true. 756 // If the given mode is wanted, set it in rinfo_ and return true.
763 // Else return false. Used for efficiently skipping unwanted modes. 757 // Else return false. Used for efficiently skipping unwanted modes.
764 bool SetMode(RelocInfo::Mode mode) { 758 bool SetMode(RelocInfo::Mode mode) {
765 return (mode_mask_ & (1 << mode)) ? (rinfo_.rmode_ = mode, true) : false; 759 return (mode_mask_ & (1 << mode)) ? (rinfo_.rmode_ = mode, true) : false;
766 } 760 }
767 761
768 byte* pos_; 762 byte* pos_;
769 byte* end_; 763 byte* end_;
770 byte* code_age_sequence_; 764 byte* code_age_sequence_;
771 RelocInfo rinfo_; 765 RelocInfo rinfo_;
772 bool done_; 766 bool done_;
773 int mode_mask_; 767 int mode_mask_;
774 int last_id_;
775 DISALLOW_COPY_AND_ASSIGN(RelocIterator); 768 DISALLOW_COPY_AND_ASSIGN(RelocIterator);
776 }; 769 };
777 770
778 771
779 //------------------------------------------------------------------------------ 772 //------------------------------------------------------------------------------
780 // External function 773 // External function
781 774
782 //---------------------------------------------------------------------------- 775 //----------------------------------------------------------------------------
783 class SCTableReference; 776 class SCTableReference;
784 class Debug_Address; 777 class Debug_Address;
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 std::vector<ConstantPoolEntry> shared_entries; 1283 std::vector<ConstantPoolEntry> shared_entries;
1291 }; 1284 };
1292 1285
1293 Label emitted_label_; // Records pc_offset of emitted pool 1286 Label emitted_label_; // Records pc_offset of emitted pool
1294 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; 1287 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES];
1295 }; 1288 };
1296 1289
1297 } // namespace internal 1290 } // namespace internal
1298 } // namespace v8 1291 } // namespace v8
1299 #endif // V8_ASSEMBLER_H_ 1292 #endif // V8_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/arm64/assembler-arm64.cc ('k') | src/assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698