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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // rsp - stack pointer | 92 // rsp - stack pointer |
93 // rbp - frame pointer | 93 // rbp - frame pointer |
94 // rsi - context register | 94 // rsi - context register |
95 // r10 - fixed scratch register | 95 // r10 - fixed scratch register |
96 // r13 - root register | 96 // r13 - root register |
97 // r15 - smi constant register | 97 // r15 - smi constant register |
98 static const int kNumRegisters = 16; | 98 static const int kNumRegisters = 16; |
99 static const int kNumAllocatableRegisters = 10; | 99 static const int kNumAllocatableRegisters = 10; |
100 | 100 |
101 static int ToAllocationIndex(Register reg) { | 101 static int ToAllocationIndex(Register reg) { |
102 return allocationIndexByRegisterCode[reg.code()]; | 102 return kAllocationIndexByRegisterCode[reg.code()]; |
103 } | 103 } |
104 | 104 |
105 static Register FromAllocationIndex(int index) { | 105 static Register FromAllocationIndex(int index) { |
106 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 106 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
107 Register result = { registerCodeByAllocationIndex[index] }; | 107 Register result = { kRegisterCodeByAllocationIndex[index] }; |
108 return result; | 108 return result; |
109 } | 109 } |
110 | 110 |
| 111 static int ToRspIndexForPushAll(Register reg) { |
| 112 return kRspIndexForPushAllByRegisterCode[reg.code()]; |
| 113 } |
| 114 |
111 static const char* AllocationIndexToString(int index) { | 115 static const char* AllocationIndexToString(int index) { |
112 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 116 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
113 const char* const names[] = { | 117 const char* const names[] = { |
114 "rax", | 118 "rax", |
115 "rbx", | 119 "rbx", |
116 "rdx", | 120 "rdx", |
117 "rcx", | 121 "rcx", |
118 "rdi", | 122 "rdi", |
119 "r8", | 123 "r8", |
120 "r9", | 124 "r9", |
(...skipping 27 matching lines...) Expand all Loading... |
148 // in modR/M, SIB, and opcode bytes. | 152 // in modR/M, SIB, and opcode bytes. |
149 int low_bits() const { | 153 int low_bits() const { |
150 return code_ & 0x7; | 154 return code_ & 0x7; |
151 } | 155 } |
152 | 156 |
153 // Unfortunately we can't make this private in a struct when initializing | 157 // Unfortunately we can't make this private in a struct when initializing |
154 // by assignment. | 158 // by assignment. |
155 int code_; | 159 int code_; |
156 | 160 |
157 private: | 161 private: |
158 static const int registerCodeByAllocationIndex[kNumAllocatableRegisters]; | 162 static const int kRegisterCodeByAllocationIndex[kNumAllocatableRegisters]; |
159 static const int allocationIndexByRegisterCode[kNumRegisters]; | 163 static const int kAllocationIndexByRegisterCode[kNumRegisters]; |
| 164 static const int kRspIndexForPushAllByRegisterCode[kNumRegisters]; |
160 }; | 165 }; |
161 | 166 |
162 const Register rax = { 0 }; | 167 const Register rax = { 0 }; |
163 const Register rcx = { 1 }; | 168 const Register rcx = { 1 }; |
164 const Register rdx = { 2 }; | 169 const Register rdx = { 2 }; |
165 const Register rbx = { 3 }; | 170 const Register rbx = { 3 }; |
166 const Register rsp = { 4 }; | 171 const Register rsp = { 4 }; |
167 const Register rbp = { 5 }; | 172 const Register rbp = { 5 }; |
168 const Register rsi = { 6 }; | 173 const Register rsi = { 6 }; |
169 const Register rdi = { 7 }; | 174 const Register rdi = { 7 }; |
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1573 private: | 1578 private: |
1574 Assembler* assembler_; | 1579 Assembler* assembler_; |
1575 #ifdef DEBUG | 1580 #ifdef DEBUG |
1576 int space_before_; | 1581 int space_before_; |
1577 #endif | 1582 #endif |
1578 }; | 1583 }; |
1579 | 1584 |
1580 } } // namespace v8::internal | 1585 } } // namespace v8::internal |
1581 | 1586 |
1582 #endif // V8_X64_ASSEMBLER_X64_H_ | 1587 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |