| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 414 |
| 415 // Adds operand displacement fields (offsets added to the memory address). | 415 // Adds operand displacement fields (offsets added to the memory address). |
| 416 // Needs to be called after set_sib, not before it. | 416 // Needs to be called after set_sib, not before it. |
| 417 inline void set_disp8(int disp); | 417 inline void set_disp8(int disp); |
| 418 inline void set_disp32(int disp); | 418 inline void set_disp32(int disp); |
| 419 inline void set_disp64(int64_t disp); // for labels. | 419 inline void set_disp64(int64_t disp); // for labels. |
| 420 | 420 |
| 421 friend class Assembler; | 421 friend class Assembler; |
| 422 }; | 422 }; |
| 423 | 423 |
| 424 | |
| 425 #define ASSEMBLER_INSTRUCTION_LIST(V) \ | 424 #define ASSEMBLER_INSTRUCTION_LIST(V) \ |
| 426 V(add) \ | 425 V(add) \ |
| 427 V(and) \ | 426 V(and) \ |
| 428 V(cmp) \ | 427 V(cmp) \ |
| 428 V(cmpxchg) \ |
| 429 V(dec) \ | 429 V(dec) \ |
| 430 V(idiv) \ | 430 V(idiv) \ |
| 431 V(div) \ | 431 V(div) \ |
| 432 V(imul) \ | 432 V(imul) \ |
| 433 V(inc) \ | 433 V(inc) \ |
| 434 V(lea) \ | 434 V(lea) \ |
| 435 V(mov) \ | 435 V(mov) \ |
| 436 V(movzxb) \ | 436 V(movzxb) \ |
| 437 V(movzxw) \ | 437 V(movzxw) \ |
| 438 V(neg) \ | 438 V(neg) \ |
| 439 V(not) \ | 439 V(not) \ |
| 440 V(or) \ | 440 V(or) \ |
| 441 V(repmovs) \ | 441 V(repmovs) \ |
| 442 V(sbb) \ | 442 V(sbb) \ |
| 443 V(sub) \ | 443 V(sub) \ |
| 444 V(test) \ | 444 V(test) \ |
| 445 V(xchg) \ | 445 V(xchg) \ |
| 446 V(xor) | 446 V(xor) |
| 447 | 447 |
| 448 | |
| 449 // Shift instructions on operands/registers with kPointerSize, kInt32Size and | 448 // Shift instructions on operands/registers with kPointerSize, kInt32Size and |
| 450 // kInt64Size. | 449 // kInt64Size. |
| 451 #define SHIFT_INSTRUCTION_LIST(V) \ | 450 #define SHIFT_INSTRUCTION_LIST(V) \ |
| 452 V(rol, 0x0) \ | 451 V(rol, 0x0) \ |
| 453 V(ror, 0x1) \ | 452 V(ror, 0x1) \ |
| 454 V(rcl, 0x2) \ | 453 V(rcl, 0x2) \ |
| 455 V(rcr, 0x3) \ | 454 V(rcr, 0x3) \ |
| 456 V(shl, 0x4) \ | 455 V(shl, 0x4) \ |
| 457 V(shr, 0x5) \ | 456 V(shr, 0x5) \ |
| 458 V(sar, 0x7) \ | 457 V(sar, 0x7) \ |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 | 780 |
| 782 void testw(Register reg, const Operand& op) { testw(op, reg); } | 781 void testw(Register reg, const Operand& op) { testw(op, reg); } |
| 783 | 782 |
| 784 void andb(Register dst, Immediate src) { | 783 void andb(Register dst, Immediate src) { |
| 785 immediate_arithmetic_op_8(0x4, dst, src); | 784 immediate_arithmetic_op_8(0x4, dst, src); |
| 786 } | 785 } |
| 787 | 786 |
| 788 void decb(Register dst); | 787 void decb(Register dst); |
| 789 void decb(const Operand& dst); | 788 void decb(const Operand& dst); |
| 790 | 789 |
| 790 // Lock prefix. |
| 791 void lock(); |
| 792 |
| 791 void xchgb(Register reg, const Operand& op); | 793 void xchgb(Register reg, const Operand& op); |
| 792 void xchgw(Register reg, const Operand& op); | 794 void xchgw(Register reg, const Operand& op); |
| 793 | 795 |
| 796 void cmpxchgb(const Operand& dst, Register src); |
| 797 void cmpxchgw(const Operand& dst, Register src); |
| 798 |
| 794 // Sign-extends rax into rdx:rax. | 799 // Sign-extends rax into rdx:rax. |
| 795 void cqo(); | 800 void cqo(); |
| 796 // Sign-extends eax into edx:eax. | 801 // Sign-extends eax into edx:eax. |
| 797 void cdq(); | 802 void cdq(); |
| 798 | 803 |
| 799 // Multiply eax by src, put the result in edx:eax. | 804 // Multiply eax by src, put the result in edx:eax. |
| 800 void mull(Register src); | 805 void mull(Register src); |
| 801 void mull(const Operand& src); | 806 void mull(const Operand& src); |
| 802 // Multiply rax by src, put the result in rdx:rax. | 807 // Multiply rax by src, put the result in rdx:rax. |
| 803 void mulq(Register src); | 808 void mulq(Register src); |
| (...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2047 } | 2052 } |
| 2048 | 2053 |
| 2049 void emit_cmp(Register dst, Immediate src, int size) { | 2054 void emit_cmp(Register dst, Immediate src, int size) { |
| 2050 immediate_arithmetic_op(0x7, dst, src, size); | 2055 immediate_arithmetic_op(0x7, dst, src, size); |
| 2051 } | 2056 } |
| 2052 | 2057 |
| 2053 void emit_cmp(const Operand& dst, Immediate src, int size) { | 2058 void emit_cmp(const Operand& dst, Immediate src, int size) { |
| 2054 immediate_arithmetic_op(0x7, dst, src, size); | 2059 immediate_arithmetic_op(0x7, dst, src, size); |
| 2055 } | 2060 } |
| 2056 | 2061 |
| 2062 // Compare {al,ax,eax,rax} with src. If equal, set ZF and write dst into |
| 2063 // src. Otherwise clear ZF and write src into {al,ax,eax,rax}. This |
| 2064 // operation is only atomic if prefixed by the lock instruction. |
| 2065 void emit_cmpxchg(const Operand& dst, Register src, int size); |
| 2066 |
| 2057 void emit_dec(Register dst, int size); | 2067 void emit_dec(Register dst, int size); |
| 2058 void emit_dec(const Operand& dst, int size); | 2068 void emit_dec(const Operand& dst, int size); |
| 2059 | 2069 |
| 2060 // Divide rdx:rax by src. Quotient in rax, remainder in rdx when size is 64. | 2070 // Divide rdx:rax by src. Quotient in rax, remainder in rdx when size is 64. |
| 2061 // Divide edx:eax by lower 32 bits of src. Quotient in eax, remainder in edx | 2071 // Divide edx:eax by lower 32 bits of src. Quotient in eax, remainder in edx |
| 2062 // when size is 32. | 2072 // when size is 32. |
| 2063 void emit_idiv(Register src, int size); | 2073 void emit_idiv(Register src, int size); |
| 2064 void emit_div(Register src, int size); | 2074 void emit_div(Register src, int size); |
| 2065 | 2075 |
| 2066 // Signed multiply instructions. | 2076 // Signed multiply instructions. |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2232 Assembler* assembler_; | 2242 Assembler* assembler_; |
| 2233 #ifdef DEBUG | 2243 #ifdef DEBUG |
| 2234 int space_before_; | 2244 int space_before_; |
| 2235 #endif | 2245 #endif |
| 2236 }; | 2246 }; |
| 2237 | 2247 |
| 2238 } // namespace internal | 2248 } // namespace internal |
| 2239 } // namespace v8 | 2249 } // namespace v8 |
| 2240 | 2250 |
| 2241 #endif // V8_X64_ASSEMBLER_X64_H_ | 2251 #endif // V8_X64_ASSEMBLER_X64_H_ |
| OLD | NEW |