| 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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 // // Generate standard SSE2 floating point code. | 443 // // Generate standard SSE2 floating point code. |
| 444 // } | 444 // } |
| 445 class CpuFeatures : public AllStatic { | 445 class CpuFeatures : public AllStatic { |
| 446 public: | 446 public: |
| 447 // Detect features of the target CPU. Set safe defaults if the serializer | 447 // Detect features of the target CPU. Set safe defaults if the serializer |
| 448 // is enabled (snapshots must be portable). | 448 // is enabled (snapshots must be portable). |
| 449 static void Probe(); | 449 static void Probe(); |
| 450 | 450 |
| 451 // Check whether a feature is supported by the target CPU. | 451 // Check whether a feature is supported by the target CPU. |
| 452 static bool IsSupported(CpuFeature f) { | 452 static bool IsSupported(CpuFeature f) { |
| 453 if (Check(f, cross_compile_)) return true; |
| 453 ASSERT(initialized_); | 454 ASSERT(initialized_); |
| 454 if (f == SSE3 && !FLAG_enable_sse3) return false; | 455 if (f == SSE3 && !FLAG_enable_sse3) return false; |
| 455 if (f == SSE4_1 && !FLAG_enable_sse4_1) return false; | 456 if (f == SSE4_1 && !FLAG_enable_sse4_1) return false; |
| 456 if (f == CMOV && !FLAG_enable_cmov) return false; | 457 if (f == CMOV && !FLAG_enable_cmov) return false; |
| 457 if (f == SAHF && !FLAG_enable_sahf) return false; | 458 if (f == SAHF && !FLAG_enable_sahf) return false; |
| 458 return (supported_ & (static_cast<uint64_t>(1) << f)) != 0; | 459 return Check(f, supported_); |
| 459 } | 460 } |
| 460 | 461 |
| 461 static bool IsFoundByRuntimeProbingOnly(CpuFeature f) { | 462 static bool IsFoundByRuntimeProbingOnly(CpuFeature f) { |
| 462 ASSERT(initialized_); | 463 ASSERT(initialized_); |
| 463 return (found_by_runtime_probing_only_ & | 464 return Check(f, found_by_runtime_probing_only_); |
| 464 (static_cast<uint64_t>(1) << f)) != 0; | |
| 465 } | 465 } |
| 466 | 466 |
| 467 static bool IsSafeForSnapshot(CpuFeature f) { | 467 static bool IsSafeForSnapshot(CpuFeature f) { |
| 468 return (IsSupported(f) && | 468 return Check(f, cross_compile_) || |
| 469 (IsSupported(f) && |
| 469 (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f))); | 470 (!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f))); |
| 470 } | 471 } |
| 471 | 472 |
| 473 static bool VerifyCrossCompiling() { |
| 474 return cross_compile_ == 0; |
| 475 } |
| 476 |
| 477 static bool VerifyCrossCompiling(CpuFeature f) { |
| 478 uint64_t mask = flag2set(f); |
| 479 return cross_compile_ == 0 || |
| 480 (cross_compile_ & mask) == mask; |
| 481 } |
| 482 |
| 472 private: | 483 private: |
| 484 static bool Check(CpuFeature f, uint64_t set) { |
| 485 return (set & flag2set(f)) != 0; |
| 486 } |
| 487 |
| 488 static uint64_t flag2set(CpuFeature f) { |
| 489 return static_cast<uint64_t>(1) << f; |
| 490 } |
| 491 |
| 473 // Safe defaults include CMOV for X64. It is always available, if | 492 // Safe defaults include CMOV for X64. It is always available, if |
| 474 // anyone checks, but they shouldn't need to check. | 493 // anyone checks, but they shouldn't need to check. |
| 475 // The required user mode extensions in X64 are (from AMD64 ABI Table A.1): | 494 // The required user mode extensions in X64 are (from AMD64 ABI Table A.1): |
| 476 // fpu, tsc, cx8, cmov, mmx, sse, sse2, fxsr, syscall | 495 // fpu, tsc, cx8, cmov, mmx, sse, sse2, fxsr, syscall |
| 477 static const uint64_t kDefaultCpuFeatures = (1 << CMOV); | 496 static const uint64_t kDefaultCpuFeatures = (1 << CMOV); |
| 478 | 497 |
| 479 #ifdef DEBUG | 498 #ifdef DEBUG |
| 480 static bool initialized_; | 499 static bool initialized_; |
| 481 #endif | 500 #endif |
| 482 static uint64_t supported_; | 501 static uint64_t supported_; |
| 483 static uint64_t found_by_runtime_probing_only_; | 502 static uint64_t found_by_runtime_probing_only_; |
| 484 | 503 |
| 504 static uint64_t cross_compile_; |
| 505 |
| 485 friend class ExternalReference; | 506 friend class ExternalReference; |
| 486 friend class PlatformFeatureScope; | 507 friend class PlatformFeatureScope; |
| 487 DISALLOW_COPY_AND_ASSIGN(CpuFeatures); | 508 DISALLOW_COPY_AND_ASSIGN(CpuFeatures); |
| 488 }; | 509 }; |
| 489 | 510 |
| 490 | 511 |
| 491 class Assembler : public AssemblerBase { | 512 class Assembler : public AssemblerBase { |
| 492 private: | 513 private: |
| 493 // We check before assembling an instruction that there is sufficient | 514 // We check before assembling an instruction that there is sufficient |
| 494 // space to write an instruction and its relocation information. | 515 // space to write an instruction and its relocation information. |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 // Move the offset of the label location relative to the current | 695 // Move the offset of the label location relative to the current |
| 675 // position (after the move) to the destination. | 696 // position (after the move) to the destination. |
| 676 void movl(const Operand& dst, Label* src); | 697 void movl(const Operand& dst, Label* src); |
| 677 | 698 |
| 678 // Move sign extended immediate to memory location. | 699 // Move sign extended immediate to memory location. |
| 679 void movq(const Operand& dst, Immediate value); | 700 void movq(const Operand& dst, Immediate value); |
| 680 // Instructions to load a 64-bit immediate into a register. | 701 // Instructions to load a 64-bit immediate into a register. |
| 681 // All 64-bit immediates must have a relocation mode. | 702 // All 64-bit immediates must have a relocation mode. |
| 682 void movq(Register dst, void* ptr, RelocInfo::Mode rmode); | 703 void movq(Register dst, void* ptr, RelocInfo::Mode rmode); |
| 683 void movq(Register dst, int64_t value, RelocInfo::Mode rmode); | 704 void movq(Register dst, int64_t value, RelocInfo::Mode rmode); |
| 684 void movq(Register dst, const char* s, RelocInfo::Mode rmode); | |
| 685 // Moves the address of the external reference into the register. | 705 // Moves the address of the external reference into the register. |
| 686 void movq(Register dst, ExternalReference ext); | 706 void movq(Register dst, ExternalReference ext); |
| 687 void movq(Register dst, Handle<Object> handle, RelocInfo::Mode rmode); | 707 void movq(Register dst, Handle<Object> handle, RelocInfo::Mode rmode); |
| 688 | 708 |
| 689 void movsxbq(Register dst, const Operand& src); | 709 void movsxbq(Register dst, const Operand& src); |
| 690 void movsxwq(Register dst, const Operand& src); | 710 void movsxwq(Register dst, const Operand& src); |
| 691 void movsxlq(Register dst, Register src); | 711 void movsxlq(Register dst, Register src); |
| 692 void movsxlq(Register dst, const Operand& src); | 712 void movsxlq(Register dst, const Operand& src); |
| 693 void movzxbq(Register dst, const Operand& src); | 713 void movzxbq(Register dst, const Operand& src); |
| 694 void movzxbl(Register dst, const Operand& src); | 714 void movzxbl(Register dst, const Operand& src); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 707 void load_rax(void* ptr, RelocInfo::Mode rmode); | 727 void load_rax(void* ptr, RelocInfo::Mode rmode); |
| 708 void load_rax(ExternalReference ext); | 728 void load_rax(ExternalReference ext); |
| 709 | 729 |
| 710 // Conditional moves. | 730 // Conditional moves. |
| 711 void cmovq(Condition cc, Register dst, Register src); | 731 void cmovq(Condition cc, Register dst, Register src); |
| 712 void cmovq(Condition cc, Register dst, const Operand& src); | 732 void cmovq(Condition cc, Register dst, const Operand& src); |
| 713 void cmovl(Condition cc, Register dst, Register src); | 733 void cmovl(Condition cc, Register dst, Register src); |
| 714 void cmovl(Condition cc, Register dst, const Operand& src); | 734 void cmovl(Condition cc, Register dst, const Operand& src); |
| 715 | 735 |
| 716 // Exchange two registers | 736 // Exchange two registers |
| 717 void xchg(Register dst, Register src); | 737 void xchgq(Register dst, Register src); |
| 738 void xchgl(Register dst, Register src); |
| 718 | 739 |
| 719 // Arithmetics | 740 // Arithmetics |
| 720 void addl(Register dst, Register src) { | 741 void addl(Register dst, Register src) { |
| 721 arithmetic_op_32(0x03, dst, src); | 742 arithmetic_op_32(0x03, dst, src); |
| 722 } | 743 } |
| 723 | 744 |
| 724 void addl(Register dst, Immediate src) { | 745 void addl(Register dst, Immediate src) { |
| 725 immediate_arithmetic_op_32(0x0, dst, src); | 746 immediate_arithmetic_op_32(0x0, dst, src); |
| 726 } | 747 } |
| 727 | 748 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 } | 963 } |
| 943 | 964 |
| 944 void orl(Register dst, const Operand& src) { | 965 void orl(Register dst, const Operand& src) { |
| 945 arithmetic_op_32(0x0B, dst, src); | 966 arithmetic_op_32(0x0B, dst, src); |
| 946 } | 967 } |
| 947 | 968 |
| 948 void or_(const Operand& dst, Register src) { | 969 void or_(const Operand& dst, Register src) { |
| 949 arithmetic_op(0x09, src, dst); | 970 arithmetic_op(0x09, src, dst); |
| 950 } | 971 } |
| 951 | 972 |
| 973 void orl(const Operand& dst, Register src) { |
| 974 arithmetic_op_32(0x09, src, dst); |
| 975 } |
| 976 |
| 952 void or_(Register dst, Immediate src) { | 977 void or_(Register dst, Immediate src) { |
| 953 immediate_arithmetic_op(0x1, dst, src); | 978 immediate_arithmetic_op(0x1, dst, src); |
| 954 } | 979 } |
| 955 | 980 |
| 956 void orl(Register dst, Immediate src) { | 981 void orl(Register dst, Immediate src) { |
| 957 immediate_arithmetic_op_32(0x1, dst, src); | 982 immediate_arithmetic_op_32(0x1, dst, src); |
| 958 } | 983 } |
| 959 | 984 |
| 960 void or_(const Operand& dst, Immediate src) { | 985 void or_(const Operand& dst, Immediate src) { |
| 961 immediate_arithmetic_op(0x1, dst, src); | 986 immediate_arithmetic_op(0x1, dst, src); |
| 962 } | 987 } |
| 963 | 988 |
| 964 void orl(const Operand& dst, Immediate src) { | 989 void orl(const Operand& dst, Immediate src) { |
| 965 immediate_arithmetic_op_32(0x1, dst, src); | 990 immediate_arithmetic_op_32(0x1, dst, src); |
| 966 } | 991 } |
| 967 | 992 |
| 968 | 993 |
| 969 void rcl(Register dst, Immediate imm8) { | 994 void rcl(Register dst, Immediate imm8) { |
| 970 shift(dst, imm8, 0x2); | 995 shift(dst, imm8, 0x2); |
| 971 } | 996 } |
| 972 | 997 |
| 973 void rol(Register dst, Immediate imm8) { | 998 void rol(Register dst, Immediate imm8) { |
| 974 shift(dst, imm8, 0x0); | 999 shift(dst, imm8, 0x0); |
| 975 } | 1000 } |
| 976 | 1001 |
| 1002 void roll(Register dst, Immediate imm8) { |
| 1003 shift_32(dst, imm8, 0x0); |
| 1004 } |
| 1005 |
| 977 void rcr(Register dst, Immediate imm8) { | 1006 void rcr(Register dst, Immediate imm8) { |
| 978 shift(dst, imm8, 0x3); | 1007 shift(dst, imm8, 0x3); |
| 979 } | 1008 } |
| 980 | 1009 |
| 981 void ror(Register dst, Immediate imm8) { | 1010 void ror(Register dst, Immediate imm8) { |
| 982 shift(dst, imm8, 0x1); | 1011 shift(dst, imm8, 0x1); |
| 983 } | 1012 } |
| 984 | 1013 |
| 985 void rorl(Register dst, Immediate imm8) { | 1014 void rorl(Register dst, Immediate imm8) { |
| 986 shift_32(dst, imm8, 0x1); | 1015 shift_32(dst, imm8, 0x1); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 } | 1103 } |
| 1075 | 1104 |
| 1076 void subl(Register dst, Register src) { | 1105 void subl(Register dst, Register src) { |
| 1077 arithmetic_op_32(0x2B, dst, src); | 1106 arithmetic_op_32(0x2B, dst, src); |
| 1078 } | 1107 } |
| 1079 | 1108 |
| 1080 void subl(Register dst, const Operand& src) { | 1109 void subl(Register dst, const Operand& src) { |
| 1081 arithmetic_op_32(0x2B, dst, src); | 1110 arithmetic_op_32(0x2B, dst, src); |
| 1082 } | 1111 } |
| 1083 | 1112 |
| 1113 void subl(const Operand& dst, Register src) { |
| 1114 arithmetic_op_32(0x29, src, dst); |
| 1115 } |
| 1116 |
| 1084 void subl(const Operand& dst, Immediate src) { | 1117 void subl(const Operand& dst, Immediate src) { |
| 1085 immediate_arithmetic_op_32(0x5, dst, src); | 1118 immediate_arithmetic_op_32(0x5, dst, src); |
| 1086 } | 1119 } |
| 1087 | 1120 |
| 1088 void subl(Register dst, Immediate src) { | 1121 void subl(Register dst, Immediate src) { |
| 1089 immediate_arithmetic_op_32(0x5, dst, src); | 1122 immediate_arithmetic_op_32(0x5, dst, src); |
| 1090 } | 1123 } |
| 1091 | 1124 |
| 1092 void subb(Register dst, Immediate src) { | 1125 void subb(Register dst, Immediate src) { |
| 1093 immediate_arithmetic_op_8(0x5, dst, src); | 1126 immediate_arithmetic_op_8(0x5, dst, src); |
| 1094 } | 1127 } |
| 1095 | 1128 |
| 1096 void testb(Register dst, Register src); | 1129 void testb(Register dst, Register src); |
| 1097 void testb(Register reg, Immediate mask); | 1130 void testb(Register reg, Immediate mask); |
| 1098 void testb(const Operand& op, Immediate mask); | 1131 void testb(const Operand& op, Immediate mask); |
| 1099 void testb(const Operand& op, Register reg); | 1132 void testb(const Operand& op, Register reg); |
| 1100 void testl(Register dst, Register src); | 1133 void testl(Register dst, Register src); |
| 1101 void testl(Register reg, Immediate mask); | 1134 void testl(Register reg, Immediate mask); |
| 1135 void testl(const Operand& op, Register reg); |
| 1102 void testl(const Operand& op, Immediate mask); | 1136 void testl(const Operand& op, Immediate mask); |
| 1103 void testq(const Operand& op, Register reg); | 1137 void testq(const Operand& op, Register reg); |
| 1104 void testq(Register dst, Register src); | 1138 void testq(Register dst, Register src); |
| 1105 void testq(Register dst, Immediate mask); | 1139 void testq(Register dst, Immediate mask); |
| 1106 | 1140 |
| 1107 void xor_(Register dst, Register src) { | 1141 void xor_(Register dst, Register src) { |
| 1108 if (dst.code() == src.code()) { | 1142 if (dst.code() == src.code()) { |
| 1109 arithmetic_op_32(0x33, dst, src); | 1143 arithmetic_op_32(0x33, dst, src); |
| 1110 } else { | 1144 } else { |
| 1111 arithmetic_op(0x33, dst, src); | 1145 arithmetic_op(0x33, dst, src); |
| 1112 } | 1146 } |
| 1113 } | 1147 } |
| 1114 | 1148 |
| 1115 void xorl(Register dst, Register src) { | 1149 void xorl(Register dst, Register src) { |
| 1116 arithmetic_op_32(0x33, dst, src); | 1150 arithmetic_op_32(0x33, dst, src); |
| 1117 } | 1151 } |
| 1118 | 1152 |
| 1119 void xorl(Register dst, const Operand& src) { | 1153 void xorl(Register dst, const Operand& src) { |
| 1120 arithmetic_op_32(0x33, dst, src); | 1154 arithmetic_op_32(0x33, dst, src); |
| 1121 } | 1155 } |
| 1122 | 1156 |
| 1123 void xorl(Register dst, Immediate src) { | 1157 void xorl(Register dst, Immediate src) { |
| 1124 immediate_arithmetic_op_32(0x6, dst, src); | 1158 immediate_arithmetic_op_32(0x6, dst, src); |
| 1125 } | 1159 } |
| 1126 | 1160 |
| 1161 void xorl(const Operand& dst, Register src) { |
| 1162 arithmetic_op_32(0x31, src, dst); |
| 1163 } |
| 1164 |
| 1127 void xorl(const Operand& dst, Immediate src) { | 1165 void xorl(const Operand& dst, Immediate src) { |
| 1128 immediate_arithmetic_op_32(0x6, dst, src); | 1166 immediate_arithmetic_op_32(0x6, dst, src); |
| 1129 } | 1167 } |
| 1130 | 1168 |
| 1131 void xor_(Register dst, const Operand& src) { | 1169 void xor_(Register dst, const Operand& src) { |
| 1132 arithmetic_op(0x33, dst, src); | 1170 arithmetic_op(0x33, dst, src); |
| 1133 } | 1171 } |
| 1134 | 1172 |
| 1135 void xor_(const Operand& dst, Register src) { | 1173 void xor_(const Operand& dst, Register src) { |
| 1136 arithmetic_op(0x31, src, dst); | 1174 arithmetic_op(0x31, src, dst); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 void fptan(); | 1318 void fptan(); |
| 1281 void fyl2x(); | 1319 void fyl2x(); |
| 1282 void f2xm1(); | 1320 void f2xm1(); |
| 1283 void fscale(); | 1321 void fscale(); |
| 1284 void fninit(); | 1322 void fninit(); |
| 1285 | 1323 |
| 1286 void frndint(); | 1324 void frndint(); |
| 1287 | 1325 |
| 1288 void sahf(); | 1326 void sahf(); |
| 1289 | 1327 |
| 1328 // SSE instructions |
| 1329 void movaps(XMMRegister dst, XMMRegister src); |
| 1330 void movss(XMMRegister dst, const Operand& src); |
| 1331 void movss(const Operand& dst, XMMRegister src); |
| 1332 |
| 1333 void cvttss2si(Register dst, const Operand& src); |
| 1334 void cvttss2si(Register dst, XMMRegister src); |
| 1335 void cvtlsi2ss(XMMRegister dst, Register src); |
| 1336 |
| 1337 void xorps(XMMRegister dst, XMMRegister src); |
| 1338 void andps(XMMRegister dst, XMMRegister src); |
| 1339 |
| 1340 void movmskps(Register dst, XMMRegister src); |
| 1341 |
| 1290 // SSE2 instructions | 1342 // SSE2 instructions |
| 1291 void movd(XMMRegister dst, Register src); | 1343 void movd(XMMRegister dst, Register src); |
| 1292 void movd(Register dst, XMMRegister src); | 1344 void movd(Register dst, XMMRegister src); |
| 1293 void movq(XMMRegister dst, Register src); | 1345 void movq(XMMRegister dst, Register src); |
| 1294 void movq(Register dst, XMMRegister src); | 1346 void movq(Register dst, XMMRegister src); |
| 1295 void movq(XMMRegister dst, XMMRegister src); | 1347 void movq(XMMRegister dst, XMMRegister src); |
| 1296 void extractps(Register dst, XMMRegister src, byte imm8); | |
| 1297 | 1348 |
| 1298 // Don't use this unless it's important to keep the | 1349 // Don't use this unless it's important to keep the |
| 1299 // top half of the destination register unchanged. | 1350 // top half of the destination register unchanged. |
| 1300 // Used movaps when moving double values and movq for integer | 1351 // Used movaps when moving double values and movq for integer |
| 1301 // values in xmm registers. | 1352 // values in xmm registers. |
| 1302 void movsd(XMMRegister dst, XMMRegister src); | 1353 void movsd(XMMRegister dst, XMMRegister src); |
| 1303 | 1354 |
| 1304 void movsd(const Operand& dst, XMMRegister src); | 1355 void movsd(const Operand& dst, XMMRegister src); |
| 1305 void movsd(XMMRegister dst, const Operand& src); | 1356 void movsd(XMMRegister dst, const Operand& src); |
| 1306 | 1357 |
| 1307 void movdqa(const Operand& dst, XMMRegister src); | 1358 void movdqa(const Operand& dst, XMMRegister src); |
| 1308 void movdqa(XMMRegister dst, const Operand& src); | 1359 void movdqa(XMMRegister dst, const Operand& src); |
| 1309 | 1360 |
| 1310 void movdqu(const Operand& dst, XMMRegister src); | 1361 void movdqu(const Operand& dst, XMMRegister src); |
| 1311 void movdqu(XMMRegister dst, const Operand& src); | 1362 void movdqu(XMMRegister dst, const Operand& src); |
| 1312 | 1363 |
| 1313 void movapd(XMMRegister dst, XMMRegister src); | 1364 void movapd(XMMRegister dst, XMMRegister src); |
| 1314 void movaps(XMMRegister dst, XMMRegister src); | |
| 1315 | 1365 |
| 1316 void movss(XMMRegister dst, const Operand& src); | |
| 1317 void movss(const Operand& dst, XMMRegister src); | |
| 1318 | |
| 1319 void cvttss2si(Register dst, const Operand& src); | |
| 1320 void cvttss2si(Register dst, XMMRegister src); | |
| 1321 void cvttsd2si(Register dst, const Operand& src); | 1366 void cvttsd2si(Register dst, const Operand& src); |
| 1322 void cvttsd2si(Register dst, XMMRegister src); | 1367 void cvttsd2si(Register dst, XMMRegister src); |
| 1323 void cvttsd2siq(Register dst, XMMRegister src); | 1368 void cvttsd2siq(Register dst, XMMRegister src); |
| 1324 | 1369 |
| 1325 void cvtlsi2sd(XMMRegister dst, const Operand& src); | 1370 void cvtlsi2sd(XMMRegister dst, const Operand& src); |
| 1326 void cvtlsi2sd(XMMRegister dst, Register src); | 1371 void cvtlsi2sd(XMMRegister dst, Register src); |
| 1327 void cvtqsi2sd(XMMRegister dst, const Operand& src); | 1372 void cvtqsi2sd(XMMRegister dst, const Operand& src); |
| 1328 void cvtqsi2sd(XMMRegister dst, Register src); | 1373 void cvtqsi2sd(XMMRegister dst, Register src); |
| 1329 | 1374 |
| 1330 void cvtlsi2ss(XMMRegister dst, Register src); | |
| 1331 | 1375 |
| 1332 void cvtss2sd(XMMRegister dst, XMMRegister src); | 1376 void cvtss2sd(XMMRegister dst, XMMRegister src); |
| 1333 void cvtss2sd(XMMRegister dst, const Operand& src); | 1377 void cvtss2sd(XMMRegister dst, const Operand& src); |
| 1334 void cvtsd2ss(XMMRegister dst, XMMRegister src); | 1378 void cvtsd2ss(XMMRegister dst, XMMRegister src); |
| 1335 | 1379 |
| 1336 void cvtsd2si(Register dst, XMMRegister src); | 1380 void cvtsd2si(Register dst, XMMRegister src); |
| 1337 void cvtsd2siq(Register dst, XMMRegister src); | 1381 void cvtsd2siq(Register dst, XMMRegister src); |
| 1338 | 1382 |
| 1339 void addsd(XMMRegister dst, XMMRegister src); | 1383 void addsd(XMMRegister dst, XMMRegister src); |
| 1340 void addsd(XMMRegister dst, const Operand& src); | 1384 void addsd(XMMRegister dst, const Operand& src); |
| 1341 void subsd(XMMRegister dst, XMMRegister src); | 1385 void subsd(XMMRegister dst, XMMRegister src); |
| 1342 void mulsd(XMMRegister dst, XMMRegister src); | 1386 void mulsd(XMMRegister dst, XMMRegister src); |
| 1343 void mulsd(XMMRegister dst, const Operand& src); | 1387 void mulsd(XMMRegister dst, const Operand& src); |
| 1344 void divsd(XMMRegister dst, XMMRegister src); | 1388 void divsd(XMMRegister dst, XMMRegister src); |
| 1345 | 1389 |
| 1346 void andpd(XMMRegister dst, XMMRegister src); | 1390 void andpd(XMMRegister dst, XMMRegister src); |
| 1347 void orpd(XMMRegister dst, XMMRegister src); | 1391 void orpd(XMMRegister dst, XMMRegister src); |
| 1348 void xorpd(XMMRegister dst, XMMRegister src); | 1392 void xorpd(XMMRegister dst, XMMRegister src); |
| 1349 void xorps(XMMRegister dst, XMMRegister src); | |
| 1350 void sqrtsd(XMMRegister dst, XMMRegister src); | 1393 void sqrtsd(XMMRegister dst, XMMRegister src); |
| 1351 | 1394 |
| 1352 void ucomisd(XMMRegister dst, XMMRegister src); | 1395 void ucomisd(XMMRegister dst, XMMRegister src); |
| 1353 void ucomisd(XMMRegister dst, const Operand& src); | 1396 void ucomisd(XMMRegister dst, const Operand& src); |
| 1397 void cmpltsd(XMMRegister dst, XMMRegister src); |
| 1398 |
| 1399 void movmskpd(Register dst, XMMRegister src); |
| 1400 |
| 1401 // SSE 4.1 instruction |
| 1402 void extractps(Register dst, XMMRegister src, byte imm8); |
| 1354 | 1403 |
| 1355 enum RoundingMode { | 1404 enum RoundingMode { |
| 1356 kRoundToNearest = 0x0, | 1405 kRoundToNearest = 0x0, |
| 1357 kRoundDown = 0x1, | 1406 kRoundDown = 0x1, |
| 1358 kRoundUp = 0x2, | 1407 kRoundUp = 0x2, |
| 1359 kRoundToZero = 0x3 | 1408 kRoundToZero = 0x3 |
| 1360 }; | 1409 }; |
| 1361 | 1410 |
| 1362 void roundsd(XMMRegister dst, XMMRegister src, RoundingMode mode); | 1411 void roundsd(XMMRegister dst, XMMRegister src, RoundingMode mode); |
| 1363 | 1412 |
| 1364 void movmskpd(Register dst, XMMRegister src); | |
| 1365 void movmskps(Register dst, XMMRegister src); | |
| 1366 | |
| 1367 void cmpltsd(XMMRegister dst, XMMRegister src); | |
| 1368 | |
| 1369 // The first argument is the reg field, the second argument is the r/m field. | |
| 1370 void emit_sse_operand(XMMRegister dst, XMMRegister src); | |
| 1371 void emit_sse_operand(XMMRegister reg, const Operand& adr); | |
| 1372 void emit_sse_operand(XMMRegister dst, Register src); | |
| 1373 void emit_sse_operand(Register dst, XMMRegister src); | |
| 1374 | |
| 1375 // Debugging | 1413 // Debugging |
| 1376 void Print(); | 1414 void Print(); |
| 1377 | 1415 |
| 1378 // Check the code size generated from label to here. | 1416 // Check the code size generated from label to here. |
| 1379 int SizeOfCodeGeneratedSince(Label* label) { | 1417 int SizeOfCodeGeneratedSince(Label* label) { |
| 1380 return pc_offset() - label->pos(); | 1418 return pc_offset() - label->pos(); |
| 1381 } | 1419 } |
| 1382 | 1420 |
| 1383 // Mark address of the ExitJSFrame code. | 1421 // Mark address of the ExitJSFrame code. |
| 1384 void RecordJSReturn(); | 1422 void RecordJSReturn(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 void long_at_put(int pos, uint32_t x) { | 1463 void long_at_put(int pos, uint32_t x) { |
| 1426 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; | 1464 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; |
| 1427 } | 1465 } |
| 1428 | 1466 |
| 1429 // code emission | 1467 // code emission |
| 1430 void GrowBuffer(); | 1468 void GrowBuffer(); |
| 1431 | 1469 |
| 1432 void emit(byte x) { *pc_++ = x; } | 1470 void emit(byte x) { *pc_++ = x; } |
| 1433 inline void emitl(uint32_t x); | 1471 inline void emitl(uint32_t x); |
| 1434 inline void emitp(void* x, RelocInfo::Mode rmode); | 1472 inline void emitp(void* x, RelocInfo::Mode rmode); |
| 1435 inline void emitq(uint64_t x, RelocInfo::Mode rmode); | 1473 inline void emitq(uint64_t x); |
| 1436 inline void emitw(uint16_t x); | 1474 inline void emitw(uint16_t x); |
| 1437 inline void emit_code_target(Handle<Code> target, | 1475 inline void emit_code_target(Handle<Code> target, |
| 1438 RelocInfo::Mode rmode, | 1476 RelocInfo::Mode rmode, |
| 1439 TypeFeedbackId ast_id = TypeFeedbackId::None()); | 1477 TypeFeedbackId ast_id = TypeFeedbackId::None()); |
| 1440 inline void emit_runtime_entry(Address entry, RelocInfo::Mode rmode); | 1478 inline void emit_runtime_entry(Address entry, RelocInfo::Mode rmode); |
| 1441 void emit(Immediate x) { emitl(x.value_); } | 1479 void emit(Immediate x) { emitl(x.value_); } |
| 1442 | 1480 |
| 1443 // Emits a REX prefix that encodes a 64-bit operand size and | 1481 // Emits a REX prefix that encodes a 64-bit operand size and |
| 1444 // the top bit of both register codes. | 1482 // the top bit of both register codes. |
| 1445 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. | 1483 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 // Emit a ModR/M byte with an operation subcode in the reg field and | 1583 // Emit a ModR/M byte with an operation subcode in the reg field and |
| 1546 // a register in the rm_reg field. | 1584 // a register in the rm_reg field. |
| 1547 void emit_modrm(int code, Register rm_reg) { | 1585 void emit_modrm(int code, Register rm_reg) { |
| 1548 ASSERT(is_uint3(code)); | 1586 ASSERT(is_uint3(code)); |
| 1549 emit(0xC0 | code << 3 | rm_reg.low_bits()); | 1587 emit(0xC0 | code << 3 | rm_reg.low_bits()); |
| 1550 } | 1588 } |
| 1551 | 1589 |
| 1552 // Emit the code-object-relative offset of the label's position | 1590 // Emit the code-object-relative offset of the label's position |
| 1553 inline void emit_code_relative_offset(Label* label); | 1591 inline void emit_code_relative_offset(Label* label); |
| 1554 | 1592 |
| 1593 // The first argument is the reg field, the second argument is the r/m field. |
| 1594 void emit_sse_operand(XMMRegister dst, XMMRegister src); |
| 1595 void emit_sse_operand(XMMRegister reg, const Operand& adr); |
| 1596 void emit_sse_operand(XMMRegister dst, Register src); |
| 1597 void emit_sse_operand(Register dst, XMMRegister src); |
| 1598 |
| 1555 // Emit machine code for one of the operations ADD, ADC, SUB, SBC, | 1599 // Emit machine code for one of the operations ADD, ADC, SUB, SBC, |
| 1556 // AND, OR, XOR, or CMP. The encodings of these operations are all | 1600 // AND, OR, XOR, or CMP. The encodings of these operations are all |
| 1557 // similar, differing just in the opcode or in the reg field of the | 1601 // similar, differing just in the opcode or in the reg field of the |
| 1558 // ModR/M byte. | 1602 // ModR/M byte. |
| 1559 void arithmetic_op_16(byte opcode, Register reg, Register rm_reg); | 1603 void arithmetic_op_16(byte opcode, Register reg, Register rm_reg); |
| 1560 void arithmetic_op_16(byte opcode, Register reg, const Operand& rm_reg); | 1604 void arithmetic_op_16(byte opcode, Register reg, const Operand& rm_reg); |
| 1561 void arithmetic_op_32(byte opcode, Register reg, Register rm_reg); | 1605 void arithmetic_op_32(byte opcode, Register reg, Register rm_reg); |
| 1562 void arithmetic_op_32(byte opcode, Register reg, const Operand& rm_reg); | 1606 void arithmetic_op_32(byte opcode, Register reg, const Operand& rm_reg); |
| 1563 void arithmetic_op(byte opcode, Register reg, Register rm_reg); | 1607 void arithmetic_op(byte opcode, Register reg, Register rm_reg); |
| 1564 void arithmetic_op(byte opcode, Register reg, const Operand& rm_reg); | 1608 void arithmetic_op(byte opcode, Register reg, const Operand& rm_reg); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1639 private: | 1683 private: |
| 1640 Assembler* assembler_; | 1684 Assembler* assembler_; |
| 1641 #ifdef DEBUG | 1685 #ifdef DEBUG |
| 1642 int space_before_; | 1686 int space_before_; |
| 1643 #endif | 1687 #endif |
| 1644 }; | 1688 }; |
| 1645 | 1689 |
| 1646 } } // namespace v8::internal | 1690 } } // namespace v8::internal |
| 1647 | 1691 |
| 1648 #endif // V8_X64_ASSEMBLER_X64_H_ | 1692 #endif // V8_X64_ASSEMBLER_X64_H_ |
| OLD | NEW |