| 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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 | 654 |
| 655 | 655 |
| 656 void Assembler::deserialization_set_special_target_at( | 656 void Assembler::deserialization_set_special_target_at( |
| 657 Address constant_pool_entry, Code* code, Address target) { | 657 Address constant_pool_entry, Code* code, Address target) { |
| 658 Memory::Address_at(constant_pool_entry) = target; | 658 Memory::Address_at(constant_pool_entry) = target; |
| 659 } | 659 } |
| 660 | 660 |
| 661 | 661 |
| 662 void Assembler::deserialization_set_target_internal_reference_at( | 662 void Assembler::deserialization_set_target_internal_reference_at( |
| 663 Address pc, Address target) { | 663 Address pc, Address target) { |
| 664 UNIMPLEMENTED(); // ARM64 does not use internal references. | 664 Memory::Address_at(pc) = target; |
| 665 } | 665 } |
| 666 | 666 |
| 667 | 667 |
| 668 void Assembler::set_target_address_at(Address pc, | 668 void Assembler::set_target_address_at(Address pc, |
| 669 ConstantPoolArray* constant_pool, | 669 ConstantPoolArray* constant_pool, |
| 670 Address target, | 670 Address target, |
| 671 ICacheFlushMode icache_flush_mode) { | 671 ICacheFlushMode icache_flush_mode) { |
| 672 Memory::Address_at(target_pointer_address_at(pc)) = target; | 672 Memory::Address_at(target_pointer_address_at(pc)) = target; |
| 673 // Intuitively, we would think it is necessary to always flush the | 673 // Intuitively, we would think it is necessary to always flush the |
| 674 // instruction cache after patching a target address in the code as follows: | 674 // instruction cache after patching a target address in the code as follows: |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 | 745 |
| 746 | 746 |
| 747 Address RelocInfo::target_external_reference() { | 747 Address RelocInfo::target_external_reference() { |
| 748 DCHECK(rmode_ == EXTERNAL_REFERENCE); | 748 DCHECK(rmode_ == EXTERNAL_REFERENCE); |
| 749 return Assembler::target_address_at(pc_, host_); | 749 return Assembler::target_address_at(pc_, host_); |
| 750 } | 750 } |
| 751 | 751 |
| 752 | 752 |
| 753 Address RelocInfo::target_internal_reference() { | 753 Address RelocInfo::target_internal_reference() { |
| 754 DCHECK(rmode_ == INTERNAL_REFERENCE); | 754 DCHECK(rmode_ == INTERNAL_REFERENCE); |
| 755 UNIMPLEMENTED(); // ARM64 does not use internal references. | 755 return Memory::Address_at(pc_); |
| 756 return NULL; | |
| 757 } | 756 } |
| 758 | 757 |
| 759 | 758 |
| 760 Address RelocInfo::target_internal_reference_address() { | 759 Address RelocInfo::target_internal_reference_address() { |
| 761 DCHECK(rmode_ == INTERNAL_REFERENCE); | 760 DCHECK(rmode_ == INTERNAL_REFERENCE); |
| 762 UNIMPLEMENTED(); // ARM64 does not use internal references. | 761 return reinterpret_cast<Address>(pc_); |
| 763 return NULL; | |
| 764 } | 762 } |
| 765 | 763 |
| 766 | 764 |
| 767 Address RelocInfo::target_runtime_entry(Assembler* origin) { | 765 Address RelocInfo::target_runtime_entry(Assembler* origin) { |
| 768 DCHECK(IsRuntimeEntry(rmode_)); | 766 DCHECK(IsRuntimeEntry(rmode_)); |
| 769 return target_address(); | 767 return target_address(); |
| 770 } | 768 } |
| 771 | 769 |
| 772 | 770 |
| 773 void RelocInfo::set_target_runtime_entry(Address target, | 771 void RelocInfo::set_target_runtime_entry(Address target, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 host(), this, HeapObject::cast(target_code)); | 846 host(), this, HeapObject::cast(target_code)); |
| 849 } | 847 } |
| 850 } | 848 } |
| 851 | 849 |
| 852 | 850 |
| 853 void RelocInfo::WipeOut() { | 851 void RelocInfo::WipeOut() { |
| 854 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || | 852 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || |
| 855 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || | 853 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || |
| 856 IsInternalReference(rmode_)); | 854 IsInternalReference(rmode_)); |
| 857 if (IsInternalReference(rmode_)) { | 855 if (IsInternalReference(rmode_)) { |
| 858 UNIMPLEMENTED(); // ARM64 does not use internal references. | 856 Memory::Address_at(pc_) = NULL; |
| 859 } else { | 857 } else { |
| 860 Assembler::set_target_address_at(pc_, host_, NULL); | 858 Assembler::set_target_address_at(pc_, host_, NULL); |
| 861 } | 859 } |
| 862 } | 860 } |
| 863 | 861 |
| 864 | 862 |
| 865 bool RelocInfo::IsPatchedReturnSequence() { | 863 bool RelocInfo::IsPatchedReturnSequence() { |
| 866 // The sequence must be: | 864 // The sequence must be: |
| 867 // ldr ip0, [pc, #offset] | 865 // ldr ip0, [pc, #offset] |
| 868 // blr ip0 | 866 // blr ip0 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 884 RelocInfo::Mode mode = rmode(); | 882 RelocInfo::Mode mode = rmode(); |
| 885 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 883 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 886 visitor->VisitEmbeddedPointer(this); | 884 visitor->VisitEmbeddedPointer(this); |
| 887 } else if (RelocInfo::IsCodeTarget(mode)) { | 885 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 888 visitor->VisitCodeTarget(this); | 886 visitor->VisitCodeTarget(this); |
| 889 } else if (mode == RelocInfo::CELL) { | 887 } else if (mode == RelocInfo::CELL) { |
| 890 visitor->VisitCell(this); | 888 visitor->VisitCell(this); |
| 891 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 889 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
| 892 visitor->VisitExternalReference(this); | 890 visitor->VisitExternalReference(this); |
| 893 } else if (mode == RelocInfo::INTERNAL_REFERENCE) { | 891 } else if (mode == RelocInfo::INTERNAL_REFERENCE) { |
| 894 UNIMPLEMENTED(); // ARM64 does not use internal references. | 892 visitor->VisitInternalReference(this); |
| 895 } else if (((RelocInfo::IsJSReturn(mode) && | 893 } else if (((RelocInfo::IsJSReturn(mode) && |
| 896 IsPatchedReturnSequence()) || | 894 IsPatchedReturnSequence()) || |
| 897 (RelocInfo::IsDebugBreakSlot(mode) && | 895 (RelocInfo::IsDebugBreakSlot(mode) && |
| 898 IsPatchedDebugBreakSlotSequence())) && | 896 IsPatchedDebugBreakSlotSequence())) && |
| 899 isolate->debug()->has_break_points()) { | 897 isolate->debug()->has_break_points()) { |
| 900 visitor->VisitDebugTarget(this); | 898 visitor->VisitDebugTarget(this); |
| 901 } else if (RelocInfo::IsRuntimeEntry(mode)) { | 899 } else if (RelocInfo::IsRuntimeEntry(mode)) { |
| 902 visitor->VisitRuntimeEntry(this); | 900 visitor->VisitRuntimeEntry(this); |
| 903 } | 901 } |
| 904 } | 902 } |
| 905 | 903 |
| 906 | 904 |
| 907 template<typename StaticVisitor> | 905 template<typename StaticVisitor> |
| 908 void RelocInfo::Visit(Heap* heap) { | 906 void RelocInfo::Visit(Heap* heap) { |
| 909 RelocInfo::Mode mode = rmode(); | 907 RelocInfo::Mode mode = rmode(); |
| 910 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 908 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 911 StaticVisitor::VisitEmbeddedPointer(heap, this); | 909 StaticVisitor::VisitEmbeddedPointer(heap, this); |
| 912 } else if (RelocInfo::IsCodeTarget(mode)) { | 910 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 913 StaticVisitor::VisitCodeTarget(heap, this); | 911 StaticVisitor::VisitCodeTarget(heap, this); |
| 914 } else if (mode == RelocInfo::CELL) { | 912 } else if (mode == RelocInfo::CELL) { |
| 915 StaticVisitor::VisitCell(heap, this); | 913 StaticVisitor::VisitCell(heap, this); |
| 916 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 914 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
| 917 StaticVisitor::VisitExternalReference(this); | 915 StaticVisitor::VisitExternalReference(this); |
| 918 } else if (mode == RelocInfo::INTERNAL_REFERENCE) { | 916 } else if (mode == RelocInfo::INTERNAL_REFERENCE) { |
| 919 UNIMPLEMENTED(); // ARM64 does not use internal references. | 917 StaticVisitor::VisitInternalReference(this); |
| 920 } else if (heap->isolate()->debug()->has_break_points() && | 918 } else if (heap->isolate()->debug()->has_break_points() && |
| 921 ((RelocInfo::IsJSReturn(mode) && | 919 ((RelocInfo::IsJSReturn(mode) && |
| 922 IsPatchedReturnSequence()) || | 920 IsPatchedReturnSequence()) || |
| 923 (RelocInfo::IsDebugBreakSlot(mode) && | 921 (RelocInfo::IsDebugBreakSlot(mode) && |
| 924 IsPatchedDebugBreakSlotSequence()))) { | 922 IsPatchedDebugBreakSlotSequence()))) { |
| 925 StaticVisitor::VisitDebugTarget(heap, this); | 923 StaticVisitor::VisitDebugTarget(heap, this); |
| 926 } else if (RelocInfo::IsRuntimeEntry(mode)) { | 924 } else if (RelocInfo::IsRuntimeEntry(mode)) { |
| 927 StaticVisitor::VisitRuntimeEntry(this); | 925 StaticVisitor::VisitRuntimeEntry(this); |
| 928 } | 926 } |
| 929 } | 927 } |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 | 1293 |
| 1296 | 1294 |
| 1297 void Assembler::ClearRecordedAstId() { | 1295 void Assembler::ClearRecordedAstId() { |
| 1298 recorded_ast_id_ = TypeFeedbackId::None(); | 1296 recorded_ast_id_ = TypeFeedbackId::None(); |
| 1299 } | 1297 } |
| 1300 | 1298 |
| 1301 | 1299 |
| 1302 } } // namespace v8::internal | 1300 } } // namespace v8::internal |
| 1303 | 1301 |
| 1304 #endif // V8_ARM64_ASSEMBLER_ARM64_INL_H_ | 1302 #endif // V8_ARM64_ASSEMBLER_ARM64_INL_H_ |
| OLD | NEW |