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 73 matching lines...) Loading... |
84 // to a few constants). If this is a problem, we could change the code | 84 // to a few constants). If this is a problem, we could change the code |
85 // such that we use an enum in optimized mode, and the struct in debug | 85 // such that we use an enum in optimized mode, and the struct in debug |
86 // mode. This way we get the compile-time error checking in debug mode | 86 // mode. This way we get the compile-time error checking in debug mode |
87 // and best performance in optimized code. | 87 // and best performance in optimized code. |
88 // | 88 // |
89 | 89 |
90 struct Register { | 90 struct Register { |
91 // The non-allocatable registers are: | 91 // The non-allocatable registers are: |
92 // rsp - stack pointer | 92 // rsp - stack pointer |
93 // rbp - frame pointer | 93 // rbp - frame pointer |
94 // rsi - context register | |
95 // r10 - fixed scratch register | 94 // r10 - fixed scratch register |
96 // r12 - smi constant register | 95 // r12 - smi constant register |
97 // r13 - root register | 96 // r13 - root register |
98 static const int kMaxNumAllocatableRegisters = 10; | 97 static const int kMaxNumAllocatableRegisters = 11; |
99 static int NumAllocatableRegisters() { | 98 static int NumAllocatableRegisters() { |
100 return kMaxNumAllocatableRegisters; | 99 return kMaxNumAllocatableRegisters; |
101 } | 100 } |
102 static const int kNumRegisters = 16; | 101 static const int kNumRegisters = 16; |
103 | 102 |
104 static int ToAllocationIndex(Register reg) { | 103 static int ToAllocationIndex(Register reg) { |
105 return kAllocationIndexByRegisterCode[reg.code()]; | 104 return kAllocationIndexByRegisterCode[reg.code()]; |
106 } | 105 } |
107 | 106 |
108 static Register FromAllocationIndex(int index) { | 107 static Register FromAllocationIndex(int index) { |
109 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); | 108 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); |
110 Register result = { kRegisterCodeByAllocationIndex[index] }; | 109 Register result = { kRegisterCodeByAllocationIndex[index] }; |
111 return result; | 110 return result; |
112 } | 111 } |
113 | 112 |
114 static const char* AllocationIndexToString(int index) { | 113 static const char* AllocationIndexToString(int index) { |
115 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); | 114 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); |
116 const char* const names[] = { | 115 const char* const names[] = { |
117 "rax", | 116 "rax", |
118 "rbx", | 117 "rbx", |
119 "rdx", | 118 "rdx", |
120 "rcx", | 119 "rcx", |
| 120 "rsi", |
121 "rdi", | 121 "rdi", |
122 "r8", | 122 "r8", |
123 "r9", | 123 "r9", |
124 "r11", | 124 "r11", |
125 "r14", | 125 "r14", |
126 "r15" | 126 "r15" |
127 }; | 127 }; |
128 return names[index]; | 128 return names[index]; |
129 } | 129 } |
130 | 130 |
(...skipping 1573 matching lines...) Loading... |
1704 private: | 1704 private: |
1705 Assembler* assembler_; | 1705 Assembler* assembler_; |
1706 #ifdef DEBUG | 1706 #ifdef DEBUG |
1707 int space_before_; | 1707 int space_before_; |
1708 #endif | 1708 #endif |
1709 }; | 1709 }; |
1710 | 1710 |
1711 } } // namespace v8::internal | 1711 } } // namespace v8::internal |
1712 | 1712 |
1713 #endif // V8_X64_ASSEMBLER_X64_H_ | 1713 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |