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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 void RelocInfoWriter::WriteShortTaggedData(intptr_t data_delta, int tag) { | 408 void RelocInfoWriter::WriteShortTaggedData(intptr_t data_delta, int tag) { |
409 *--pos_ = static_cast<byte>(data_delta << kShortDataTypeTagBits | tag); | 409 *--pos_ = static_cast<byte>(data_delta << kShortDataTypeTagBits | tag); |
410 } | 410 } |
411 | 411 |
412 | 412 |
413 void RelocInfoWriter::WriteMode(RelocInfo::Mode rmode) { | 413 void RelocInfoWriter::WriteMode(RelocInfo::Mode rmode) { |
414 STATIC_ASSERT(RelocInfo::NUMBER_OF_MODES <= (1 << kLongTagBits)); | 414 STATIC_ASSERT(RelocInfo::NUMBER_OF_MODES <= (1 << kLongTagBits)); |
415 *--pos_ = static_cast<int>((rmode << kTagBits) | kDefaultTag); | 415 *--pos_ = static_cast<int>((rmode << kTagBits) | kDefaultTag); |
416 } | 416 } |
417 | 417 |
| 418 void RelocInfoWriter::WriteModeNoAdvance(RelocInfo::Mode rmode) { |
| 419 STATIC_ASSERT(RelocInfo::NUMBER_OF_MODES <= (1 << kLongTagBits)); |
| 420 *pos_ = static_cast<int>((rmode << kTagBits) | kDefaultTag); |
| 421 } |
418 | 422 |
419 void RelocInfoWriter::WriteModeAndPC(uint32_t pc_delta, RelocInfo::Mode rmode) { | 423 void RelocInfoWriter::WriteModeAndPC(uint32_t pc_delta, RelocInfo::Mode rmode) { |
420 // Write two-byte tagged pc-delta, possibly preceded by var. length pc-jump. | 424 // Write two-byte tagged pc-delta, possibly preceded by var. length pc-jump. |
421 pc_delta = WriteLongPCJump(pc_delta); | 425 pc_delta = WriteLongPCJump(pc_delta); |
422 WriteMode(rmode); | 426 WriteMode(rmode); |
423 *--pos_ = pc_delta; | 427 *--pos_ = pc_delta; |
424 } | 428 } |
425 | 429 |
426 | 430 |
427 void RelocInfoWriter::WriteIntData(int number) { | 431 void RelocInfoWriter::WriteIntData(int number) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 #endif | 545 #endif |
542 } | 546 } |
543 | 547 |
544 | 548 |
545 inline int RelocIterator::AdvanceGetTag() { | 549 inline int RelocIterator::AdvanceGetTag() { |
546 return *--pos_ & kTagMask; | 550 return *--pos_ & kTagMask; |
547 } | 551 } |
548 | 552 |
549 | 553 |
550 inline RelocInfo::Mode RelocIterator::GetMode() { | 554 inline RelocInfo::Mode RelocIterator::GetMode() { |
| 555 mode_pos_ = pos_; |
551 return static_cast<RelocInfo::Mode>((*pos_ >> kTagBits) & | 556 return static_cast<RelocInfo::Mode>((*pos_ >> kTagBits) & |
552 ((1 << kLongTagBits) - 1)); | 557 ((1 << kLongTagBits) - 1)); |
553 } | 558 } |
554 | 559 |
555 | 560 |
556 inline void RelocIterator::ReadShortTaggedPC() { | 561 inline void RelocIterator::ReadShortTaggedPC() { |
557 rinfo_.pc_ += *pos_ >> kTagBits; | 562 rinfo_.pc_ += *pos_ >> kTagBits; |
558 } | 563 } |
559 | 564 |
560 | 565 |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 } | 752 } |
748 | 753 |
749 | 754 |
750 RelocIterator::RelocIterator(Code* code, int mode_mask) | 755 RelocIterator::RelocIterator(Code* code, int mode_mask) |
751 : rinfo_(code->map()->GetIsolate()) { | 756 : rinfo_(code->map()->GetIsolate()) { |
752 rinfo_.host_ = code; | 757 rinfo_.host_ = code; |
753 rinfo_.pc_ = code->instruction_start(); | 758 rinfo_.pc_ = code->instruction_start(); |
754 rinfo_.data_ = 0; | 759 rinfo_.data_ = 0; |
755 // Relocation info is read backwards. | 760 // Relocation info is read backwards. |
756 pos_ = code->relocation_start() + code->relocation_size(); | 761 pos_ = code->relocation_start() + code->relocation_size(); |
| 762 mode_pos_ = nullptr; |
757 end_ = code->relocation_start(); | 763 end_ = code->relocation_start(); |
758 done_ = false; | 764 done_ = false; |
759 mode_mask_ = mode_mask; | 765 mode_mask_ = mode_mask; |
760 last_id_ = 0; | 766 last_id_ = 0; |
761 last_position_ = 0; | 767 last_position_ = 0; |
762 byte* sequence = code->FindCodeAgeSequence(); | 768 byte* sequence = code->FindCodeAgeSequence(); |
763 // We get the isolate from the map, because at serialization time | 769 // We get the isolate from the map, because at serialization time |
764 // the code pointer has been cloned and isn't really in heap space. | 770 // the code pointer has been cloned and isn't really in heap space. |
765 Isolate* isolate = code->map()->GetIsolate(); | 771 Isolate* isolate = code->map()->GetIsolate(); |
766 if (sequence != NULL && !Code::IsYoungSequence(isolate, sequence)) { | 772 if (sequence != NULL && !Code::IsYoungSequence(isolate, sequence)) { |
767 code_age_sequence_ = sequence; | 773 code_age_sequence_ = sequence; |
768 } else { | 774 } else { |
769 code_age_sequence_ = NULL; | 775 code_age_sequence_ = NULL; |
770 } | 776 } |
771 if (mode_mask_ == 0) pos_ = end_; | 777 if (mode_mask_ == 0) pos_ = end_; |
772 next(); | 778 next(); |
773 } | 779 } |
774 | 780 |
775 | 781 |
776 RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) | 782 RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) |
777 : rinfo_(desc.origin->isolate()) { | 783 : rinfo_(desc.origin->isolate()) { |
778 rinfo_.pc_ = desc.buffer; | 784 rinfo_.pc_ = desc.buffer; |
779 rinfo_.data_ = 0; | 785 rinfo_.data_ = 0; |
780 // Relocation info is read backwards. | 786 // Relocation info is read backwards. |
781 pos_ = desc.buffer + desc.buffer_size; | 787 pos_ = desc.buffer + desc.buffer_size; |
| 788 mode_pos_ = nullptr; |
782 end_ = pos_ - desc.reloc_size; | 789 end_ = pos_ - desc.reloc_size; |
783 done_ = false; | 790 done_ = false; |
784 mode_mask_ = mode_mask; | 791 mode_mask_ = mode_mask; |
785 last_id_ = 0; | 792 last_id_ = 0; |
786 last_position_ = 0; | 793 last_position_ = 0; |
787 code_age_sequence_ = NULL; | 794 code_age_sequence_ = NULL; |
788 if (mode_mask_ == 0) pos_ = end_; | 795 if (mode_mask_ == 0) pos_ = end_; |
789 next(); | 796 next(); |
790 } | 797 } |
791 | 798 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 case DEBUG_BREAK_SLOT_AT_TAIL_CALL: | 867 case DEBUG_BREAK_SLOT_AT_TAIL_CALL: |
861 return "debug break slot at tail call"; | 868 return "debug break slot at tail call"; |
862 case CODE_AGE_SEQUENCE: | 869 case CODE_AGE_SEQUENCE: |
863 return "code age sequence"; | 870 return "code age sequence"; |
864 case GENERATOR_CONTINUATION: | 871 case GENERATOR_CONTINUATION: |
865 return "generator continuation"; | 872 return "generator continuation"; |
866 case WASM_MEMORY_REFERENCE: | 873 case WASM_MEMORY_REFERENCE: |
867 return "wasm memory reference"; | 874 return "wasm memory reference"; |
868 case WASM_MEMORY_SIZE_REFERENCE: | 875 case WASM_MEMORY_SIZE_REFERENCE: |
869 return "wasm memory size reference"; | 876 return "wasm memory size reference"; |
| 877 case WASM_DIRECT_CALL: |
| 878 return "wasm direct call"; |
| 879 case WASM_IMPORT_CALL: |
| 880 return "wasm import call"; |
870 case NUMBER_OF_MODES: | 881 case NUMBER_OF_MODES: |
871 case PC_JUMP: | 882 case PC_JUMP: |
872 UNREACHABLE(); | 883 UNREACHABLE(); |
873 return "number_of_modes"; | 884 return "number_of_modes"; |
874 } | 885 } |
875 return "unknown relocation type"; | 886 return "unknown relocation type"; |
876 } | 887 } |
877 | 888 |
878 | 889 |
879 void RelocInfo::Print(Isolate* isolate, std::ostream& os) { // NOLINT | 890 void RelocInfo::Print(Isolate* isolate, std::ostream& os) { // NOLINT |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 case VENEER_POOL: | 970 case VENEER_POOL: |
960 case DEBUG_BREAK_SLOT_AT_POSITION: | 971 case DEBUG_BREAK_SLOT_AT_POSITION: |
961 case DEBUG_BREAK_SLOT_AT_RETURN: | 972 case DEBUG_BREAK_SLOT_AT_RETURN: |
962 case DEBUG_BREAK_SLOT_AT_CALL: | 973 case DEBUG_BREAK_SLOT_AT_CALL: |
963 case DEBUG_BREAK_SLOT_AT_TAIL_CALL: | 974 case DEBUG_BREAK_SLOT_AT_TAIL_CALL: |
964 case GENERATOR_CONTINUATION: | 975 case GENERATOR_CONTINUATION: |
965 case WASM_MEMORY_REFERENCE: | 976 case WASM_MEMORY_REFERENCE: |
966 case WASM_MEMORY_SIZE_REFERENCE: | 977 case WASM_MEMORY_SIZE_REFERENCE: |
967 case NONE32: | 978 case NONE32: |
968 case NONE64: | 979 case NONE64: |
| 980 case WASM_DIRECT_CALL: |
| 981 case WASM_IMPORT_CALL: |
969 break; | 982 break; |
970 case NUMBER_OF_MODES: | 983 case NUMBER_OF_MODES: |
971 case PC_JUMP: | 984 case PC_JUMP: |
972 UNREACHABLE(); | 985 UNREACHABLE(); |
973 break; | 986 break; |
974 case CODE_AGE_SEQUENCE: | 987 case CODE_AGE_SEQUENCE: |
975 DCHECK(Code::IsYoungSequence(isolate, pc_) || code_age_stub()->IsCode()); | 988 DCHECK(Code::IsYoungSequence(isolate, pc_) || code_age_stub()->IsCode()); |
976 break; | 989 break; |
977 } | 990 } |
978 } | 991 } |
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 | 2130 |
2118 | 2131 |
2119 void Assembler::DataAlign(int m) { | 2132 void Assembler::DataAlign(int m) { |
2120 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); | 2133 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); |
2121 while ((pc_offset() & (m - 1)) != 0) { | 2134 while ((pc_offset() & (m - 1)) != 0) { |
2122 db(0); | 2135 db(0); |
2123 } | 2136 } |
2124 } | 2137 } |
2125 } // namespace internal | 2138 } // namespace internal |
2126 } // namespace v8 | 2139 } // namespace v8 |
OLD | NEW |