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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 static const int kNumRegisters = Code::kAfterLast; | 112 static const int kNumRegisters = Code::kAfterLast; |
113 | 113 |
114 static Register from_code(int code) { | 114 static Register from_code(int code) { |
115 DCHECK(code >= 0); | 115 DCHECK(code >= 0); |
116 DCHECK(code < kNumRegisters); | 116 DCHECK(code < kNumRegisters); |
117 Register r = {code}; | 117 Register r = {code}; |
118 return r; | 118 return r; |
119 } | 119 } |
120 const char* ToString(); | 120 const char* ToString(); |
121 bool IsAllocatable() const; | 121 bool IsAllocatable(RegisterConfiguration::CompilerSelector compiler = |
| 122 RegisterConfiguration::CRANKSHAFT) const; |
122 bool is_valid() const { return 0 <= reg_code && reg_code < kNumRegisters; } | 123 bool is_valid() const { return 0 <= reg_code && reg_code < kNumRegisters; } |
123 bool is(Register reg) const { return reg_code == reg.reg_code; } | 124 bool is(Register reg) const { return reg_code == reg.reg_code; } |
124 int code() const { | 125 int code() const { |
125 DCHECK(is_valid()); | 126 DCHECK(is_valid()); |
126 return reg_code; | 127 return reg_code; |
127 } | 128 } |
128 int bit() const { | 129 int bit() const { |
129 DCHECK(is_valid()); | 130 DCHECK(is_valid()); |
130 return 1 << reg_code; | 131 return 1 << reg_code; |
131 } | 132 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 }; | 213 }; |
213 | 214 |
214 static const int kMaxNumRegisters = Code::kAfterLast; | 215 static const int kMaxNumRegisters = Code::kAfterLast; |
215 | 216 |
216 static XMMRegister from_code(int code) { | 217 static XMMRegister from_code(int code) { |
217 XMMRegister result = {code}; | 218 XMMRegister result = {code}; |
218 return result; | 219 return result; |
219 } | 220 } |
220 | 221 |
221 const char* ToString(); | 222 const char* ToString(); |
222 bool IsAllocatable() const; | 223 bool IsAllocatable(RegisterConfiguration::CompilerSelector compiler = |
| 224 RegisterConfiguration::CRANKSHAFT) const; |
223 bool is_valid() const { return 0 <= reg_code && reg_code < kMaxNumRegisters; } | 225 bool is_valid() const { return 0 <= reg_code && reg_code < kMaxNumRegisters; } |
224 bool is(XMMRegister reg) const { return reg_code == reg.reg_code; } | 226 bool is(XMMRegister reg) const { return reg_code == reg.reg_code; } |
225 int code() const { | 227 int code() const { |
226 DCHECK(is_valid()); | 228 DCHECK(is_valid()); |
227 return reg_code; | 229 return reg_code; |
228 } | 230 } |
229 | 231 |
230 // Return the high bit of the register code as a 0 or 1. Used often | 232 // Return the high bit of the register code as a 0 or 1. Used often |
231 // when constructing the REX prefix byte. | 233 // when constructing the REX prefix byte. |
232 int high_bit() const { return reg_code >> 3; } | 234 int high_bit() const { return reg_code >> 3; } |
(...skipping 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2279 Assembler* assembler_; | 2281 Assembler* assembler_; |
2280 #ifdef DEBUG | 2282 #ifdef DEBUG |
2281 int space_before_; | 2283 int space_before_; |
2282 #endif | 2284 #endif |
2283 }; | 2285 }; |
2284 | 2286 |
2285 } // namespace internal | 2287 } // namespace internal |
2286 } // namespace v8 | 2288 } // namespace v8 |
2287 | 2289 |
2288 #endif // V8_X64_ASSEMBLER_X64_H_ | 2290 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |