| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } | 146 } |
| 147 // Return the 3 low bits of the register code. Used when encoding registers | 147 // Return the 3 low bits of the register code. Used when encoding registers |
| 148 // in modR/M, SIB, and opcode bytes. | 148 // in modR/M, SIB, and opcode bytes. |
| 149 int low_bits() const { | 149 int low_bits() const { |
| 150 return code_ & 0x7; | 150 return code_ & 0x7; |
| 151 } | 151 } |
| 152 | 152 |
| 153 // Unfortunately we can't make this private in a struct when initializing | 153 // Unfortunately we can't make this private in a struct when initializing |
| 154 // by assignment. | 154 // by assignment. |
| 155 int code_; | 155 int code_; |
| 156 |
| 156 private: | 157 private: |
| 157 static const int registerCodeByAllocationIndex[kNumAllocatableRegisters]; | 158 static const int registerCodeByAllocationIndex[kNumAllocatableRegisters]; |
| 158 static const int allocationIndexByRegisterCode[kNumRegisters]; | 159 static const int allocationIndexByRegisterCode[kNumRegisters]; |
| 159 }; | 160 }; |
| 160 | 161 |
| 161 const Register rax = { 0 }; | 162 const Register rax = { 0 }; |
| 162 const Register rcx = { 1 }; | 163 const Register rcx = { 1 }; |
| 163 const Register rdx = { 2 }; | 164 const Register rdx = { 2 }; |
| 164 const Register rbx = { 3 }; | 165 const Register rbx = { 3 }; |
| 165 const Register rsp = { 4 }; | 166 const Register rsp = { 4 }; |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 // [index*scale + disp/r] | 384 // [index*scale + disp/r] |
| 384 Operand(Register index, | 385 Operand(Register index, |
| 385 ScaleFactor scale, | 386 ScaleFactor scale, |
| 386 int32_t disp); | 387 int32_t disp); |
| 387 | 388 |
| 388 // Offset from existing memory operand. | 389 // Offset from existing memory operand. |
| 389 // Offset is added to existing displacement as 32-bit signed values and | 390 // Offset is added to existing displacement as 32-bit signed values and |
| 390 // this must not overflow. | 391 // this must not overflow. |
| 391 Operand(const Operand& base, int32_t offset); | 392 Operand(const Operand& base, int32_t offset); |
| 392 | 393 |
| 394 // Checks whether either base or index register is the given register. |
| 395 // Does not check the "reg" part of the Operand. |
| 396 bool AddressUsesRegister(Register reg) const; |
| 397 |
| 393 private: | 398 private: |
| 394 byte rex_; | 399 byte rex_; |
| 395 byte buf_[6]; | 400 byte buf_[6]; |
| 396 // The number of bytes in buf_. | 401 // The number of bytes of buf_ in use. |
| 397 unsigned int len_; | 402 byte len_; |
| 398 | 403 |
| 399 // Set the ModR/M byte without an encoded 'reg' register. The | 404 // Set the ModR/M byte without an encoded 'reg' register. The |
| 400 // register is encoded later as part of the emit_operand operation. | 405 // register is encoded later as part of the emit_operand operation. |
| 401 // set_modrm can be called before or after set_sib and set_disp*. | 406 // set_modrm can be called before or after set_sib and set_disp*. |
| 402 inline void set_modrm(int mod, Register rm); | 407 inline void set_modrm(int mod, Register rm); |
| 403 | 408 |
| 404 // Set the SIB byte if one is needed. Sets the length to 2 rather than 1. | 409 // Set the SIB byte if one is needed. Sets the length to 2 rather than 1. |
| 405 inline void set_sib(ScaleFactor scale, Register index, Register base); | 410 inline void set_sib(ScaleFactor scale, Register index, Register base); |
| 406 | 411 |
| 407 // Adds operand displacement fields (offsets added to the memory address). | 412 // Adds operand displacement fields (offsets added to the memory address). |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 } | 822 } |
| 818 | 823 |
| 819 void andl(Register dst, Immediate src) { | 824 void andl(Register dst, Immediate src) { |
| 820 immediate_arithmetic_op_32(0x4, dst, src); | 825 immediate_arithmetic_op_32(0x4, dst, src); |
| 821 } | 826 } |
| 822 | 827 |
| 823 void andl(Register dst, Register src) { | 828 void andl(Register dst, Register src) { |
| 824 arithmetic_op_32(0x23, dst, src); | 829 arithmetic_op_32(0x23, dst, src); |
| 825 } | 830 } |
| 826 | 831 |
| 832 void andl(Register dst, const Operand& src) { |
| 833 arithmetic_op_32(0x23, dst, src); |
| 834 } |
| 835 |
| 827 void andb(Register dst, Immediate src) { | 836 void andb(Register dst, Immediate src) { |
| 828 immediate_arithmetic_op_8(0x4, dst, src); | 837 immediate_arithmetic_op_8(0x4, dst, src); |
| 829 } | 838 } |
| 830 | 839 |
| 831 void decq(Register dst); | 840 void decq(Register dst); |
| 832 void decq(const Operand& dst); | 841 void decq(const Operand& dst); |
| 833 void decl(Register dst); | 842 void decl(Register dst); |
| 834 void decl(const Operand& dst); | 843 void decl(const Operand& dst); |
| 835 void decb(Register dst); | 844 void decb(Register dst); |
| 836 void decb(const Operand& dst); | 845 void decb(const Operand& dst); |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 void movd(XMMRegister dst, Register src); | 1211 void movd(XMMRegister dst, Register src); |
| 1203 void movd(Register dst, XMMRegister src); | 1212 void movd(Register dst, XMMRegister src); |
| 1204 void movq(XMMRegister dst, Register src); | 1213 void movq(XMMRegister dst, Register src); |
| 1205 void movq(Register dst, XMMRegister src); | 1214 void movq(Register dst, XMMRegister src); |
| 1206 void extractps(Register dst, XMMRegister src, byte imm8); | 1215 void extractps(Register dst, XMMRegister src, byte imm8); |
| 1207 | 1216 |
| 1208 void movsd(const Operand& dst, XMMRegister src); | 1217 void movsd(const Operand& dst, XMMRegister src); |
| 1209 void movsd(XMMRegister dst, XMMRegister src); | 1218 void movsd(XMMRegister dst, XMMRegister src); |
| 1210 void movsd(XMMRegister dst, const Operand& src); | 1219 void movsd(XMMRegister dst, const Operand& src); |
| 1211 | 1220 |
| 1221 void movdqa(const Operand& dst, XMMRegister src); |
| 1222 void movdqa(XMMRegister dst, const Operand& src); |
| 1223 |
| 1212 void movss(XMMRegister dst, const Operand& src); | 1224 void movss(XMMRegister dst, const Operand& src); |
| 1213 void movss(const Operand& dst, XMMRegister src); | 1225 void movss(const Operand& dst, XMMRegister src); |
| 1214 | 1226 |
| 1215 void cvttss2si(Register dst, const Operand& src); | 1227 void cvttss2si(Register dst, const Operand& src); |
| 1216 void cvttss2si(Register dst, XMMRegister src); | 1228 void cvttss2si(Register dst, XMMRegister src); |
| 1217 void cvttsd2si(Register dst, const Operand& src); | 1229 void cvttsd2si(Register dst, const Operand& src); |
| 1218 void cvttsd2si(Register dst, XMMRegister src); | 1230 void cvttsd2si(Register dst, XMMRegister src); |
| 1219 void cvttsd2siq(Register dst, XMMRegister src); | 1231 void cvttsd2siq(Register dst, XMMRegister src); |
| 1220 | 1232 |
| 1221 void cvtlsi2sd(XMMRegister dst, const Operand& src); | 1233 void cvtlsi2sd(XMMRegister dst, const Operand& src); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1242 | 1254 |
| 1243 void ucomisd(XMMRegister dst, XMMRegister src); | 1255 void ucomisd(XMMRegister dst, XMMRegister src); |
| 1244 void ucomisd(XMMRegister dst, const Operand& src); | 1256 void ucomisd(XMMRegister dst, const Operand& src); |
| 1245 | 1257 |
| 1246 // The first argument is the reg field, the second argument is the r/m field. | 1258 // The first argument is the reg field, the second argument is the r/m field. |
| 1247 void emit_sse_operand(XMMRegister dst, XMMRegister src); | 1259 void emit_sse_operand(XMMRegister dst, XMMRegister src); |
| 1248 void emit_sse_operand(XMMRegister reg, const Operand& adr); | 1260 void emit_sse_operand(XMMRegister reg, const Operand& adr); |
| 1249 void emit_sse_operand(XMMRegister dst, Register src); | 1261 void emit_sse_operand(XMMRegister dst, Register src); |
| 1250 void emit_sse_operand(Register dst, XMMRegister src); | 1262 void emit_sse_operand(Register dst, XMMRegister src); |
| 1251 | 1263 |
| 1252 // Use either movsd or movlpd. | |
| 1253 // void movdbl(XMMRegister dst, const Operand& src); | |
| 1254 // void movdbl(const Operand& dst, XMMRegister src); | |
| 1255 | |
| 1256 // Debugging | 1264 // Debugging |
| 1257 void Print(); | 1265 void Print(); |
| 1258 | 1266 |
| 1259 // Check the code size generated from label to here. | 1267 // Check the code size generated from label to here. |
| 1260 int SizeOfCodeGeneratedSince(Label* l) { return pc_offset() - l->pos(); } | 1268 int SizeOfCodeGeneratedSince(Label* l) { return pc_offset() - l->pos(); } |
| 1261 | 1269 |
| 1262 // Mark address of the ExitJSFrame code. | 1270 // Mark address of the ExitJSFrame code. |
| 1263 void RecordJSReturn(); | 1271 void RecordJSReturn(); |
| 1264 | 1272 |
| 1265 // Mark address of a debug break slot. | 1273 // Mark address of a debug break slot. |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1528 private: | 1536 private: |
| 1529 Assembler* assembler_; | 1537 Assembler* assembler_; |
| 1530 #ifdef DEBUG | 1538 #ifdef DEBUG |
| 1531 int space_before_; | 1539 int space_before_; |
| 1532 #endif | 1540 #endif |
| 1533 }; | 1541 }; |
| 1534 | 1542 |
| 1535 } } // namespace v8::internal | 1543 } } // namespace v8::internal |
| 1536 | 1544 |
| 1537 #endif // V8_X64_ASSEMBLER_X64_H_ | 1545 #endif // V8_X64_ASSEMBLER_X64_H_ |
| OLD | NEW |