| 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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 // Move the offset of the label location relative to the current | 716 // Move the offset of the label location relative to the current |
| 717 // position (after the move) to the destination. | 717 // position (after the move) to the destination. |
| 718 void movl(const Operand& dst, Label* src); | 718 void movl(const Operand& dst, Label* src); |
| 719 | 719 |
| 720 // Move sign extended immediate to memory location. | 720 // Move sign extended immediate to memory location. |
| 721 void movq(const Operand& dst, Immediate value); | 721 void movq(const Operand& dst, Immediate value); |
| 722 // Instructions to load a 64-bit immediate into a register. | 722 // Instructions to load a 64-bit immediate into a register. |
| 723 // All 64-bit immediates must have a relocation mode. | 723 // All 64-bit immediates must have a relocation mode. |
| 724 void movq(Register dst, void* ptr, RelocInfo::Mode rmode); | 724 void movq(Register dst, void* ptr, RelocInfo::Mode rmode); |
| 725 void movq(Register dst, int64_t value, RelocInfo::Mode rmode); | 725 void movq(Register dst, int64_t value, RelocInfo::Mode rmode); |
| 726 void movq(Register dst, const char* s, RelocInfo::Mode rmode); | |
| 727 // Moves the address of the external reference into the register. | 726 // Moves the address of the external reference into the register. |
| 728 void movq(Register dst, ExternalReference ext); | 727 void movq(Register dst, ExternalReference ext); |
| 729 void movq(Register dst, Handle<Object> handle, RelocInfo::Mode rmode); | 728 void movq(Register dst, Handle<Object> handle, RelocInfo::Mode rmode); |
| 730 | 729 |
| 731 void movsxbq(Register dst, const Operand& src); | 730 void movsxbq(Register dst, const Operand& src); |
| 732 void movsxwq(Register dst, const Operand& src); | 731 void movsxwq(Register dst, const Operand& src); |
| 733 void movsxlq(Register dst, Register src); | 732 void movsxlq(Register dst, Register src); |
| 734 void movsxlq(Register dst, const Operand& src); | 733 void movsxlq(Register dst, const Operand& src); |
| 735 void movzxbq(Register dst, const Operand& src); | 734 void movzxbq(Register dst, const Operand& src); |
| 736 void movzxbl(Register dst, const Operand& src); | 735 void movzxbl(Register dst, const Operand& src); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 749 void load_rax(void* ptr, RelocInfo::Mode rmode); | 748 void load_rax(void* ptr, RelocInfo::Mode rmode); |
| 750 void load_rax(ExternalReference ext); | 749 void load_rax(ExternalReference ext); |
| 751 | 750 |
| 752 // Conditional moves. | 751 // Conditional moves. |
| 753 void cmovq(Condition cc, Register dst, Register src); | 752 void cmovq(Condition cc, Register dst, Register src); |
| 754 void cmovq(Condition cc, Register dst, const Operand& src); | 753 void cmovq(Condition cc, Register dst, const Operand& src); |
| 755 void cmovl(Condition cc, Register dst, Register src); | 754 void cmovl(Condition cc, Register dst, Register src); |
| 756 void cmovl(Condition cc, Register dst, const Operand& src); | 755 void cmovl(Condition cc, Register dst, const Operand& src); |
| 757 | 756 |
| 758 // Exchange two registers | 757 // Exchange two registers |
| 759 void xchg(Register dst, Register src); | 758 void xchgq(Register dst, Register src); |
| 759 void xchgl(Register dst, Register src); |
| 760 | 760 |
| 761 // Arithmetics | 761 // Arithmetics |
| 762 void addl(Register dst, Register src) { | 762 void addl(Register dst, Register src) { |
| 763 arithmetic_op_32(0x03, dst, src); | 763 arithmetic_op_32(0x03, dst, src); |
| 764 } | 764 } |
| 765 | 765 |
| 766 void addl(Register dst, Immediate src) { | 766 void addl(Register dst, Immediate src) { |
| 767 immediate_arithmetic_op_32(0x0, dst, src); | 767 immediate_arithmetic_op_32(0x0, dst, src); |
| 768 } | 768 } |
| 769 | 769 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 } | 984 } |
| 985 | 985 |
| 986 void orl(Register dst, const Operand& src) { | 986 void orl(Register dst, const Operand& src) { |
| 987 arithmetic_op_32(0x0B, dst, src); | 987 arithmetic_op_32(0x0B, dst, src); |
| 988 } | 988 } |
| 989 | 989 |
| 990 void or_(const Operand& dst, Register src) { | 990 void or_(const Operand& dst, Register src) { |
| 991 arithmetic_op(0x09, src, dst); | 991 arithmetic_op(0x09, src, dst); |
| 992 } | 992 } |
| 993 | 993 |
| 994 void orl(const Operand& dst, Register src) { |
| 995 arithmetic_op_32(0x09, src, dst); |
| 996 } |
| 997 |
| 994 void or_(Register dst, Immediate src) { | 998 void or_(Register dst, Immediate src) { |
| 995 immediate_arithmetic_op(0x1, dst, src); | 999 immediate_arithmetic_op(0x1, dst, src); |
| 996 } | 1000 } |
| 997 | 1001 |
| 998 void orl(Register dst, Immediate src) { | 1002 void orl(Register dst, Immediate src) { |
| 999 immediate_arithmetic_op_32(0x1, dst, src); | 1003 immediate_arithmetic_op_32(0x1, dst, src); |
| 1000 } | 1004 } |
| 1001 | 1005 |
| 1002 void or_(const Operand& dst, Immediate src) { | 1006 void or_(const Operand& dst, Immediate src) { |
| 1003 immediate_arithmetic_op(0x1, dst, src); | 1007 immediate_arithmetic_op(0x1, dst, src); |
| 1004 } | 1008 } |
| 1005 | 1009 |
| 1006 void orl(const Operand& dst, Immediate src) { | 1010 void orl(const Operand& dst, Immediate src) { |
| 1007 immediate_arithmetic_op_32(0x1, dst, src); | 1011 immediate_arithmetic_op_32(0x1, dst, src); |
| 1008 } | 1012 } |
| 1009 | 1013 |
| 1010 | 1014 |
| 1011 void rcl(Register dst, Immediate imm8) { | 1015 void rcl(Register dst, Immediate imm8) { |
| 1012 shift(dst, imm8, 0x2); | 1016 shift(dst, imm8, 0x2); |
| 1013 } | 1017 } |
| 1014 | 1018 |
| 1015 void rol(Register dst, Immediate imm8) { | 1019 void rol(Register dst, Immediate imm8) { |
| 1016 shift(dst, imm8, 0x0); | 1020 shift(dst, imm8, 0x0); |
| 1017 } | 1021 } |
| 1018 | 1022 |
| 1023 void roll(Register dst, Immediate imm8) { |
| 1024 shift_32(dst, imm8, 0x0); |
| 1025 } |
| 1026 |
| 1019 void rcr(Register dst, Immediate imm8) { | 1027 void rcr(Register dst, Immediate imm8) { |
| 1020 shift(dst, imm8, 0x3); | 1028 shift(dst, imm8, 0x3); |
| 1021 } | 1029 } |
| 1022 | 1030 |
| 1023 void ror(Register dst, Immediate imm8) { | 1031 void ror(Register dst, Immediate imm8) { |
| 1024 shift(dst, imm8, 0x1); | 1032 shift(dst, imm8, 0x1); |
| 1025 } | 1033 } |
| 1026 | 1034 |
| 1027 void rorl(Register dst, Immediate imm8) { | 1035 void rorl(Register dst, Immediate imm8) { |
| 1028 shift_32(dst, imm8, 0x1); | 1036 shift_32(dst, imm8, 0x1); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1116 } | 1124 } |
| 1117 | 1125 |
| 1118 void subl(Register dst, Register src) { | 1126 void subl(Register dst, Register src) { |
| 1119 arithmetic_op_32(0x2B, dst, src); | 1127 arithmetic_op_32(0x2B, dst, src); |
| 1120 } | 1128 } |
| 1121 | 1129 |
| 1122 void subl(Register dst, const Operand& src) { | 1130 void subl(Register dst, const Operand& src) { |
| 1123 arithmetic_op_32(0x2B, dst, src); | 1131 arithmetic_op_32(0x2B, dst, src); |
| 1124 } | 1132 } |
| 1125 | 1133 |
| 1134 void subl(const Operand& dst, Register src) { |
| 1135 arithmetic_op_32(0x29, src, dst); |
| 1136 } |
| 1137 |
| 1126 void subl(const Operand& dst, Immediate src) { | 1138 void subl(const Operand& dst, Immediate src) { |
| 1127 immediate_arithmetic_op_32(0x5, dst, src); | 1139 immediate_arithmetic_op_32(0x5, dst, src); |
| 1128 } | 1140 } |
| 1129 | 1141 |
| 1130 void subl(Register dst, Immediate src) { | 1142 void subl(Register dst, Immediate src) { |
| 1131 immediate_arithmetic_op_32(0x5, dst, src); | 1143 immediate_arithmetic_op_32(0x5, dst, src); |
| 1132 } | 1144 } |
| 1133 | 1145 |
| 1134 void subb(Register dst, Immediate src) { | 1146 void subb(Register dst, Immediate src) { |
| 1135 immediate_arithmetic_op_8(0x5, dst, src); | 1147 immediate_arithmetic_op_8(0x5, dst, src); |
| 1136 } | 1148 } |
| 1137 | 1149 |
| 1138 void testb(Register dst, Register src); | 1150 void testb(Register dst, Register src); |
| 1139 void testb(Register reg, Immediate mask); | 1151 void testb(Register reg, Immediate mask); |
| 1140 void testb(const Operand& op, Immediate mask); | 1152 void testb(const Operand& op, Immediate mask); |
| 1141 void testb(const Operand& op, Register reg); | 1153 void testb(const Operand& op, Register reg); |
| 1142 void testl(Register dst, Register src); | 1154 void testl(Register dst, Register src); |
| 1143 void testl(Register reg, Immediate mask); | 1155 void testl(Register reg, Immediate mask); |
| 1156 void testl(const Operand& op, Register reg); |
| 1144 void testl(const Operand& op, Immediate mask); | 1157 void testl(const Operand& op, Immediate mask); |
| 1145 void testq(const Operand& op, Register reg); | 1158 void testq(const Operand& op, Register reg); |
| 1146 void testq(Register dst, Register src); | 1159 void testq(Register dst, Register src); |
| 1147 void testq(Register dst, Immediate mask); | 1160 void testq(Register dst, Immediate mask); |
| 1148 | 1161 |
| 1149 void xor_(Register dst, Register src) { | 1162 void xor_(Register dst, Register src) { |
| 1150 if (dst.code() == src.code()) { | 1163 if (dst.code() == src.code()) { |
| 1151 arithmetic_op_32(0x33, dst, src); | 1164 arithmetic_op_32(0x33, dst, src); |
| 1152 } else { | 1165 } else { |
| 1153 arithmetic_op(0x33, dst, src); | 1166 arithmetic_op(0x33, dst, src); |
| 1154 } | 1167 } |
| 1155 } | 1168 } |
| 1156 | 1169 |
| 1157 void xorl(Register dst, Register src) { | 1170 void xorl(Register dst, Register src) { |
| 1158 arithmetic_op_32(0x33, dst, src); | 1171 arithmetic_op_32(0x33, dst, src); |
| 1159 } | 1172 } |
| 1160 | 1173 |
| 1161 void xorl(Register dst, const Operand& src) { | 1174 void xorl(Register dst, const Operand& src) { |
| 1162 arithmetic_op_32(0x33, dst, src); | 1175 arithmetic_op_32(0x33, dst, src); |
| 1163 } | 1176 } |
| 1164 | 1177 |
| 1165 void xorl(Register dst, Immediate src) { | 1178 void xorl(Register dst, Immediate src) { |
| 1166 immediate_arithmetic_op_32(0x6, dst, src); | 1179 immediate_arithmetic_op_32(0x6, dst, src); |
| 1167 } | 1180 } |
| 1168 | 1181 |
| 1182 void xorl(const Operand& dst, Register src) { |
| 1183 arithmetic_op_32(0x31, src, dst); |
| 1184 } |
| 1185 |
| 1169 void xorl(const Operand& dst, Immediate src) { | 1186 void xorl(const Operand& dst, Immediate src) { |
| 1170 immediate_arithmetic_op_32(0x6, dst, src); | 1187 immediate_arithmetic_op_32(0x6, dst, src); |
| 1171 } | 1188 } |
| 1172 | 1189 |
| 1173 void xor_(Register dst, const Operand& src) { | 1190 void xor_(Register dst, const Operand& src) { |
| 1174 arithmetic_op(0x33, dst, src); | 1191 arithmetic_op(0x33, dst, src); |
| 1175 } | 1192 } |
| 1176 | 1193 |
| 1177 void xor_(const Operand& dst, Register src) { | 1194 void xor_(const Operand& dst, Register src) { |
| 1178 arithmetic_op(0x31, src, dst); | 1195 arithmetic_op(0x31, src, dst); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 void long_at_put(int pos, uint32_t x) { | 1484 void long_at_put(int pos, uint32_t x) { |
| 1468 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; | 1485 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; |
| 1469 } | 1486 } |
| 1470 | 1487 |
| 1471 // code emission | 1488 // code emission |
| 1472 void GrowBuffer(); | 1489 void GrowBuffer(); |
| 1473 | 1490 |
| 1474 void emit(byte x) { *pc_++ = x; } | 1491 void emit(byte x) { *pc_++ = x; } |
| 1475 inline void emitl(uint32_t x); | 1492 inline void emitl(uint32_t x); |
| 1476 inline void emitp(void* x, RelocInfo::Mode rmode); | 1493 inline void emitp(void* x, RelocInfo::Mode rmode); |
| 1477 inline void emitq(uint64_t x, RelocInfo::Mode rmode); | 1494 inline void emitq(uint64_t x); |
| 1478 inline void emitw(uint16_t x); | 1495 inline void emitw(uint16_t x); |
| 1479 inline void emit_code_target(Handle<Code> target, | 1496 inline void emit_code_target(Handle<Code> target, |
| 1480 RelocInfo::Mode rmode, | 1497 RelocInfo::Mode rmode, |
| 1481 TypeFeedbackId ast_id = TypeFeedbackId::None()); | 1498 TypeFeedbackId ast_id = TypeFeedbackId::None()); |
| 1482 inline void emit_runtime_entry(Address entry, RelocInfo::Mode rmode); | 1499 inline void emit_runtime_entry(Address entry, RelocInfo::Mode rmode); |
| 1483 void emit(Immediate x) { emitl(x.value_); } | 1500 void emit(Immediate x) { emitl(x.value_); } |
| 1484 | 1501 |
| 1485 // Emits a REX prefix that encodes a 64-bit operand size and | 1502 // Emits a REX prefix that encodes a 64-bit operand size and |
| 1486 // the top bit of both register codes. | 1503 // the top bit of both register codes. |
| 1487 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. | 1504 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1681 private: | 1698 private: |
| 1682 Assembler* assembler_; | 1699 Assembler* assembler_; |
| 1683 #ifdef DEBUG | 1700 #ifdef DEBUG |
| 1684 int space_before_; | 1701 int space_before_; |
| 1685 #endif | 1702 #endif |
| 1686 }; | 1703 }; |
| 1687 | 1704 |
| 1688 } } // namespace v8::internal | 1705 } } // namespace v8::internal |
| 1689 | 1706 |
| 1690 #endif // V8_X64_ASSEMBLER_X64_H_ | 1707 #endif // V8_X64_ASSEMBLER_X64_H_ |
| OLD | NEW |