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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // ----------------------------------------------------------------------------- | 69 // ----------------------------------------------------------------------------- |
70 // Implementation of Register and FPURegister. | 70 // Implementation of Register and FPURegister. |
71 | 71 |
72 // Core register. | 72 // Core register. |
73 struct Register { | 73 struct Register { |
74 static const int kNumRegisters = v8::internal::kNumRegisters; | 74 static const int kNumRegisters = v8::internal::kNumRegisters; |
75 static const int kNumAllocatableRegisters = 14; // v0 through t7. | 75 static const int kMaxNumAllocatableRegisters = 14; // v0 through t7. |
76 static const int kSizeInBytes = 4; | 76 static const int kSizeInBytes = 4; |
| 77 static const int kGPRsPerNonFPUDouble = 2; |
| 78 |
| 79 inline static int NumAllocatableRegisters(); |
77 | 80 |
78 static int ToAllocationIndex(Register reg) { | 81 static int ToAllocationIndex(Register reg) { |
79 return reg.code() - 2; // zero_reg and 'at' are skipped. | 82 return reg.code() - 2; // zero_reg and 'at' are skipped. |
80 } | 83 } |
81 | 84 |
82 static Register FromAllocationIndex(int index) { | 85 static Register FromAllocationIndex(int index) { |
83 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 86 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); |
84 return from_code(index + 2); // zero_reg and 'at' are skipped. | 87 return from_code(index + 2); // zero_reg and 'at' are skipped. |
85 } | 88 } |
86 | 89 |
87 static const char* AllocationIndexToString(int index) { | 90 static const char* AllocationIndexToString(int index) { |
88 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 91 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); |
89 const char* const names[] = { | 92 const char* const names[] = { |
90 "v0", | 93 "v0", |
91 "v1", | 94 "v1", |
92 "a0", | 95 "a0", |
93 "a1", | 96 "a1", |
94 "a2", | 97 "a2", |
95 "a3", | 98 "a3", |
96 "t0", | 99 "t0", |
97 "t1", | 100 "t1", |
98 "t2", | 101 "t2", |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 193 |
191 // TODO(plind): Warning, inconsistent numbering here. kNumFPURegisters refers | 194 // TODO(plind): Warning, inconsistent numbering here. kNumFPURegisters refers |
192 // to number of 32-bit FPU regs, but kNumAllocatableRegisters refers to | 195 // to number of 32-bit FPU regs, but kNumAllocatableRegisters refers to |
193 // number of Double regs (64-bit regs, or FPU-reg-pairs). | 196 // number of Double regs (64-bit regs, or FPU-reg-pairs). |
194 | 197 |
195 // A few double registers are reserved: one as a scratch register and one to | 198 // A few double registers are reserved: one as a scratch register and one to |
196 // hold 0.0. | 199 // hold 0.0. |
197 // f28: 0.0 | 200 // f28: 0.0 |
198 // f30: scratch register. | 201 // f30: scratch register. |
199 static const int kNumReservedRegisters = 2; | 202 static const int kNumReservedRegisters = 2; |
200 static const int kNumAllocatableRegisters = kNumRegisters / 2 - | 203 static const int kMaxNumAllocatableRegisters = kNumRegisters / 2 - |
201 kNumReservedRegisters; | 204 kNumReservedRegisters; |
202 | 205 |
203 | 206 inline static int NumRegisters(); |
| 207 inline static int NumAllocatableRegisters(); |
204 inline static int ToAllocationIndex(FPURegister reg); | 208 inline static int ToAllocationIndex(FPURegister reg); |
| 209 static const char* AllocationIndexToString(int index); |
205 | 210 |
206 static FPURegister FromAllocationIndex(int index) { | 211 static FPURegister FromAllocationIndex(int index) { |
207 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 212 ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters); |
208 return from_code(index * 2); | 213 return from_code(index * 2); |
209 } | 214 } |
210 | 215 |
211 static const char* AllocationIndexToString(int index) { | |
212 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | |
213 const char* const names[] = { | |
214 "f0", | |
215 "f2", | |
216 "f4", | |
217 "f6", | |
218 "f8", | |
219 "f10", | |
220 "f12", | |
221 "f14", | |
222 "f16", | |
223 "f18", | |
224 "f20", | |
225 "f22", | |
226 "f24", | |
227 "f26" | |
228 }; | |
229 return names[index]; | |
230 } | |
231 | |
232 static FPURegister from_code(int code) { | 216 static FPURegister from_code(int code) { |
233 FPURegister r = { code }; | 217 FPURegister r = { code }; |
234 return r; | 218 return r; |
235 } | 219 } |
236 | 220 |
237 bool is_valid() const { return 0 <= code_ && code_ < kNumFPURegisters ; } | 221 bool is_valid() const { return 0 <= code_ && code_ < kNumFPURegisters ; } |
238 bool is(FPURegister creg) const { return code_ == creg.code_; } | 222 bool is(FPURegister creg) const { return code_ == creg.code_; } |
239 FPURegister low() const { | 223 FPURegister low() const { |
240 // Find low reg of a Double-reg pair, which is the reg itself. | 224 // Find low reg of a Double-reg pair, which is the reg itself. |
241 ASSERT(code_ % 2 == 0); // Specified Double reg must be even. | 225 ASSERT(code_ % 2 == 0); // Specified Double reg must be even. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 const FPURegister f23 = { 23 }; | 293 const FPURegister f23 = { 23 }; |
310 const FPURegister f24 = { 24 }; | 294 const FPURegister f24 = { 24 }; |
311 const FPURegister f25 = { 25 }; | 295 const FPURegister f25 = { 25 }; |
312 const FPURegister f26 = { 26 }; | 296 const FPURegister f26 = { 26 }; |
313 const FPURegister f27 = { 27 }; | 297 const FPURegister f27 = { 27 }; |
314 const FPURegister f28 = { 28 }; | 298 const FPURegister f28 = { 28 }; |
315 const FPURegister f29 = { 29 }; | 299 const FPURegister f29 = { 29 }; |
316 const FPURegister f30 = { 30 }; | 300 const FPURegister f30 = { 30 }; |
317 const FPURegister f31 = { 31 }; | 301 const FPURegister f31 = { 31 }; |
318 | 302 |
| 303 const Register sfpd_lo = { kRegister_t6_Code }; |
| 304 const Register sfpd_hi = { kRegister_t7_Code }; |
| 305 |
319 // Register aliases. | 306 // Register aliases. |
320 // cp is assumed to be a callee saved register. | 307 // cp is assumed to be a callee saved register. |
321 // Defined using #define instead of "static const Register&" because Clang | 308 // Defined using #define instead of "static const Register&" because Clang |
322 // complains otherwise when a compilation unit that includes this header | 309 // complains otherwise when a compilation unit that includes this header |
323 // doesn't use the variables. | 310 // doesn't use the variables. |
324 #define kRootRegister s6 | 311 #define kRootRegister s6 |
325 #define cp s7 | 312 #define cp s7 |
326 #define kLithiumScratchReg s3 | 313 #define kLithiumScratchReg s3 |
327 #define kLithiumScratchReg2 s4 | 314 #define kLithiumScratchReg2 s4 |
328 #define kLithiumScratchDouble f30 | 315 #define kLithiumScratchDouble f30 |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 class EnsureSpace BASE_EMBEDDED { | 1264 class EnsureSpace BASE_EMBEDDED { |
1278 public: | 1265 public: |
1279 explicit EnsureSpace(Assembler* assembler) { | 1266 explicit EnsureSpace(Assembler* assembler) { |
1280 assembler->CheckBuffer(); | 1267 assembler->CheckBuffer(); |
1281 } | 1268 } |
1282 }; | 1269 }; |
1283 | 1270 |
1284 } } // namespace v8::internal | 1271 } } // namespace v8::internal |
1285 | 1272 |
1286 #endif // V8_ARM_ASSEMBLER_MIPS_H_ | 1273 #endif // V8_ARM_ASSEMBLER_MIPS_H_ |
OLD | NEW |