| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 positions_recorder()->WriteRecordedPositions(); | 913 positions_recorder()->WriteRecordedPositions(); |
| 914 EnsureSpace ensure_space(this); | 914 EnsureSpace ensure_space(this); |
| 915 last_pc_ = pc_; | 915 last_pc_ = pc_; |
| 916 // Opcode: FF /2 m64. | 916 // Opcode: FF /2 m64. |
| 917 emit_optional_rex_32(op); | 917 emit_optional_rex_32(op); |
| 918 emit(0xFF); | 918 emit(0xFF); |
| 919 emit_operand(0x2, op); | 919 emit_operand(0x2, op); |
| 920 } | 920 } |
| 921 | 921 |
| 922 | 922 |
| 923 // Calls directly to the given address using a relative offset. |
| 924 // Should only ever be used in Code objects for calls within the |
| 925 // same Code object. Should not be used when generating new code (use labels), |
| 926 // but only when patching existing code. |
| 927 void Assembler::call(Address target) { |
| 928 positions_recorder()->WriteRecordedPositions(); |
| 929 EnsureSpace ensure_space(this); |
| 930 last_pc_ = pc_; |
| 931 // 1110 1000 #32-bit disp. |
| 932 emit(0xE8); |
| 933 Address source = pc_ + 4; |
| 934 intptr_t displacement = target - source; |
| 935 ASSERT(is_int32(displacement)); |
| 936 emitl(static_cast<int32_t>(displacement)); |
| 937 } |
| 938 |
| 939 |
| 923 void Assembler::clc() { | 940 void Assembler::clc() { |
| 924 EnsureSpace ensure_space(this); | 941 EnsureSpace ensure_space(this); |
| 925 last_pc_ = pc_; | 942 last_pc_ = pc_; |
| 926 emit(0xF8); | 943 emit(0xF8); |
| 927 } | 944 } |
| 928 | 945 |
| 929 void Assembler::cdq() { | 946 void Assembler::cdq() { |
| 930 EnsureSpace ensure_space(this); | 947 EnsureSpace ensure_space(this); |
| 931 last_pc_ = pc_; | 948 last_pc_ = pc_; |
| 932 emit(0x99); | 949 emit(0x99); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 void Assembler::imull(Register dst, Register src) { | 1185 void Assembler::imull(Register dst, Register src) { |
| 1169 EnsureSpace ensure_space(this); | 1186 EnsureSpace ensure_space(this); |
| 1170 last_pc_ = pc_; | 1187 last_pc_ = pc_; |
| 1171 emit_optional_rex_32(dst, src); | 1188 emit_optional_rex_32(dst, src); |
| 1172 emit(0x0F); | 1189 emit(0x0F); |
| 1173 emit(0xAF); | 1190 emit(0xAF); |
| 1174 emit_modrm(dst, src); | 1191 emit_modrm(dst, src); |
| 1175 } | 1192 } |
| 1176 | 1193 |
| 1177 | 1194 |
| 1195 void Assembler::imull(Register dst, const Operand& src) { |
| 1196 EnsureSpace ensure_space(this); |
| 1197 last_pc_ = pc_; |
| 1198 emit_optional_rex_32(dst, src); |
| 1199 emit(0x0F); |
| 1200 emit(0xAF); |
| 1201 emit_operand(dst, src); |
| 1202 } |
| 1203 |
| 1204 |
| 1178 void Assembler::imull(Register dst, Register src, Immediate imm) { | 1205 void Assembler::imull(Register dst, Register src, Immediate imm) { |
| 1179 EnsureSpace ensure_space(this); | 1206 EnsureSpace ensure_space(this); |
| 1180 last_pc_ = pc_; | 1207 last_pc_ = pc_; |
| 1181 emit_optional_rex_32(dst, src); | 1208 emit_optional_rex_32(dst, src); |
| 1182 if (is_int8(imm.value_)) { | 1209 if (is_int8(imm.value_)) { |
| 1183 emit(0x6B); | 1210 emit(0x6B); |
| 1184 emit_modrm(dst, src); | 1211 emit_modrm(dst, src); |
| 1185 emit(imm.value_); | 1212 emit(imm.value_); |
| 1186 } else { | 1213 } else { |
| 1187 emit(0x69); | 1214 emit(0x69); |
| (...skipping 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3009 EnsureSpace ensure_space(this); | 3036 EnsureSpace ensure_space(this); |
| 3010 last_pc_ = pc_; | 3037 last_pc_ = pc_; |
| 3011 emit(0x66); | 3038 emit(0x66); |
| 3012 emit_optional_rex_32(dst, src); | 3039 emit_optional_rex_32(dst, src); |
| 3013 emit(0x0f); | 3040 emit(0x0f); |
| 3014 emit(0x2e); | 3041 emit(0x2e); |
| 3015 emit_sse_operand(dst, src); | 3042 emit_sse_operand(dst, src); |
| 3016 } | 3043 } |
| 3017 | 3044 |
| 3018 | 3045 |
| 3046 void Assembler::movmskpd(Register dst, XMMRegister src) { |
| 3047 EnsureSpace ensure_space(this); |
| 3048 last_pc_ = pc_; |
| 3049 emit(0x66); |
| 3050 emit_optional_rex_32(dst, src); |
| 3051 emit(0x0f); |
| 3052 emit(0x50); |
| 3053 emit_sse_operand(dst, src); |
| 3054 } |
| 3055 |
| 3019 | 3056 |
| 3020 void Assembler::emit_sse_operand(XMMRegister reg, const Operand& adr) { | 3057 void Assembler::emit_sse_operand(XMMRegister reg, const Operand& adr) { |
| 3021 Register ireg = { reg.code() }; | 3058 Register ireg = { reg.code() }; |
| 3022 emit_operand(ireg, adr); | 3059 emit_operand(ireg, adr); |
| 3023 } | 3060 } |
| 3024 | 3061 |
| 3025 | 3062 |
| 3026 void Assembler::emit_sse_operand(XMMRegister dst, XMMRegister src) { | 3063 void Assembler::emit_sse_operand(XMMRegister dst, XMMRegister src) { |
| 3027 emit(0xC0 | (dst.low_bits() << 3) | src.low_bits()); | 3064 emit(0xC0 | (dst.low_bits() << 3) | src.low_bits()); |
| 3028 } | 3065 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3046 EnsureSpace ensure_space(this); | 3083 EnsureSpace ensure_space(this); |
| 3047 emitl(data); | 3084 emitl(data); |
| 3048 } | 3085 } |
| 3049 | 3086 |
| 3050 | 3087 |
| 3051 // Relocation information implementations. | 3088 // Relocation information implementations. |
| 3052 | 3089 |
| 3053 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { | 3090 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { |
| 3054 ASSERT(rmode != RelocInfo::NONE); | 3091 ASSERT(rmode != RelocInfo::NONE); |
| 3055 // Don't record external references unless the heap will be serialized. | 3092 // Don't record external references unless the heap will be serialized. |
| 3056 if (rmode == RelocInfo::EXTERNAL_REFERENCE && | 3093 if (rmode == RelocInfo::EXTERNAL_REFERENCE) { |
| 3057 !Serializer::enabled() && | 3094 #ifdef DEBUG |
| 3058 !FLAG_debug_code) { | 3095 if (!Serializer::enabled()) { |
| 3059 return; | 3096 Serializer::TooLateToEnableNow(); |
| 3097 } |
| 3098 #endif |
| 3099 if (!Serializer::enabled() && !FLAG_debug_code) { |
| 3100 return; |
| 3101 } |
| 3060 } | 3102 } |
| 3061 RelocInfo rinfo(pc_, rmode, data); | 3103 RelocInfo rinfo(pc_, rmode, data); |
| 3062 reloc_info_writer.Write(&rinfo); | 3104 reloc_info_writer.Write(&rinfo); |
| 3063 } | 3105 } |
| 3064 | 3106 |
| 3065 void Assembler::RecordJSReturn() { | 3107 void Assembler::RecordJSReturn() { |
| 3066 positions_recorder()->WriteRecordedPositions(); | 3108 positions_recorder()->WriteRecordedPositions(); |
| 3067 EnsureSpace ensure_space(this); | 3109 EnsureSpace ensure_space(this); |
| 3068 RecordRelocInfo(RelocInfo::JS_RETURN); | 3110 RecordRelocInfo(RelocInfo::JS_RETURN); |
| 3069 } | 3111 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3093 // specially coded on x64 means that it is a relative 32 bit address, as used | 3135 // specially coded on x64 means that it is a relative 32 bit address, as used |
| 3094 // by branch instructions. | 3136 // by branch instructions. |
| 3095 return (1 << rmode_) & kApplyMask; | 3137 return (1 << rmode_) & kApplyMask; |
| 3096 } | 3138 } |
| 3097 | 3139 |
| 3098 | 3140 |
| 3099 | 3141 |
| 3100 } } // namespace v8::internal | 3142 } } // namespace v8::internal |
| 3101 | 3143 |
| 3102 #endif // V8_TARGET_ARCH_X64 | 3144 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |