OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_ARM64_ASSEMBLER_ARM64_INL_H_ | 5 #ifndef V8_ARM64_ASSEMBLER_ARM64_INL_H_ |
6 #define V8_ARM64_ASSEMBLER_ARM64_INL_H_ | 6 #define V8_ARM64_ASSEMBLER_ARM64_INL_H_ |
7 | 7 |
8 #include "src/arm64/assembler-arm64.h" | 8 #include "src/arm64/assembler-arm64.h" |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/debug.h" | 10 #include "src/debug.h" |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 } | 647 } |
648 } | 648 } |
649 | 649 |
650 | 650 |
651 void Assembler::deserialization_set_special_target_at( | 651 void Assembler::deserialization_set_special_target_at( |
652 Address constant_pool_entry, Code* code, Address target) { | 652 Address constant_pool_entry, Code* code, Address target) { |
653 Memory::Address_at(constant_pool_entry) = target; | 653 Memory::Address_at(constant_pool_entry) = target; |
654 } | 654 } |
655 | 655 |
656 | 656 |
| 657 void Assembler::deserialization_set_target_internal_reference_at( |
| 658 Address pc, Address target) { |
| 659 UNIMPLEMENTED(); // ARM64 does not use internal references. |
| 660 } |
| 661 |
| 662 |
657 void Assembler::set_target_address_at(Address pc, | 663 void Assembler::set_target_address_at(Address pc, |
658 ConstantPoolArray* constant_pool, | 664 ConstantPoolArray* constant_pool, |
659 Address target, | 665 Address target, |
660 ICacheFlushMode icache_flush_mode) { | 666 ICacheFlushMode icache_flush_mode) { |
661 Memory::Address_at(target_pointer_address_at(pc)) = target; | 667 Memory::Address_at(target_pointer_address_at(pc)) = target; |
662 // Intuitively, we would think it is necessary to always flush the | 668 // Intuitively, we would think it is necessary to always flush the |
663 // instruction cache after patching a target address in the code as follows: | 669 // instruction cache after patching a target address in the code as follows: |
664 // CpuFeatures::FlushICache(pc, sizeof(target)); | 670 // CpuFeatures::FlushICache(pc, sizeof(target)); |
665 // However, on ARM, an instruction is actually patched in the case of | 671 // However, on ARM, an instruction is actually patched in the case of |
666 // embedded constants of the form: | 672 // embedded constants of the form: |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 | 740 |
735 | 741 |
736 Address RelocInfo::target_external_reference() { | 742 Address RelocInfo::target_external_reference() { |
737 DCHECK(rmode_ == EXTERNAL_REFERENCE); | 743 DCHECK(rmode_ == EXTERNAL_REFERENCE); |
738 return Assembler::target_address_at(pc_, host_); | 744 return Assembler::target_address_at(pc_, host_); |
739 } | 745 } |
740 | 746 |
741 | 747 |
742 Address RelocInfo::target_internal_reference() { | 748 Address RelocInfo::target_internal_reference() { |
743 DCHECK(rmode_ == INTERNAL_REFERENCE); | 749 DCHECK(rmode_ == INTERNAL_REFERENCE); |
744 return Memory::Address_at(pc_); | 750 UNIMPLEMENTED(); // ARM64 does not use internal references. |
| 751 return NULL; |
745 } | 752 } |
746 | 753 |
747 | 754 |
748 void RelocInfo::set_target_internal_reference(Address target) { | 755 Address RelocInfo::target_internal_reference_address() { |
749 DCHECK(rmode_ == INTERNAL_REFERENCE); | 756 DCHECK(rmode_ == INTERNAL_REFERENCE); |
750 Memory::Address_at(pc_) = target; | 757 UNIMPLEMENTED(); // ARM64 does not use internal references. |
| 758 return NULL; |
751 } | 759 } |
752 | 760 |
753 | 761 |
754 Address RelocInfo::target_runtime_entry(Assembler* origin) { | 762 Address RelocInfo::target_runtime_entry(Assembler* origin) { |
755 DCHECK(IsRuntimeEntry(rmode_)); | 763 DCHECK(IsRuntimeEntry(rmode_)); |
756 return target_address(); | 764 return target_address(); |
757 } | 765 } |
758 | 766 |
759 | 767 |
760 void RelocInfo::set_target_runtime_entry(Address target, | 768 void RelocInfo::set_target_runtime_entry(Address target, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 Assembler::set_target_address_at(pc_, host_, target); | 839 Assembler::set_target_address_at(pc_, host_, target); |
832 if (host() != NULL) { | 840 if (host() != NULL) { |
833 Object* target_code = Code::GetCodeFromTargetAddress(target); | 841 Object* target_code = Code::GetCodeFromTargetAddress(target); |
834 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 842 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
835 host(), this, HeapObject::cast(target_code)); | 843 host(), this, HeapObject::cast(target_code)); |
836 } | 844 } |
837 } | 845 } |
838 | 846 |
839 | 847 |
840 void RelocInfo::WipeOut() { | 848 void RelocInfo::WipeOut() { |
841 DCHECK(IsEmbeddedObject(rmode_) || | 849 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || |
842 IsCodeTarget(rmode_) || | 850 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || |
843 IsRuntimeEntry(rmode_) || | 851 IsInternalReference(rmode_)); |
844 IsExternalReference(rmode_)); | 852 if (IsInternalReference(rmode_)) { |
845 Assembler::set_target_address_at(pc_, host_, NULL); | 853 UNIMPLEMENTED(); // ARM64 does not use internal references. |
| 854 } else { |
| 855 Assembler::set_target_address_at(pc_, host_, NULL); |
| 856 } |
846 } | 857 } |
847 | 858 |
848 | 859 |
849 bool RelocInfo::IsPatchedReturnSequence() { | 860 bool RelocInfo::IsPatchedReturnSequence() { |
850 // The sequence must be: | 861 // The sequence must be: |
851 // ldr ip0, [pc, #offset] | 862 // ldr ip0, [pc, #offset] |
852 // blr ip0 | 863 // blr ip0 |
853 // See arm64/debug-arm64.cc BreakLocation::SetDebugBreakAtReturn(). | 864 // See arm64/debug-arm64.cc BreakLocation::SetDebugBreakAtReturn(). |
854 Instruction* i1 = reinterpret_cast<Instruction*>(pc_); | 865 Instruction* i1 = reinterpret_cast<Instruction*>(pc_); |
855 Instruction* i2 = i1->following(); | 866 Instruction* i2 = i1->following(); |
(...skipping 11 matching lines...) Expand all Loading... |
867 void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) { | 878 void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) { |
868 RelocInfo::Mode mode = rmode(); | 879 RelocInfo::Mode mode = rmode(); |
869 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 880 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
870 visitor->VisitEmbeddedPointer(this); | 881 visitor->VisitEmbeddedPointer(this); |
871 } else if (RelocInfo::IsCodeTarget(mode)) { | 882 } else if (RelocInfo::IsCodeTarget(mode)) { |
872 visitor->VisitCodeTarget(this); | 883 visitor->VisitCodeTarget(this); |
873 } else if (mode == RelocInfo::CELL) { | 884 } else if (mode == RelocInfo::CELL) { |
874 visitor->VisitCell(this); | 885 visitor->VisitCell(this); |
875 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 886 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
876 visitor->VisitExternalReference(this); | 887 visitor->VisitExternalReference(this); |
| 888 } else if (mode == RelocInfo::INTERNAL_REFERENCE) { |
| 889 UNIMPLEMENTED(); // ARM64 does not use internal references. |
877 } else if (((RelocInfo::IsJSReturn(mode) && | 890 } else if (((RelocInfo::IsJSReturn(mode) && |
878 IsPatchedReturnSequence()) || | 891 IsPatchedReturnSequence()) || |
879 (RelocInfo::IsDebugBreakSlot(mode) && | 892 (RelocInfo::IsDebugBreakSlot(mode) && |
880 IsPatchedDebugBreakSlotSequence())) && | 893 IsPatchedDebugBreakSlotSequence())) && |
881 isolate->debug()->has_break_points()) { | 894 isolate->debug()->has_break_points()) { |
882 visitor->VisitDebugTarget(this); | 895 visitor->VisitDebugTarget(this); |
883 } else if (RelocInfo::IsRuntimeEntry(mode)) { | 896 } else if (RelocInfo::IsRuntimeEntry(mode)) { |
884 visitor->VisitRuntimeEntry(this); | 897 visitor->VisitRuntimeEntry(this); |
885 } | 898 } |
886 } | 899 } |
887 | 900 |
888 | 901 |
889 template<typename StaticVisitor> | 902 template<typename StaticVisitor> |
890 void RelocInfo::Visit(Heap* heap) { | 903 void RelocInfo::Visit(Heap* heap) { |
891 RelocInfo::Mode mode = rmode(); | 904 RelocInfo::Mode mode = rmode(); |
892 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 905 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
893 StaticVisitor::VisitEmbeddedPointer(heap, this); | 906 StaticVisitor::VisitEmbeddedPointer(heap, this); |
894 } else if (RelocInfo::IsCodeTarget(mode)) { | 907 } else if (RelocInfo::IsCodeTarget(mode)) { |
895 StaticVisitor::VisitCodeTarget(heap, this); | 908 StaticVisitor::VisitCodeTarget(heap, this); |
896 } else if (mode == RelocInfo::CELL) { | 909 } else if (mode == RelocInfo::CELL) { |
897 StaticVisitor::VisitCell(heap, this); | 910 StaticVisitor::VisitCell(heap, this); |
898 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 911 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
899 StaticVisitor::VisitExternalReference(this); | 912 StaticVisitor::VisitExternalReference(this); |
| 913 } else if (mode == RelocInfo::INTERNAL_REFERENCE) { |
| 914 UNIMPLEMENTED(); // ARM64 does not use internal references. |
900 } else if (heap->isolate()->debug()->has_break_points() && | 915 } else if (heap->isolate()->debug()->has_break_points() && |
901 ((RelocInfo::IsJSReturn(mode) && | 916 ((RelocInfo::IsJSReturn(mode) && |
902 IsPatchedReturnSequence()) || | 917 IsPatchedReturnSequence()) || |
903 (RelocInfo::IsDebugBreakSlot(mode) && | 918 (RelocInfo::IsDebugBreakSlot(mode) && |
904 IsPatchedDebugBreakSlotSequence()))) { | 919 IsPatchedDebugBreakSlotSequence()))) { |
905 StaticVisitor::VisitDebugTarget(heap, this); | 920 StaticVisitor::VisitDebugTarget(heap, this); |
906 } else if (RelocInfo::IsRuntimeEntry(mode)) { | 921 } else if (RelocInfo::IsRuntimeEntry(mode)) { |
907 StaticVisitor::VisitRuntimeEntry(this); | 922 StaticVisitor::VisitRuntimeEntry(this); |
908 } | 923 } |
909 } | 924 } |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 | 1290 |
1276 | 1291 |
1277 void Assembler::ClearRecordedAstId() { | 1292 void Assembler::ClearRecordedAstId() { |
1278 recorded_ast_id_ = TypeFeedbackId::None(); | 1293 recorded_ast_id_ = TypeFeedbackId::None(); |
1279 } | 1294 } |
1280 | 1295 |
1281 | 1296 |
1282 } } // namespace v8::internal | 1297 } } // namespace v8::internal |
1283 | 1298 |
1284 #endif // V8_ARM64_ASSEMBLER_ARM64_INL_H_ | 1299 #endif // V8_ARM64_ASSEMBLER_ARM64_INL_H_ |
OLD | NEW |