| 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 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 #include <set> | 41 #include <set> |
| 42 | 42 |
| 43 #include "src/assembler.h" | 43 #include "src/assembler.h" |
| 44 #include "src/compiler.h" | 44 #include "src/compiler.h" |
| 45 #include "src/mips64/constants-mips64.h" | 45 #include "src/mips64/constants-mips64.h" |
| 46 | 46 |
| 47 namespace v8 { | 47 namespace v8 { |
| 48 namespace internal { | 48 namespace internal { |
| 49 | 49 |
| 50 // clang-format off |
| 51 #define GENERAL_REGISTERS(V) \ |
| 52 V(zero_reg) V(at) V(v0) V(v1) V(a0) V(a1) V(a2) V(a3) \ |
| 53 V(a4) V(a5) V(a6) V(a7) V(t0) V(t1) V(t2) V(t3) \ |
| 54 V(s0) V(s1) V(s2) V(s3) V(s4) V(s5) V(s6) V(s7) V(t8) V(t9) \ |
| 55 V(k0) V(k1) V(gp) V(sp) V(fp) V(ra) |
| 56 |
| 57 #define ALLOCATABLE_GENERAL_REGISTERS(V) \ |
| 58 V(v0) V(v1) V(a0) V(a1) V(a2) V(a3) \ |
| 59 V(a4) V(a5) V(a6) V(a7) V(t0) V(t1) V(t2) V(s7) |
| 60 |
| 61 #define DOUBLE_REGISTERS(V) \ |
| 62 V(f0) V(f1) V(f2) V(f3) V(f4) V(f5) V(f6) V(f7) \ |
| 63 V(f8) V(f9) V(f10) V(f11) V(f12) V(f13) V(f14) V(f15) \ |
| 64 V(f16) V(f17) V(f18) V(f19) V(f20) V(f21) V(f22) V(f23) \ |
| 65 V(f24) V(f25) V(f26) V(f27) V(f28) V(f29) V(f30) V(f31) |
| 66 |
| 67 #define ALLOCATABLE_DOUBLE_REGISTERS(V) \ |
| 68 V(f0) V(f2) V(f4) V(f6) V(f8) V(f10) V(f12) V(f14) \ |
| 69 V(f16) V(f18) V(f20) V(f22) V(f24) V(f26) |
| 70 // clang-format on |
| 71 |
| 50 // CPU Registers. | 72 // CPU Registers. |
| 51 // | 73 // |
| 52 // 1) We would prefer to use an enum, but enum values are assignment- | 74 // 1) We would prefer to use an enum, but enum values are assignment- |
| 53 // compatible with int, which has caused code-generation bugs. | 75 // compatible with int, which has caused code-generation bugs. |
| 54 // | 76 // |
| 55 // 2) We would prefer to use a class instead of a struct but we don't like | 77 // 2) We would prefer to use a class instead of a struct but we don't like |
| 56 // the register initialization to depend on the particular initialization | 78 // the register initialization to depend on the particular initialization |
| 57 // order (which appears to be different on OS X, Linux, and Windows for the | 79 // order (which appears to be different on OS X, Linux, and Windows for the |
| 58 // installed versions of C++ we tried). Using a struct permits C-style | 80 // installed versions of C++ we tried). Using a struct permits C-style |
| 59 // "initialization". Also, the Register objects cannot be const as this | 81 // "initialization". Also, the Register objects cannot be const as this |
| 60 // forces initialization stubs in MSVC, making us dependent on initialization | 82 // forces initialization stubs in MSVC, making us dependent on initialization |
| 61 // order. | 83 // order. |
| 62 // | 84 // |
| 63 // 3) By not using an enum, we are possibly preventing the compiler from | 85 // 3) By not using an enum, we are possibly preventing the compiler from |
| 64 // doing certain constant folds, which may significantly reduce the | 86 // doing certain constant folds, which may significantly reduce the |
| 65 // code generated for some assembly instructions (because they boil down | 87 // code generated for some assembly instructions (because they boil down |
| 66 // to a few constants). If this is a problem, we could change the code | 88 // to a few constants). If this is a problem, we could change the code |
| 67 // such that we use an enum in optimized mode, and the struct in debug | 89 // such that we use an enum in optimized mode, and the struct in debug |
| 68 // mode. This way we get the compile-time error checking in debug mode | 90 // mode. This way we get the compile-time error checking in debug mode |
| 69 // and best performance in optimized code. | 91 // and best performance in optimized code. |
| 70 | 92 |
| 71 | 93 |
| 72 // ----------------------------------------------------------------------------- | 94 // ----------------------------------------------------------------------------- |
| 73 // Implementation of Register and FPURegister. | 95 // Implementation of Register and FPURegister. |
| 74 | 96 |
| 75 // Core register. | |
| 76 struct Register { | 97 struct Register { |
| 77 static const int kNumRegisters = v8::internal::kNumRegisters; | |
| 78 static const int kMaxNumAllocatableRegisters = 14; // v0 through t2 and cp. | |
| 79 static const int kSizeInBytes = 8; | |
| 80 static const int kCpRegister = 23; // cp (s7) is the 23rd register. | 98 static const int kCpRegister = 23; // cp (s7) is the 23rd register. |
| 81 | 99 |
| 82 inline static int NumAllocatableRegisters(); | 100 enum Code { |
| 101 #define REGISTER_CODE(R) kCode_##R, |
| 102 GENERAL_REGISTERS(REGISTER_CODE) |
| 103 #undef REGISTER_CODE |
| 104 kAfterLast, |
| 105 kCode_no_reg = -1 |
| 106 }; |
| 83 | 107 |
| 84 static int ToAllocationIndex(Register reg) { | 108 static const int kNumRegisters = Code::kAfterLast; |
| 85 DCHECK((reg.code() - 2) < (kMaxNumAllocatableRegisters - 1) || | |
| 86 reg.is(from_code(kCpRegister))); | |
| 87 return reg.is(from_code(kCpRegister)) ? | |
| 88 kMaxNumAllocatableRegisters - 1 : // Return last index for 'cp'. | |
| 89 reg.code() - 2; // zero_reg and 'at' are skipped. | |
| 90 } | |
| 91 | |
| 92 static Register FromAllocationIndex(int index) { | |
| 93 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters); | |
| 94 return index == kMaxNumAllocatableRegisters - 1 ? | |
| 95 from_code(kCpRegister) : // Last index is always the 'cp' register. | |
| 96 from_code(index + 2); // zero_reg and 'at' are skipped. | |
| 97 } | |
| 98 | |
| 99 static const char* AllocationIndexToString(int index) { | |
| 100 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters); | |
| 101 const char* const names[] = { | |
| 102 "v0", | |
| 103 "v1", | |
| 104 "a0", | |
| 105 "a1", | |
| 106 "a2", | |
| 107 "a3", | |
| 108 "a4", | |
| 109 "a5", | |
| 110 "a6", | |
| 111 "a7", | |
| 112 "t0", | |
| 113 "t1", | |
| 114 "t2", | |
| 115 "s7", | |
| 116 }; | |
| 117 return names[index]; | |
| 118 } | |
| 119 | 109 |
| 120 static Register from_code(int code) { | 110 static Register from_code(int code) { |
| 111 DCHECK(code >= 0); |
| 112 DCHECK(code < kNumRegisters); |
| 121 Register r = { code }; | 113 Register r = { code }; |
| 122 return r; | 114 return r; |
| 123 } | 115 } |
| 124 | 116 |
| 125 bool is_valid() const { return 0 <= code_ && code_ < kNumRegisters; } | 117 const char* ToString(); |
| 126 bool is(Register reg) const { return code_ == reg.code_; } | 118 bool IsAllocatable() const; |
| 119 bool is_valid() const { return 0 <= reg_code && reg_code < kNumRegisters; } |
| 120 bool is(Register reg) const { return reg_code == reg.reg_code; } |
| 127 int code() const { | 121 int code() const { |
| 128 DCHECK(is_valid()); | 122 DCHECK(is_valid()); |
| 129 return code_; | 123 return reg_code; |
| 130 } | 124 } |
| 131 int bit() const { | 125 int bit() const { |
| 132 DCHECK(is_valid()); | 126 DCHECK(is_valid()); |
| 133 return 1 << code_; | 127 return 1 << reg_code; |
| 134 } | 128 } |
| 135 | 129 |
| 136 // Unfortunately we can't make this private in a struct. | 130 // Unfortunately we can't make this private in a struct. |
| 137 int code_; | 131 int reg_code; |
| 138 }; | 132 }; |
| 139 | 133 |
| 140 #define REGISTER(N, C) \ | 134 // s7: context register |
| 141 const int kRegister_ ## N ## _Code = C; \ | 135 // s3: lithium scratch |
| 142 const Register N = { C } | 136 // s4: lithium scratch2 |
| 143 | 137 #define DECLARE_REGISTER(R) const Register R = {Register::kCode_##R}; |
| 144 REGISTER(no_reg, -1); | 138 GENERAL_REGISTERS(DECLARE_REGISTER) |
| 145 // Always zero. | 139 #undef DECLARE_REGISTER |
| 146 REGISTER(zero_reg, 0); | 140 const Register no_reg = {Register::kCode_no_reg}; |
| 147 // at: Reserved for synthetic instructions. | |
| 148 REGISTER(at, 1); | |
| 149 // v0, v1: Used when returning multiple values from subroutines. | |
| 150 REGISTER(v0, 2); | |
| 151 REGISTER(v1, 3); | |
| 152 // a0 - a4: Used to pass non-FP parameters. | |
| 153 REGISTER(a0, 4); | |
| 154 REGISTER(a1, 5); | |
| 155 REGISTER(a2, 6); | |
| 156 REGISTER(a3, 7); | |
| 157 // a4 - a7 t0 - t3: Can be used without reservation, act as temporary registers | |
| 158 // and are allowed to be destroyed by subroutines. | |
| 159 REGISTER(a4, 8); | |
| 160 REGISTER(a5, 9); | |
| 161 REGISTER(a6, 10); | |
| 162 REGISTER(a7, 11); | |
| 163 REGISTER(t0, 12); | |
| 164 REGISTER(t1, 13); | |
| 165 REGISTER(t2, 14); | |
| 166 REGISTER(t3, 15); | |
| 167 // s0 - s7: Subroutine register variables. Subroutines that write to these | |
| 168 // registers must restore their values before exiting so that the caller can | |
| 169 // expect the values to be preserved. | |
| 170 REGISTER(s0, 16); | |
| 171 REGISTER(s1, 17); | |
| 172 REGISTER(s2, 18); | |
| 173 REGISTER(s3, 19); | |
| 174 REGISTER(s4, 20); | |
| 175 REGISTER(s5, 21); | |
| 176 REGISTER(s6, 22); | |
| 177 REGISTER(s7, 23); | |
| 178 REGISTER(t8, 24); | |
| 179 REGISTER(t9, 25); | |
| 180 // k0, k1: Reserved for system calls and interrupt handlers. | |
| 181 REGISTER(k0, 26); | |
| 182 REGISTER(k1, 27); | |
| 183 // gp: Reserved. | |
| 184 REGISTER(gp, 28); | |
| 185 // sp: Stack pointer. | |
| 186 REGISTER(sp, 29); | |
| 187 // fp: Frame pointer. | |
| 188 REGISTER(fp, 30); | |
| 189 // ra: Return address pointer. | |
| 190 REGISTER(ra, 31); | |
| 191 | |
| 192 #undef REGISTER | |
| 193 | 141 |
| 194 | 142 |
| 195 int ToNumber(Register reg); | 143 int ToNumber(Register reg); |
| 196 | 144 |
| 197 Register ToRegister(int num); | 145 Register ToRegister(int num); |
| 198 | 146 |
| 199 // Coprocessor register. | 147 // Coprocessor register. |
| 200 struct FPURegister { | 148 struct DoubleRegister { |
| 201 static const int kMaxNumRegisters = v8::internal::kNumFPURegisters; | 149 enum Code { |
| 150 #define REGISTER_CODE(R) kCode_##R, |
| 151 DOUBLE_REGISTERS(REGISTER_CODE) |
| 152 #undef REGISTER_CODE |
| 153 kAfterLast, |
| 154 kCode_no_reg = -1 |
| 155 }; |
| 156 |
| 157 static const int kMaxNumRegisters = Code::kAfterLast; |
| 158 |
| 159 inline static int NumRegisters(); |
| 202 | 160 |
| 203 // TODO(plind): Warning, inconsistent numbering here. kNumFPURegisters refers | 161 // TODO(plind): Warning, inconsistent numbering here. kNumFPURegisters refers |
| 204 // to number of 32-bit FPU regs, but kNumAllocatableRegisters refers to | 162 // to number of 32-bit FPU regs, but kNumAllocatableRegisters refers to |
| 205 // number of Double regs (64-bit regs, or FPU-reg-pairs). | 163 // number of Double regs (64-bit regs, or FPU-reg-pairs). |
| 206 | 164 |
| 207 // A few double registers are reserved: one as a scratch register and one to | 165 const char* ToString(); |
| 208 // hold 0.0. | 166 bool IsAllocatable() const; |
| 209 // f28: 0.0 | 167 bool is_valid() const { return 0 <= reg_code && reg_code < kMaxNumRegisters; } |
| 210 // f30: scratch register. | 168 bool is(DoubleRegister reg) const { return reg_code == reg.reg_code; } |
| 211 static const int kNumReservedRegisters = 2; | 169 DoubleRegister low() const { |
| 212 static const int kMaxNumAllocatableRegisters = kMaxNumRegisters / 2 - | |
| 213 kNumReservedRegisters; | |
| 214 | |
| 215 inline static int NumRegisters(); | |
| 216 inline static int NumAllocatableRegisters(); | |
| 217 | |
| 218 // TODO(turbofan): Proper support for float32. | |
| 219 inline static int NumAllocatableAliasedRegisters(); | |
| 220 | |
| 221 inline static int ToAllocationIndex(FPURegister reg); | |
| 222 static const char* AllocationIndexToString(int index); | |
| 223 | |
| 224 static FPURegister FromAllocationIndex(int index) { | |
| 225 DCHECK(index >= 0 && index < kMaxNumAllocatableRegisters); | |
| 226 return from_code(index * 2); | |
| 227 } | |
| 228 | |
| 229 static FPURegister from_code(int code) { | |
| 230 FPURegister r = { code }; | |
| 231 return r; | |
| 232 } | |
| 233 | |
| 234 bool is_valid() const { return 0 <= code_ && code_ < kMaxNumRegisters ; } | |
| 235 bool is(FPURegister creg) const { return code_ == creg.code_; } | |
| 236 FPURegister low() const { | |
| 237 // TODO(plind): Create DCHECK for FR=0 mode. This usage suspect for FR=1. | 170 // TODO(plind): Create DCHECK for FR=0 mode. This usage suspect for FR=1. |
| 238 // Find low reg of a Double-reg pair, which is the reg itself. | 171 // Find low reg of a Double-reg pair, which is the reg itself. |
| 239 DCHECK(code_ % 2 == 0); // Specified Double reg must be even. | 172 DCHECK(reg_code % 2 == 0); // Specified Double reg must be even. |
| 240 FPURegister reg; | 173 DoubleRegister reg; |
| 241 reg.code_ = code_; | 174 reg.reg_code = reg_code; |
| 242 DCHECK(reg.is_valid()); | 175 DCHECK(reg.is_valid()); |
| 243 return reg; | 176 return reg; |
| 244 } | 177 } |
| 245 FPURegister high() const { | 178 DoubleRegister high() const { |
| 246 // TODO(plind): Create DCHECK for FR=0 mode. This usage illegal in FR=1. | 179 // TODO(plind): Create DCHECK for FR=0 mode. This usage illegal in FR=1. |
| 247 // Find high reg of a Doubel-reg pair, which is reg + 1. | 180 // Find high reg of a Doubel-reg pair, which is reg + 1. |
| 248 DCHECK(code_ % 2 == 0); // Specified Double reg must be even. | 181 DCHECK(reg_code % 2 == 0); // Specified Double reg must be even. |
| 249 FPURegister reg; | 182 DoubleRegister reg; |
| 250 reg.code_ = code_ + 1; | 183 reg.reg_code = reg_code + 1; |
| 251 DCHECK(reg.is_valid()); | 184 DCHECK(reg.is_valid()); |
| 252 return reg; | 185 return reg; |
| 253 } | 186 } |
| 254 | 187 |
| 255 int code() const { | 188 int code() const { |
| 256 DCHECK(is_valid()); | 189 DCHECK(is_valid()); |
| 257 return code_; | 190 return reg_code; |
| 258 } | 191 } |
| 259 int bit() const { | 192 int bit() const { |
| 260 DCHECK(is_valid()); | 193 DCHECK(is_valid()); |
| 261 return 1 << code_; | 194 return 1 << reg_code; |
| 195 } |
| 196 |
| 197 static DoubleRegister from_code(int code) { |
| 198 DoubleRegister r = {code}; |
| 199 return r; |
| 262 } | 200 } |
| 263 void setcode(int f) { | 201 void setcode(int f) { |
| 264 code_ = f; | 202 reg_code = f; |
| 265 DCHECK(is_valid()); | 203 DCHECK(is_valid()); |
| 266 } | 204 } |
| 267 // Unfortunately we can't make this private in a struct. | 205 // Unfortunately we can't make this private in a struct. |
| 268 int code_; | 206 int reg_code; |
| 269 }; | 207 }; |
| 270 | 208 |
| 209 // A few double registers are reserved: one as a scratch register and one to |
| 210 // hold 0.0. |
| 211 // f28: 0.0 |
| 212 // f30: scratch register. |
| 213 |
| 271 // V8 now supports the O32 ABI, and the FPU Registers are organized as 32 | 214 // V8 now supports the O32 ABI, and the FPU Registers are organized as 32 |
| 272 // 32-bit registers, f0 through f31. When used as 'double' they are used | 215 // 32-bit registers, f0 through f31. When used as 'double' they are used |
| 273 // in pairs, starting with the even numbered register. So a double operation | 216 // in pairs, starting with the even numbered register. So a double operation |
| 274 // on f0 really uses f0 and f1. | 217 // on f0 really uses f0 and f1. |
| 275 // (Modern mips hardware also supports 32 64-bit registers, via setting | 218 // (Modern mips hardware also supports 32 64-bit registers, via setting |
| 276 // (privileged) Status Register FR bit to 1. This is used by the N32 ABI, | 219 // (privileged) Status Register FR bit to 1. This is used by the N32 ABI, |
| 277 // but it is not in common use. Someday we will want to support this in v8.) | 220 // but it is not in common use. Someday we will want to support this in v8.) |
| 278 | 221 |
| 279 // For O32 ABI, Floats and Doubles refer to same set of 32 32-bit registers. | 222 // For O32 ABI, Floats and Doubles refer to same set of 32 32-bit registers. |
| 280 typedef FPURegister DoubleRegister; | 223 typedef DoubleRegister FPURegister; |
| 281 typedef FPURegister FloatRegister; | 224 typedef DoubleRegister FloatRegister; |
| 282 | 225 |
| 283 const FPURegister no_freg = { -1 }; | 226 const DoubleRegister no_freg = {-1}; |
| 284 | 227 |
| 285 const FPURegister f0 = { 0 }; // Return value in hard float mode. | 228 const DoubleRegister f0 = {0}; // Return value in hard float mode. |
| 286 const FPURegister f1 = { 1 }; | 229 const DoubleRegister f1 = {1}; |
| 287 const FPURegister f2 = { 2 }; | 230 const DoubleRegister f2 = {2}; |
| 288 const FPURegister f3 = { 3 }; | 231 const DoubleRegister f3 = {3}; |
| 289 const FPURegister f4 = { 4 }; | 232 const DoubleRegister f4 = {4}; |
| 290 const FPURegister f5 = { 5 }; | 233 const DoubleRegister f5 = {5}; |
| 291 const FPURegister f6 = { 6 }; | 234 const DoubleRegister f6 = {6}; |
| 292 const FPURegister f7 = { 7 }; | 235 const DoubleRegister f7 = {7}; |
| 293 const FPURegister f8 = { 8 }; | 236 const DoubleRegister f8 = {8}; |
| 294 const FPURegister f9 = { 9 }; | 237 const DoubleRegister f9 = {9}; |
| 295 const FPURegister f10 = { 10 }; | 238 const DoubleRegister f10 = {10}; |
| 296 const FPURegister f11 = { 11 }; | 239 const DoubleRegister f11 = {11}; |
| 297 const FPURegister f12 = { 12 }; // Arg 0 in hard float mode. | 240 const DoubleRegister f12 = {12}; // Arg 0 in hard float mode. |
| 298 const FPURegister f13 = { 13 }; | 241 const DoubleRegister f13 = {13}; |
| 299 const FPURegister f14 = { 14 }; // Arg 1 in hard float mode. | 242 const DoubleRegister f14 = {14}; // Arg 1 in hard float mode. |
| 300 const FPURegister f15 = { 15 }; | 243 const DoubleRegister f15 = {15}; |
| 301 const FPURegister f16 = { 16 }; | 244 const DoubleRegister f16 = {16}; |
| 302 const FPURegister f17 = { 17 }; | 245 const DoubleRegister f17 = {17}; |
| 303 const FPURegister f18 = { 18 }; | 246 const DoubleRegister f18 = {18}; |
| 304 const FPURegister f19 = { 19 }; | 247 const DoubleRegister f19 = {19}; |
| 305 const FPURegister f20 = { 20 }; | 248 const DoubleRegister f20 = {20}; |
| 306 const FPURegister f21 = { 21 }; | 249 const DoubleRegister f21 = {21}; |
| 307 const FPURegister f22 = { 22 }; | 250 const DoubleRegister f22 = {22}; |
| 308 const FPURegister f23 = { 23 }; | 251 const DoubleRegister f23 = {23}; |
| 309 const FPURegister f24 = { 24 }; | 252 const DoubleRegister f24 = {24}; |
| 310 const FPURegister f25 = { 25 }; | 253 const DoubleRegister f25 = {25}; |
| 311 const FPURegister f26 = { 26 }; | 254 const DoubleRegister f26 = {26}; |
| 312 const FPURegister f27 = { 27 }; | 255 const DoubleRegister f27 = {27}; |
| 313 const FPURegister f28 = { 28 }; | 256 const DoubleRegister f28 = {28}; |
| 314 const FPURegister f29 = { 29 }; | 257 const DoubleRegister f29 = {29}; |
| 315 const FPURegister f30 = { 30 }; | 258 const DoubleRegister f30 = {30}; |
| 316 const FPURegister f31 = { 31 }; | 259 const DoubleRegister f31 = {31}; |
| 317 | 260 |
| 318 // Register aliases. | 261 // Register aliases. |
| 319 // cp is assumed to be a callee saved register. | 262 // cp is assumed to be a callee saved register. |
| 320 // Defined using #define instead of "static const Register&" because Clang | 263 // Defined using #define instead of "static const Register&" because Clang |
| 321 // complains otherwise when a compilation unit that includes this header | 264 // complains otherwise when a compilation unit that includes this header |
| 322 // doesn't use the variables. | 265 // doesn't use the variables. |
| 323 #define kRootRegister s6 | 266 #define kRootRegister s6 |
| 324 #define cp s7 | 267 #define cp s7 |
| 325 #define kLithiumScratchReg s3 | 268 #define kLithiumScratchReg s3 |
| 326 #define kLithiumScratchReg2 s4 | 269 #define kLithiumScratchReg2 s4 |
| 327 #define kLithiumScratchDouble f30 | 270 #define kLithiumScratchDouble f30 |
| 328 #define kDoubleRegZero f28 | 271 #define kDoubleRegZero f28 |
| 329 // Used on mips64r6 for compare operations. | 272 // Used on mips64r6 for compare operations. |
| 330 #define kDoubleCompareReg f31 | 273 #define kDoubleCompareReg f31 |
| 331 | 274 |
| 332 // FPU (coprocessor 1) control registers. | 275 // FPU (coprocessor 1) control registers. |
| 333 // Currently only FCSR (#31) is implemented. | 276 // Currently only FCSR (#31) is implemented. |
| 334 struct FPUControlRegister { | 277 struct FPUControlRegister { |
| 335 bool is_valid() const { return code_ == kFCSRRegister; } | 278 bool is_valid() const { return reg_code == kFCSRRegister; } |
| 336 bool is(FPUControlRegister creg) const { return code_ == creg.code_; } | 279 bool is(FPUControlRegister creg) const { return reg_code == creg.reg_code; } |
| 337 int code() const { | 280 int code() const { |
| 338 DCHECK(is_valid()); | 281 DCHECK(is_valid()); |
| 339 return code_; | 282 return reg_code; |
| 340 } | 283 } |
| 341 int bit() const { | 284 int bit() const { |
| 342 DCHECK(is_valid()); | 285 DCHECK(is_valid()); |
| 343 return 1 << code_; | 286 return 1 << reg_code; |
| 344 } | 287 } |
| 345 void setcode(int f) { | 288 void setcode(int f) { |
| 346 code_ = f; | 289 reg_code = f; |
| 347 DCHECK(is_valid()); | 290 DCHECK(is_valid()); |
| 348 } | 291 } |
| 349 // Unfortunately we can't make this private in a struct. | 292 // Unfortunately we can't make this private in a struct. |
| 350 int code_; | 293 int reg_code; |
| 351 }; | 294 }; |
| 352 | 295 |
| 353 const FPUControlRegister no_fpucreg = { kInvalidFPUControlRegister }; | 296 const FPUControlRegister no_fpucreg = { kInvalidFPUControlRegister }; |
| 354 const FPUControlRegister FCSR = { kFCSRRegister }; | 297 const FPUControlRegister FCSR = { kFCSRRegister }; |
| 355 | 298 |
| 356 | 299 |
| 357 // ----------------------------------------------------------------------------- | 300 // ----------------------------------------------------------------------------- |
| 358 // Machine instruction Operands. | 301 // Machine instruction Operands. |
| 359 const int kSmiShift = kSmiTagSize + kSmiShiftSize; | 302 const int kSmiShift = kSmiTagSize + kSmiShiftSize; |
| 360 const uint64_t kSmiShiftMask = (1UL << kSmiShift) - 1; | 303 const uint64_t kSmiShiftMask = (1UL << kSmiShift) - 1; |
| (...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 class EnsureSpace BASE_EMBEDDED { | 1435 class EnsureSpace BASE_EMBEDDED { |
| 1493 public: | 1436 public: |
| 1494 explicit EnsureSpace(Assembler* assembler) { | 1437 explicit EnsureSpace(Assembler* assembler) { |
| 1495 assembler->CheckBuffer(); | 1438 assembler->CheckBuffer(); |
| 1496 } | 1439 } |
| 1497 }; | 1440 }; |
| 1498 | 1441 |
| 1499 } } // namespace v8::internal | 1442 } } // namespace v8::internal |
| 1500 | 1443 |
| 1501 #endif // V8_ARM_ASSEMBLER_MIPS_H_ | 1444 #endif // V8_ARM_ASSEMBLER_MIPS_H_ |
| OLD | NEW |