| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // to a few constants). If this is a problem, we could change the code | 63 // to a few constants). If this is a problem, we could change the code |
| 64 // such that we use an enum in optimized mode, and the struct in debug | 64 // such that we use an enum in optimized mode, and the struct in debug |
| 65 // mode. This way we get the compile-time error checking in debug mode | 65 // mode. This way we get the compile-time error checking in debug mode |
| 66 // and best performance in optimized code. | 66 // and best performance in optimized code. |
| 67 // | 67 // |
| 68 | 68 |
| 69 struct Register { | 69 struct Register { |
| 70 // The non-allocatable registers are: | 70 // The non-allocatable registers are: |
| 71 // rsp - stack pointer | 71 // rsp - stack pointer |
| 72 // rbp - frame pointer | 72 // rbp - frame pointer |
| 73 // rsi - context register | |
| 74 // r10 - fixed scratch register | 73 // r10 - fixed scratch register |
| 75 // r12 - smi constant register | 74 // r12 - smi constant register |
| 76 // r13 - root register | 75 // r13 - root register |
| 77 static const int kMaxNumAllocatableRegisters = 10; | 76 static const int kMaxNumAllocatableRegisters = 11; |
| 78 static int NumAllocatableRegisters() { | 77 static int NumAllocatableRegisters() { |
| 79 return kMaxNumAllocatableRegisters; | 78 return kMaxNumAllocatableRegisters; |
| 80 } | 79 } |
| 81 static const int kNumRegisters = 16; | 80 static const int kNumRegisters = 16; |
| 82 | 81 |
| 83 static int ToAllocationIndex(Register reg) { | 82 static int ToAllocationIndex(Register reg) { |
| 84 return kAllocationIndexByRegisterCode[reg.code()]; | 83 return kAllocationIndexByRegisterCode[reg.code()]; |
| 85 } | 84 } |
| 86 | 85 |
| 87 static Register FromAllocationIndex(int index) { | 86 static Register FromAllocationIndex(int index) { |
| 88 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); | 87 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); |
| 89 Register result = { kRegisterCodeByAllocationIndex[index] }; | 88 Register result = { kRegisterCodeByAllocationIndex[index] }; |
| 90 return result; | 89 return result; |
| 91 } | 90 } |
| 92 | 91 |
| 93 static const char* AllocationIndexToString(int index) { | 92 static const char* AllocationIndexToString(int index) { |
| 94 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); | 93 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); |
| 95 const char* const names[] = { | 94 const char* const names[] = { |
| 96 "rax", | 95 "rax", |
| 97 "rbx", | 96 "rbx", |
| 98 "rdx", | 97 "rdx", |
| 99 "rcx", | 98 "rcx", |
| 99 "rsi", |
| 100 "rdi", | 100 "rdi", |
| 101 "r8", | 101 "r8", |
| 102 "r9", | 102 "r9", |
| 103 "r11", | 103 "r11", |
| 104 "r14", | 104 "r14", |
| 105 "r15" | 105 "r15" |
| 106 }; | 106 }; |
| 107 return names[index]; | 107 return names[index]; |
| 108 } | 108 } |
| 109 | 109 |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 void leave(); | 670 void leave(); |
| 671 | 671 |
| 672 // Moves | 672 // Moves |
| 673 void movb(Register dst, const Operand& src); | 673 void movb(Register dst, const Operand& src); |
| 674 void movb(Register dst, Immediate imm); | 674 void movb(Register dst, Immediate imm); |
| 675 void movb(const Operand& dst, Register src); | 675 void movb(const Operand& dst, Register src); |
| 676 void movb(const Operand& dst, Immediate imm); | 676 void movb(const Operand& dst, Immediate imm); |
| 677 | 677 |
| 678 // Move the low 16 bits of a 64-bit register value to a 16-bit | 678 // Move the low 16 bits of a 64-bit register value to a 16-bit |
| 679 // memory location. | 679 // memory location. |
| 680 void movw(Register dst, const Operand& src); |
| 680 void movw(const Operand& dst, Register src); | 681 void movw(const Operand& dst, Register src); |
| 681 void movw(const Operand& dst, Immediate imm); | 682 void movw(const Operand& dst, Immediate imm); |
| 682 | 683 |
| 683 void movl(Register dst, Register src); | 684 void movl(Register dst, Register src); |
| 684 void movl(Register dst, const Operand& src); | 685 void movl(Register dst, const Operand& src); |
| 685 void movl(const Operand& dst, Register src); | 686 void movl(const Operand& dst, Register src); |
| 686 void movl(const Operand& dst, Immediate imm); | 687 void movl(const Operand& dst, Immediate imm); |
| 687 // Load a 32-bit immediate value, zero-extended to 64 bits. | 688 // Load a 32-bit immediate value, zero-extended to 64 bits. |
| 688 void movl(Register dst, Immediate imm32); | 689 void movl(Register dst, Immediate imm32); |
| 689 | 690 |
| 690 // Move 64 bit register value to 64-bit memory location. | 691 // Move 64 bit register value to 64-bit memory location. |
| 691 void movq(const Operand& dst, Register src); | 692 void movq(const Operand& dst, Register src); |
| 692 // Move 64 bit memory location to 64-bit register value. | 693 // Move 64 bit memory location to 64-bit register value. |
| 693 void movq(Register dst, const Operand& src); | 694 void movq(Register dst, const Operand& src); |
| 694 void movq(Register dst, Register src); | 695 void movq(Register dst, Register src); |
| 695 // Sign extends immediate 32-bit value to 64 bits. | 696 // Sign extends immediate 32-bit value to 64 bits. |
| 696 void movq(Register dst, Immediate x); | 697 void movq(Register dst, Immediate x); |
| 697 // Move the offset of the label location relative to the current | 698 // Move the offset of the label location relative to the current |
| 698 // position (after the move) to the destination. | 699 // position (after the move) to the destination. |
| 699 void movl(const Operand& dst, Label* src); | 700 void movl(const Operand& dst, Label* src); |
| 700 | 701 |
| 701 // Move sign extended immediate to memory location. | 702 // Move sign extended immediate to memory location. |
| 702 void movq(const Operand& dst, Immediate value); | 703 void movq(const Operand& dst, Immediate value); |
| 703 // Instructions to load a 64-bit immediate into a register. | 704 // Loads a pointer into a register with a relocation mode. |
| 704 // All 64-bit immediates must have a relocation mode. | |
| 705 void movq(Register dst, void* ptr, RelocInfo::Mode rmode); | 705 void movq(Register dst, void* ptr, RelocInfo::Mode rmode); |
| 706 void movq(Register dst, int64_t value, RelocInfo::Mode rmode); | 706 // Loads a 64-bit immediate into a register. |
| 707 // Moves the address of the external reference into the register. | 707 void movq(Register dst, int64_t value); |
| 708 void movq(Register dst, ExternalReference ext); | |
| 709 void movq(Register dst, Handle<Object> handle, RelocInfo::Mode rmode); | 708 void movq(Register dst, Handle<Object> handle, RelocInfo::Mode rmode); |
| 710 | 709 |
| 711 void movsxbq(Register dst, const Operand& src); | 710 void movsxbq(Register dst, const Operand& src); |
| 712 void movsxwq(Register dst, const Operand& src); | 711 void movsxwq(Register dst, const Operand& src); |
| 713 void movsxlq(Register dst, Register src); | 712 void movsxlq(Register dst, Register src); |
| 714 void movsxlq(Register dst, const Operand& src); | 713 void movsxlq(Register dst, const Operand& src); |
| 715 void movzxbq(Register dst, const Operand& src); | 714 void movzxbq(Register dst, const Operand& src); |
| 716 void movzxbl(Register dst, const Operand& src); | 715 void movzxbl(Register dst, const Operand& src); |
| 717 void movzxwq(Register dst, const Operand& src); | 716 void movzxwq(Register dst, const Operand& src); |
| 718 void movzxwl(Register dst, const Operand& src); | 717 void movzxwl(Register dst, const Operand& src); |
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1686 private: | 1685 private: |
| 1687 Assembler* assembler_; | 1686 Assembler* assembler_; |
| 1688 #ifdef DEBUG | 1687 #ifdef DEBUG |
| 1689 int space_before_; | 1688 int space_before_; |
| 1690 #endif | 1689 #endif |
| 1691 }; | 1690 }; |
| 1692 | 1691 |
| 1693 } } // namespace v8::internal | 1692 } } // namespace v8::internal |
| 1694 | 1693 |
| 1695 #endif // V8_X64_ASSEMBLER_X64_H_ | 1694 #endif // V8_X64_ASSEMBLER_X64_H_ |
| OLD | NEW |