| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 static int ToAllocationIndex(Register reg) { | 101 static int ToAllocationIndex(Register reg) { |
| 102 return kAllocationIndexByRegisterCode[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 = { kRegisterCodeByAllocationIndex[index] }; | 107 Register result = { kRegisterCodeByAllocationIndex[index] }; |
| 108 return result; | 108 return result; |
| 109 } | 109 } |
| 110 | 110 |
| 111 static int ToRspIndexForPushAll(Register reg) { | |
| 112 // TODO(ager): Refactor this so we can use the right constants for | |
| 113 // this computation. Move it to the macro assembler as on ARM. | |
| 114 return kRspIndexForPushAllByRegisterCode[reg.code()] + 5; | |
| 115 } | |
| 116 | |
| 117 static const char* AllocationIndexToString(int index) { | 111 static const char* AllocationIndexToString(int index) { |
| 118 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 112 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
| 119 const char* const names[] = { | 113 const char* const names[] = { |
| 120 "rax", | 114 "rax", |
| 121 "rbx", | 115 "rbx", |
| 122 "rdx", | 116 "rdx", |
| 123 "rcx", | 117 "rcx", |
| 124 "rdi", | 118 "rdi", |
| 125 "r8", | 119 "r8", |
| 126 "r9", | 120 "r9", |
| (...skipping 29 matching lines...) Expand all Loading... |
| 156 return code_ & 0x7; | 150 return code_ & 0x7; |
| 157 } | 151 } |
| 158 | 152 |
| 159 // Unfortunately we can't make this private in a struct when initializing | 153 // Unfortunately we can't make this private in a struct when initializing |
| 160 // by assignment. | 154 // by assignment. |
| 161 int code_; | 155 int code_; |
| 162 | 156 |
| 163 private: | 157 private: |
| 164 static const int kRegisterCodeByAllocationIndex[kNumAllocatableRegisters]; | 158 static const int kRegisterCodeByAllocationIndex[kNumAllocatableRegisters]; |
| 165 static const int kAllocationIndexByRegisterCode[kNumRegisters]; | 159 static const int kAllocationIndexByRegisterCode[kNumRegisters]; |
| 166 static const int kRspIndexForPushAllByRegisterCode[kNumRegisters]; | |
| 167 }; | 160 }; |
| 168 | 161 |
| 169 const Register rax = { 0 }; | 162 const Register rax = { 0 }; |
| 170 const Register rcx = { 1 }; | 163 const Register rcx = { 1 }; |
| 171 const Register rdx = { 2 }; | 164 const Register rdx = { 2 }; |
| 172 const Register rbx = { 3 }; | 165 const Register rbx = { 3 }; |
| 173 const Register rsp = { 4 }; | 166 const Register rsp = { 4 }; |
| 174 const Register rbp = { 5 }; | 167 const Register rbp = { 5 }; |
| 175 const Register rsi = { 6 }; | 168 const Register rsi = { 6 }; |
| 176 const Register rdi = { 7 }; | 169 const Register rdi = { 7 }; |
| (...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 private: | 1573 private: |
| 1581 Assembler* assembler_; | 1574 Assembler* assembler_; |
| 1582 #ifdef DEBUG | 1575 #ifdef DEBUG |
| 1583 int space_before_; | 1576 int space_before_; |
| 1584 #endif | 1577 #endif |
| 1585 }; | 1578 }; |
| 1586 | 1579 |
| 1587 } } // namespace v8::internal | 1580 } } // namespace v8::internal |
| 1588 | 1581 |
| 1589 #endif // V8_X64_ASSEMBLER_X64_H_ | 1582 #endif // V8_X64_ASSEMBLER_X64_H_ |
| OLD | NEW |