Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Unified Diff: src/crankshaft/lithium-allocator.cc

Issue 2092413002: [RegisterConfiguration] Streamline access to arch defaults, simplify Registers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compile. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/crankshaft/lithium.cc ('k') | src/crankshaft/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/lithium-allocator.cc
diff --git a/src/crankshaft/lithium-allocator.cc b/src/crankshaft/lithium-allocator.cc
index 6155dc0f2379344ef28e1aae27c504cb98e0a5fa..d17cd27c1072aa19b9f329c7ff06d99c7ba6edce 100644
--- a/src/crankshaft/lithium-allocator.cc
+++ b/src/crankshaft/lithium-allocator.cc
@@ -13,6 +13,8 @@
namespace v8 {
namespace internal {
+const auto GetRegConfig = RegisterConfiguration::Crankshaft;
+
static inline LifetimePosition Min(LifetimePosition a, LifetimePosition b) {
return a.Value() < b.Value() ? a : b;
}
@@ -940,7 +942,7 @@ void LAllocator::ProcessInstructions(HBasicBlock* block, BitVector* live) {
if (instr->ClobbersRegisters()) {
for (int i = 0; i < Register::kNumRegisters; ++i) {
- if (Register::from_code(i).IsAllocatable()) {
+ if (GetRegConfig()->IsAllocatableGeneralCode(i)) {
if (output == NULL || !output->IsRegister() ||
output->index() != i) {
LiveRange* range = FixedLiveRangeFor(i);
@@ -953,7 +955,7 @@ void LAllocator::ProcessInstructions(HBasicBlock* block, BitVector* live) {
if (instr->ClobbersDoubleRegisters(isolate())) {
for (int i = 0; i < DoubleRegister::kMaxNumRegisters; ++i) {
- if (DoubleRegister::from_code(i).IsAllocatable()) {
+ if (GetRegConfig()->IsAllocatableDoubleCode(i)) {
if (output == NULL || !output->IsDoubleRegister() ||
output->index() != i) {
LiveRange* range = FixedDoubleLiveRangeFor(i);
@@ -1460,12 +1462,8 @@ void LAllocator::PopulatePointerMaps() {
void LAllocator::AllocateGeneralRegisters() {
LAllocatorPhase phase("L_Allocate general registers", this);
- num_registers_ =
- RegisterConfiguration::ArchDefault(RegisterConfiguration::CRANKSHAFT)
- ->num_allocatable_general_registers();
- allocatable_register_codes_ =
- RegisterConfiguration::ArchDefault(RegisterConfiguration::CRANKSHAFT)
- ->allocatable_general_codes();
+ num_registers_ = GetRegConfig()->num_allocatable_general_registers();
+ allocatable_register_codes_ = GetRegConfig()->allocatable_general_codes();
mode_ = GENERAL_REGISTERS;
AllocateRegisters();
}
@@ -1473,12 +1471,8 @@ void LAllocator::AllocateGeneralRegisters() {
void LAllocator::AllocateDoubleRegisters() {
LAllocatorPhase phase("L_Allocate double registers", this);
- num_registers_ =
- RegisterConfiguration::ArchDefault(RegisterConfiguration::CRANKSHAFT)
- ->num_allocatable_double_registers();
- allocatable_register_codes_ =
- RegisterConfiguration::ArchDefault(RegisterConfiguration::CRANKSHAFT)
- ->allocatable_double_codes();
+ num_registers_ = GetRegConfig()->num_allocatable_double_registers();
+ allocatable_register_codes_ = GetRegConfig()->allocatable_double_codes();
mode_ = DOUBLE_REGISTERS;
AllocateRegisters();
}
@@ -1596,9 +1590,9 @@ void LAllocator::AllocateRegisters() {
const char* LAllocator::RegisterName(int allocation_index) {
if (mode_ == GENERAL_REGISTERS) {
- return Register::from_code(allocation_index).ToString();
+ return GetRegConfig()->GetGeneralRegisterName(allocation_index);
} else {
- return DoubleRegister::from_code(allocation_index).ToString();
+ return GetRegConfig()->GetDoubleRegisterName(allocation_index);
}
}
« no previous file with comments | « src/crankshaft/lithium.cc ('k') | src/crankshaft/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698