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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 Register r = { code }; | 125 Register r = { code }; |
126 return r; | 126 return r; |
127 } | 127 } |
128 | 128 |
129 bool is_valid() const { return 0 <= reg_code && reg_code < kNumRegisters; } | 129 bool is_valid() const { return 0 <= reg_code && reg_code < kNumRegisters; } |
130 bool is(Register reg) const { return reg_code == reg.reg_code; } | 130 bool is(Register reg) const { return reg_code == reg.reg_code; } |
131 int code() const { | 131 int code() const { |
132 DCHECK(is_valid()); | 132 DCHECK(is_valid()); |
133 return reg_code; | 133 return reg_code; |
134 } | 134 } |
135 constexpr int bit() const { return DCHECK(is_valid()), 1 << reg_code; } | 135 int bit() const { |
| 136 DCHECK(is_valid()); |
| 137 return 1 << reg_code; |
| 138 } |
136 | 139 |
137 // Unfortunately we can't make this private in a struct. | 140 // Unfortunately we can't make this private in a struct. |
138 int reg_code; | 141 int reg_code; |
139 }; | 142 }; |
140 | 143 |
141 // s7: context register | 144 // s7: context register |
142 // s3: lithium scratch | 145 // s3: lithium scratch |
143 // s4: lithium scratch2 | 146 // s4: lithium scratch2 |
144 #define DECLARE_REGISTER(R) constexpr Register R = {Register::kCode_##R}; | 147 #define DECLARE_REGISTER(R) constexpr Register R = {Register::kCode_##R}; |
145 GENERAL_REGISTERS(DECLARE_REGISTER) | 148 GENERAL_REGISTERS(DECLARE_REGISTER) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 FPURegister reg; | 192 FPURegister reg; |
190 reg.reg_code = reg_code + 1; | 193 reg.reg_code = reg_code + 1; |
191 DCHECK(reg.is_valid()); | 194 DCHECK(reg.is_valid()); |
192 return reg; | 195 return reg; |
193 } | 196 } |
194 | 197 |
195 int code() const { | 198 int code() const { |
196 DCHECK(is_valid()); | 199 DCHECK(is_valid()); |
197 return reg_code; | 200 return reg_code; |
198 } | 201 } |
199 constexpr int bit() const { return DCHECK(is_valid()), 1 << reg_code; } | 202 |
| 203 int bit() const { |
| 204 DCHECK(is_valid()); |
| 205 return 1 << reg_code; |
| 206 } |
200 | 207 |
201 static FPURegister from_code(int code) { | 208 static FPURegister from_code(int code) { |
202 FPURegister r = {code}; | 209 FPURegister r = {code}; |
203 return r; | 210 return r; |
204 } | 211 } |
205 void setcode(int f) { | 212 void setcode(int f) { |
206 reg_code = f; | 213 reg_code = f; |
207 DCHECK(is_valid()); | 214 DCHECK(is_valid()); |
208 } | 215 } |
209 // Unfortunately we can't make this private in a struct. | 216 // Unfortunately we can't make this private in a struct. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 287 |
281 // FPU (coprocessor 1) control registers. | 288 // FPU (coprocessor 1) control registers. |
282 // Currently only FCSR (#31) is implemented. | 289 // Currently only FCSR (#31) is implemented. |
283 struct FPUControlRegister { | 290 struct FPUControlRegister { |
284 bool is_valid() const { return reg_code == kFCSRRegister; } | 291 bool is_valid() const { return reg_code == kFCSRRegister; } |
285 bool is(FPUControlRegister creg) const { return reg_code == creg.reg_code; } | 292 bool is(FPUControlRegister creg) const { return reg_code == creg.reg_code; } |
286 int code() const { | 293 int code() const { |
287 DCHECK(is_valid()); | 294 DCHECK(is_valid()); |
288 return reg_code; | 295 return reg_code; |
289 } | 296 } |
290 constexpr int bit() const { return DCHECK(is_valid()), 1 << reg_code; } | 297 int bit() const { |
| 298 DCHECK(is_valid()); |
| 299 return 1 << reg_code; |
| 300 } |
291 void setcode(int f) { | 301 void setcode(int f) { |
292 reg_code = f; | 302 reg_code = f; |
293 DCHECK(is_valid()); | 303 DCHECK(is_valid()); |
294 } | 304 } |
295 // Unfortunately we can't make this private in a struct. | 305 // Unfortunately we can't make this private in a struct. |
296 int reg_code; | 306 int reg_code; |
297 }; | 307 }; |
298 | 308 |
299 constexpr FPUControlRegister no_fpucreg = {kInvalidFPUControlRegister}; | 309 constexpr FPUControlRegister no_fpucreg = {kInvalidFPUControlRegister}; |
300 constexpr FPUControlRegister FCSR = {kFCSRRegister}; | 310 constexpr FPUControlRegister FCSR = {kFCSRRegister}; |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 public: | 1523 public: |
1514 explicit EnsureSpace(Assembler* assembler) { | 1524 explicit EnsureSpace(Assembler* assembler) { |
1515 assembler->CheckBuffer(); | 1525 assembler->CheckBuffer(); |
1516 } | 1526 } |
1517 }; | 1527 }; |
1518 | 1528 |
1519 } // namespace internal | 1529 } // namespace internal |
1520 } // namespace v8 | 1530 } // namespace v8 |
1521 | 1531 |
1522 #endif // V8_ARM_ASSEMBLER_MIPS_H_ | 1532 #endif // V8_ARM_ASSEMBLER_MIPS_H_ |
OLD | NEW |