| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/register-configuration.h" | 5 #include "src/register-configuration.h" |
| 6 #include "src/globals.h" | 6 #include "src/globals.h" |
| 7 #include "src/macro-assembler.h" | 7 #include "src/macro-assembler.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 #define REGISTER_COUNT(R) 1 + | 14 #define REGISTER_COUNT(R) 1 + |
| 15 static const int kMaxAllocatableGeneralRegisterCount = | 15 static const int kMaxAllocatableGeneralRegisterCount = |
| 16 ALLOCATABLE_GENERAL_REGISTERS(REGISTER_COUNT)0; | 16 ALLOCATABLE_GENERAL_REGISTERS(REGISTER_COUNT)0; |
| 17 static const int kMaxAllocatableDoubleRegisterCount = | 17 static const int kMaxAllocatableDoubleRegisterCount = |
| 18 ALLOCATABLE_DOUBLE_REGISTERS(REGISTER_COUNT)0; | 18 ALLOCATABLE_DOUBLE_REGISTERS(REGISTER_COUNT)0; |
| 19 | 19 |
| 20 static const int kAllocatableGeneralCodes[] = { | 20 static const int kAllocatableGeneralCodes[] = { |
| 21 #define REGISTER_CODE(R) Register::kCode_##R, | 21 #define REGISTER_CODE(R) Register::kCode_##R, |
| 22 ALLOCATABLE_GENERAL_REGISTERS(REGISTER_CODE)}; | 22 ALLOCATABLE_GENERAL_REGISTERS(REGISTER_CODE)}; |
| 23 #undef REGISTER_CODE | 23 #undef REGISTER_CODE |
| 24 | 24 |
| 25 #define REGISTER_CODE(R) DoubleRegister::kCode_##R, |
| 25 static const int kAllocatableDoubleCodes[] = { | 26 static const int kAllocatableDoubleCodes[] = { |
| 26 #define REGISTER_CODE(R) DoubleRegister::kCode_##R, | |
| 27 ALLOCATABLE_DOUBLE_REGISTERS(REGISTER_CODE)}; | 27 ALLOCATABLE_DOUBLE_REGISTERS(REGISTER_CODE)}; |
| 28 #if V8_TARGET_ARCH_ARM |
| 29 static const int kAllocatableNoVFP32DoubleCodes[] = { |
| 30 ALLOCATABLE_NO_VFP32_DOUBLE_REGISTERS(REGISTER_CODE)}; |
| 31 #endif // V8_TARGET_ARCH_ARM |
| 28 #undef REGISTER_CODE | 32 #undef REGISTER_CODE |
| 29 | 33 |
| 30 static const char* const kGeneralRegisterNames[] = { | 34 static const char* const kGeneralRegisterNames[] = { |
| 31 #define REGISTER_NAME(R) #R, | 35 #define REGISTER_NAME(R) #R, |
| 32 GENERAL_REGISTERS(REGISTER_NAME) | 36 GENERAL_REGISTERS(REGISTER_NAME) |
| 33 #undef REGISTER_NAME | 37 #undef REGISTER_NAME |
| 34 }; | 38 }; |
| 35 | 39 |
| 36 static const char* const kFloatRegisterNames[] = { | 40 static const char* const kFloatRegisterNames[] = { |
| 37 #define REGISTER_NAME(R) #R, | 41 #define REGISTER_NAME(R) #R, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 kMaxAllocatableDoubleRegisterCount, | 96 kMaxAllocatableDoubleRegisterCount, |
| 93 #elif V8_TARGET_ARCH_PPC | 97 #elif V8_TARGET_ARCH_PPC |
| 94 kMaxAllocatableGeneralRegisterCount, | 98 kMaxAllocatableGeneralRegisterCount, |
| 95 kMaxAllocatableDoubleRegisterCount, | 99 kMaxAllocatableDoubleRegisterCount, |
| 96 #elif V8_TARGET_ARCH_S390 | 100 #elif V8_TARGET_ARCH_S390 |
| 97 kMaxAllocatableGeneralRegisterCount, | 101 kMaxAllocatableGeneralRegisterCount, |
| 98 kMaxAllocatableDoubleRegisterCount, | 102 kMaxAllocatableDoubleRegisterCount, |
| 99 #else | 103 #else |
| 100 #error Unsupported target architecture. | 104 #error Unsupported target architecture. |
| 101 #endif | 105 #endif |
| 102 kAllocatableGeneralCodes, kAllocatableDoubleCodes, | 106 kAllocatableGeneralCodes, |
| 107 #if V8_TARGET_ARCH_ARM |
| 108 CpuFeatures::IsSupported(VFP32DREGS) |
| 109 ? kAllocatableDoubleCodes |
| 110 : kAllocatableNoVFP32DoubleCodes, |
| 111 #else |
| 112 kAllocatableDoubleCodes, |
| 113 #endif |
| 103 kSimpleFPAliasing ? AliasingKind::OVERLAP : AliasingKind::COMBINE, | 114 kSimpleFPAliasing ? AliasingKind::OVERLAP : AliasingKind::COMBINE, |
| 104 kGeneralRegisterNames, kFloatRegisterNames, kDoubleRegisterNames, | 115 kGeneralRegisterNames, kFloatRegisterNames, kDoubleRegisterNames, |
| 105 kSimd128RegisterNames) { | 116 kSimd128RegisterNames) { |
| 106 } | 117 } |
| 107 }; | 118 }; |
| 108 | 119 |
| 109 template <CompilerSelector compiler> | 120 template <CompilerSelector compiler> |
| 110 struct RegisterConfigurationInitializer { | 121 struct RegisterConfigurationInitializer { |
| 111 static void Construct(ArchDefaultRegisterConfiguration* config) { | 122 static void Construct(ArchDefaultRegisterConfiguration* config) { |
| 112 new (config) ArchDefaultRegisterConfiguration(compiler); | 123 new (config) ArchDefaultRegisterConfiguration(compiler); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 return index == other_index >> shift; | 266 return index == other_index >> shift; |
| 256 } | 267 } |
| 257 int shift = other_rep_int - rep_int; | 268 int shift = other_rep_int - rep_int; |
| 258 return index >> shift == other_index; | 269 return index >> shift == other_index; |
| 259 } | 270 } |
| 260 | 271 |
| 261 #undef REGISTER_COUNT | 272 #undef REGISTER_COUNT |
| 262 | 273 |
| 263 } // namespace internal | 274 } // namespace internal |
| 264 } // namespace v8 | 275 } // namespace v8 |
| OLD | NEW |