| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include "src/x64/assembler-x64.h" | 5 #include "src/x64/assembler-x64.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_X64 | 9 #if V8_TARGET_ARCH_X64 |
| 10 | 10 |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 void Assembler::bsfq(Register dst, const Operand& src) { | 859 void Assembler::bsfq(Register dst, const Operand& src) { |
| 860 EnsureSpace ensure_space(this); | 860 EnsureSpace ensure_space(this); |
| 861 emit_rex_64(dst, src); | 861 emit_rex_64(dst, src); |
| 862 emit(0x0F); | 862 emit(0x0F); |
| 863 emit(0xBC); | 863 emit(0xBC); |
| 864 emit_operand(dst, src); | 864 emit_operand(dst, src); |
| 865 } | 865 } |
| 866 | 866 |
| 867 | 867 |
| 868 void Assembler::call(Label* L) { | 868 void Assembler::call(Label* L) { |
| 869 positions_recorder()->WriteRecordedPositions(); | |
| 870 EnsureSpace ensure_space(this); | 869 EnsureSpace ensure_space(this); |
| 871 // 1110 1000 #32-bit disp. | 870 // 1110 1000 #32-bit disp. |
| 872 emit(0xE8); | 871 emit(0xE8); |
| 873 if (L->is_bound()) { | 872 if (L->is_bound()) { |
| 874 int offset = L->pos() - pc_offset() - sizeof(int32_t); | 873 int offset = L->pos() - pc_offset() - sizeof(int32_t); |
| 875 DCHECK(offset <= 0); | 874 DCHECK(offset <= 0); |
| 876 emitl(offset); | 875 emitl(offset); |
| 877 } else if (L->is_linked()) { | 876 } else if (L->is_linked()) { |
| 878 emitl(L->pos()); | 877 emitl(L->pos()); |
| 879 L->link_to(pc_offset() - sizeof(int32_t)); | 878 L->link_to(pc_offset() - sizeof(int32_t)); |
| 880 } else { | 879 } else { |
| 881 DCHECK(L->is_unused()); | 880 DCHECK(L->is_unused()); |
| 882 int32_t current = pc_offset(); | 881 int32_t current = pc_offset(); |
| 883 emitl(current); | 882 emitl(current); |
| 884 L->link_to(current); | 883 L->link_to(current); |
| 885 } | 884 } |
| 886 } | 885 } |
| 887 | 886 |
| 888 | 887 |
| 889 void Assembler::call(Address entry, RelocInfo::Mode rmode) { | 888 void Assembler::call(Address entry, RelocInfo::Mode rmode) { |
| 890 DCHECK(RelocInfo::IsRuntimeEntry(rmode)); | 889 DCHECK(RelocInfo::IsRuntimeEntry(rmode)); |
| 891 positions_recorder()->WriteRecordedPositions(); | |
| 892 EnsureSpace ensure_space(this); | 890 EnsureSpace ensure_space(this); |
| 893 // 1110 1000 #32-bit disp. | 891 // 1110 1000 #32-bit disp. |
| 894 emit(0xE8); | 892 emit(0xE8); |
| 895 emit_runtime_entry(entry, rmode); | 893 emit_runtime_entry(entry, rmode); |
| 896 } | 894 } |
| 897 | 895 |
| 898 | 896 |
| 899 void Assembler::call(Handle<Code> target, | 897 void Assembler::call(Handle<Code> target, |
| 900 RelocInfo::Mode rmode, | 898 RelocInfo::Mode rmode, |
| 901 TypeFeedbackId ast_id) { | 899 TypeFeedbackId ast_id) { |
| 902 positions_recorder()->WriteRecordedPositions(); | |
| 903 EnsureSpace ensure_space(this); | 900 EnsureSpace ensure_space(this); |
| 904 // 1110 1000 #32-bit disp. | 901 // 1110 1000 #32-bit disp. |
| 905 emit(0xE8); | 902 emit(0xE8); |
| 906 emit_code_target(target, rmode, ast_id); | 903 emit_code_target(target, rmode, ast_id); |
| 907 } | 904 } |
| 908 | 905 |
| 909 | 906 |
| 910 void Assembler::call(Register adr) { | 907 void Assembler::call(Register adr) { |
| 911 positions_recorder()->WriteRecordedPositions(); | |
| 912 EnsureSpace ensure_space(this); | 908 EnsureSpace ensure_space(this); |
| 913 // Opcode: FF /2 r64. | 909 // Opcode: FF /2 r64. |
| 914 emit_optional_rex_32(adr); | 910 emit_optional_rex_32(adr); |
| 915 emit(0xFF); | 911 emit(0xFF); |
| 916 emit_modrm(0x2, adr); | 912 emit_modrm(0x2, adr); |
| 917 } | 913 } |
| 918 | 914 |
| 919 | 915 |
| 920 void Assembler::call(const Operand& op) { | 916 void Assembler::call(const Operand& op) { |
| 921 positions_recorder()->WriteRecordedPositions(); | |
| 922 EnsureSpace ensure_space(this); | 917 EnsureSpace ensure_space(this); |
| 923 // Opcode: FF /2 m64. | 918 // Opcode: FF /2 m64. |
| 924 emit_optional_rex_32(op); | 919 emit_optional_rex_32(op); |
| 925 emit(0xFF); | 920 emit(0xFF); |
| 926 emit_operand(0x2, op); | 921 emit_operand(0x2, op); |
| 927 } | 922 } |
| 928 | 923 |
| 929 | 924 |
| 930 // Calls directly to the given address using a relative offset. | 925 // Calls directly to the given address using a relative offset. |
| 931 // Should only ever be used in Code objects for calls within the | 926 // Should only ever be used in Code objects for calls within the |
| 932 // same Code object. Should not be used when generating new code (use labels), | 927 // same Code object. Should not be used when generating new code (use labels), |
| 933 // but only when patching existing code. | 928 // but only when patching existing code. |
| 934 void Assembler::call(Address target) { | 929 void Assembler::call(Address target) { |
| 935 positions_recorder()->WriteRecordedPositions(); | |
| 936 EnsureSpace ensure_space(this); | 930 EnsureSpace ensure_space(this); |
| 937 // 1110 1000 #32-bit disp. | 931 // 1110 1000 #32-bit disp. |
| 938 emit(0xE8); | 932 emit(0xE8); |
| 939 Address source = pc_ + 4; | 933 Address source = pc_ + 4; |
| 940 intptr_t displacement = target - source; | 934 intptr_t displacement = target - source; |
| 941 DCHECK(is_int32(displacement)); | 935 DCHECK(is_int32(displacement)); |
| 942 emitl(static_cast<int32_t>(displacement)); | 936 emitl(static_cast<int32_t>(displacement)); |
| 943 } | 937 } |
| 944 | 938 |
| 945 | 939 |
| (...skipping 3660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4606 | 4600 |
| 4607 bool RelocInfo::IsInConstantPool() { | 4601 bool RelocInfo::IsInConstantPool() { |
| 4608 return false; | 4602 return false; |
| 4609 } | 4603 } |
| 4610 | 4604 |
| 4611 | 4605 |
| 4612 } // namespace internal | 4606 } // namespace internal |
| 4613 } // namespace v8 | 4607 } // namespace v8 |
| 4614 | 4608 |
| 4615 #endif // V8_TARGET_ARCH_X64 | 4609 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |