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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 above = 7, | 215 above = 7, |
216 negative = 8, | 216 negative = 8, |
217 positive = 9, | 217 positive = 9, |
218 parity_even = 10, | 218 parity_even = 10, |
219 parity_odd = 11, | 219 parity_odd = 11, |
220 less = 12, | 220 less = 12, |
221 greater_equal = 13, | 221 greater_equal = 13, |
222 less_equal = 14, | 222 less_equal = 14, |
223 greater = 15, | 223 greater = 15, |
224 | 224 |
| 225 // Fake conditions that are handled by the |
| 226 // opcodes using them. |
| 227 always = 16, |
| 228 never = 17, |
225 // aliases | 229 // aliases |
226 carry = below, | 230 carry = below, |
227 not_carry = above_equal, | 231 not_carry = above_equal, |
228 zero = equal, | 232 zero = equal, |
229 not_zero = not_equal, | 233 not_zero = not_equal, |
230 sign = negative, | 234 sign = negative, |
231 not_sign = positive | 235 not_sign = positive, |
| 236 last_condition = greater |
232 }; | 237 }; |
233 | 238 |
234 | 239 |
235 // Returns the equivalent of !cc. | 240 // Returns the equivalent of !cc. |
236 // Negation of the default no_condition (-1) results in a non-default | 241 // Negation of the default no_condition (-1) results in a non-default |
237 // no_condition value (-2). As long as tests for no_condition check | 242 // no_condition value (-2). As long as tests for no_condition check |
238 // for condition < 0, this will work as expected. | 243 // for condition < 0, this will work as expected. |
239 inline Condition NegateCondition(Condition cc); | 244 inline Condition NegateCondition(Condition cc); |
240 | 245 |
241 // Corresponds to transposing the operands of a comparison. | 246 // Corresponds to transposing the operands of a comparison. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 : ((hint == not_taken) ? taken : not_taken); | 282 : ((hint == not_taken) ? taken : not_taken); |
278 } | 283 } |
279 | 284 |
280 | 285 |
281 // ----------------------------------------------------------------------------- | 286 // ----------------------------------------------------------------------------- |
282 // Machine instruction Immediates | 287 // Machine instruction Immediates |
283 | 288 |
284 class Immediate BASE_EMBEDDED { | 289 class Immediate BASE_EMBEDDED { |
285 public: | 290 public: |
286 explicit Immediate(int32_t value) : value_(value) {} | 291 explicit Immediate(int32_t value) : value_(value) {} |
287 inline explicit Immediate(Smi* value); | |
288 | 292 |
289 private: | 293 private: |
290 int32_t value_; | 294 int32_t value_; |
291 | 295 |
292 friend class Assembler; | 296 friend class Assembler; |
293 }; | 297 }; |
294 | 298 |
295 | 299 |
296 // ----------------------------------------------------------------------------- | 300 // ----------------------------------------------------------------------------- |
297 // Machine instruction Operands | 301 // Machine instruction Operands |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 } | 696 } |
693 | 697 |
694 void and_(const Operand& dst, Immediate src) { | 698 void and_(const Operand& dst, Immediate src) { |
695 immediate_arithmetic_op(0x4, dst, src); | 699 immediate_arithmetic_op(0x4, dst, src); |
696 } | 700 } |
697 | 701 |
698 void andl(Register dst, Immediate src) { | 702 void andl(Register dst, Immediate src) { |
699 immediate_arithmetic_op_32(0x4, dst, src); | 703 immediate_arithmetic_op_32(0x4, dst, src); |
700 } | 704 } |
701 | 705 |
| 706 void andl(Register dst, Register src) { |
| 707 arithmetic_op_32(0x23, dst, src); |
| 708 } |
| 709 |
| 710 |
702 void decq(Register dst); | 711 void decq(Register dst); |
703 void decq(const Operand& dst); | 712 void decq(const Operand& dst); |
704 void decl(Register dst); | 713 void decl(Register dst); |
705 void decl(const Operand& dst); | 714 void decl(const Operand& dst); |
706 void decb(Register dst); | 715 void decb(Register dst); |
707 void decb(const Operand& dst); | 716 void decb(const Operand& dst); |
708 | 717 |
709 // Sign-extends rax into rdx:rax. | 718 // Sign-extends rax into rdx:rax. |
710 void cqo(); | 719 void cqo(); |
711 // Sign-extends eax into edx:eax. | 720 // Sign-extends eax into edx:eax. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 } | 762 } |
754 | 763 |
755 void or_(const Operand& dst, Register src) { | 764 void or_(const Operand& dst, Register src) { |
756 arithmetic_op(0x09, src, dst); | 765 arithmetic_op(0x09, src, dst); |
757 } | 766 } |
758 | 767 |
759 void or_(Register dst, Immediate src) { | 768 void or_(Register dst, Immediate src) { |
760 immediate_arithmetic_op(0x1, dst, src); | 769 immediate_arithmetic_op(0x1, dst, src); |
761 } | 770 } |
762 | 771 |
| 772 void orl(Register dst, Immediate src) { |
| 773 immediate_arithmetic_op_32(0x1, dst, src); |
| 774 } |
| 775 |
763 void or_(const Operand& dst, Immediate src) { | 776 void or_(const Operand& dst, Immediate src) { |
764 immediate_arithmetic_op(0x1, dst, src); | 777 immediate_arithmetic_op(0x1, dst, src); |
765 } | 778 } |
766 | 779 |
| 780 void orl(const Operand& dst, Immediate src) { |
| 781 immediate_arithmetic_op_32(0x1, dst, src); |
| 782 } |
767 | 783 |
768 void rcl(Register dst, uint8_t imm8); | 784 |
| 785 void rcl(Register dst, Immediate imm8) { |
| 786 shift(dst, imm8, 0x2); |
| 787 } |
| 788 |
| 789 void rol(Register dst, Immediate imm8) { |
| 790 shift(dst, imm8, 0x0); |
| 791 } |
| 792 |
| 793 void rcr(Register dst, Immediate imm8) { |
| 794 shift(dst, imm8, 0x3); |
| 795 } |
| 796 |
| 797 void ror(Register dst, Immediate imm8) { |
| 798 shift(dst, imm8, 0x1); |
| 799 } |
769 | 800 |
770 // Shifts dst:src left by cl bits, affecting only dst. | 801 // Shifts dst:src left by cl bits, affecting only dst. |
771 void shld(Register dst, Register src); | 802 void shld(Register dst, Register src); |
772 | 803 |
773 // Shifts src:dst right by cl bits, affecting only dst. | 804 // Shifts src:dst right by cl bits, affecting only dst. |
774 void shrd(Register dst, Register src); | 805 void shrd(Register dst, Register src); |
775 | 806 |
776 // Shifts dst right, duplicating sign bit, by shift_amount bits. | 807 // Shifts dst right, duplicating sign bit, by shift_amount bits. |
777 // Shifting by 1 is handled efficiently. | 808 // Shifting by 1 is handled efficiently. |
778 void sar(Register dst, Immediate shift_amount) { | 809 void sar(Register dst, Immediate shift_amount) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 } | 890 } |
860 | 891 |
861 void subl(Register dst, Immediate src) { | 892 void subl(Register dst, Immediate src) { |
862 immediate_arithmetic_op_32(0x5, dst, src); | 893 immediate_arithmetic_op_32(0x5, dst, src); |
863 } | 894 } |
864 | 895 |
865 void subb(Register dst, Immediate src) { | 896 void subb(Register dst, Immediate src) { |
866 immediate_arithmetic_op_8(0x5, dst, src); | 897 immediate_arithmetic_op_8(0x5, dst, src); |
867 } | 898 } |
868 | 899 |
| 900 void testb(Register dst, Register src); |
869 void testb(Register reg, Immediate mask); | 901 void testb(Register reg, Immediate mask); |
870 void testb(const Operand& op, Immediate mask); | 902 void testb(const Operand& op, Immediate mask); |
871 void testl(Register dst, Register src); | 903 void testl(Register dst, Register src); |
872 void testl(Register reg, Immediate mask); | 904 void testl(Register reg, Immediate mask); |
873 void testl(const Operand& op, Immediate mask); | 905 void testl(const Operand& op, Immediate mask); |
874 void testq(const Operand& op, Register reg); | 906 void testq(const Operand& op, Register reg); |
875 void testq(Register dst, Register src); | 907 void testq(Register dst, Register src); |
876 void testq(Register dst, Immediate mask); | 908 void testq(Register dst, Immediate mask); |
877 | 909 |
878 void xor_(Register dst, Register src) { | 910 void xor_(Register dst, Register src) { |
(...skipping 18 matching lines...) Expand all Loading... |
897 | 929 |
898 void xor_(const Operand& dst, Immediate src) { | 930 void xor_(const Operand& dst, Immediate src) { |
899 immediate_arithmetic_op(0x6, dst, src); | 931 immediate_arithmetic_op(0x6, dst, src); |
900 } | 932 } |
901 | 933 |
902 // Bit operations. | 934 // Bit operations. |
903 void bt(const Operand& dst, Register src); | 935 void bt(const Operand& dst, Register src); |
904 void bts(const Operand& dst, Register src); | 936 void bts(const Operand& dst, Register src); |
905 | 937 |
906 // Miscellaneous | 938 // Miscellaneous |
| 939 void clc(); |
907 void cpuid(); | 940 void cpuid(); |
908 void hlt(); | 941 void hlt(); |
909 void int3(); | 942 void int3(); |
910 void nop(); | 943 void nop(); |
911 void nop(int n); | 944 void nop(int n); |
912 void rdtsc(); | 945 void rdtsc(); |
913 void ret(int imm16); | 946 void ret(int imm16); |
914 void setcc(Condition cc, Register reg); | 947 void setcc(Condition cc, Register reg); |
915 | 948 |
916 // Label operations & relative jumps (PPUM Appendix D) | 949 // Label operations & relative jumps (PPUM Appendix D) |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 private: | 1350 private: |
1318 Assembler* assembler_; | 1351 Assembler* assembler_; |
1319 #ifdef DEBUG | 1352 #ifdef DEBUG |
1320 int space_before_; | 1353 int space_before_; |
1321 #endif | 1354 #endif |
1322 }; | 1355 }; |
1323 | 1356 |
1324 } } // namespace v8::internal | 1357 } } // namespace v8::internal |
1325 | 1358 |
1326 #endif // V8_X64_ASSEMBLER_X64_H_ | 1359 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |