Index: src/ia32/lithium-gap-resolver-ia32.cc |
diff --git a/src/ia32/lithium-gap-resolver-ia32.cc b/src/ia32/lithium-gap-resolver-ia32.cc |
index 0926a0f21a1d4b0a873998232e3a8d501a880d1a..655f4a2efb71e633fe62b2d06b9d91c7817a5145 100644 |
--- a/src/ia32/lithium-gap-resolver-ia32.cc |
+++ b/src/ia32/lithium-gap-resolver-ia32.cc |
@@ -6,6 +6,7 @@ |
#include "src/ia32/lithium-codegen-ia32.h" |
#include "src/ia32/lithium-gap-resolver-ia32.h" |
+#include "src/register-configuration.h" |
namespace v8 { |
namespace internal { |
@@ -165,10 +166,13 @@ int LGapResolver::CountSourceUses(LOperand* operand) { |
Register LGapResolver::GetFreeRegisterNot(Register reg) { |
- int skip_index = reg.is(no_reg) ? -1 : Register::ToAllocationIndex(reg); |
- for (int i = 0; i < Register::NumAllocatableRegisters(); ++i) { |
- if (source_uses_[i] == 0 && destination_uses_[i] > 0 && i != skip_index) { |
- return Register::FromAllocationIndex(i); |
+ int skip_index = reg.is(no_reg) ? -1 : reg.code(); |
+ const RegisterConfiguration* config = RegisterConfiguration::ArchDefault(); |
+ for (int i = 0; i < config->num_allocatable_general_registers(); ++i) { |
+ int code = config->GetAllocatableGeneralCode(i); |
+ if (source_uses_[code] == 0 && destination_uses_[code] > 0 && |
+ code != skip_index) { |
+ return Register::from_code(code); |
} |
} |
return no_reg; |
@@ -178,10 +182,11 @@ Register LGapResolver::GetFreeRegisterNot(Register reg) { |
bool LGapResolver::HasBeenReset() { |
if (!moves_.is_empty()) return false; |
if (spilled_register_ >= 0) return false; |
- |
- for (int i = 0; i < Register::NumAllocatableRegisters(); ++i) { |
- if (source_uses_[i] != 0) return false; |
- if (destination_uses_[i] != 0) return false; |
+ const RegisterConfiguration* config = RegisterConfiguration::ArchDefault(); |
+ for (int i = 0; i < config->num_allocatable_general_registers(); ++i) { |
+ int code = config->GetAllocatableGeneralCode(i); |
+ if (source_uses_[code] != 0) return false; |
+ if (destination_uses_[code] != 0) return false; |
} |
return true; |
} |
@@ -204,7 +209,7 @@ void LGapResolver::Verify() { |
void LGapResolver::Finish() { |
if (spilled_register_ >= 0) { |
- __ pop(Register::FromAllocationIndex(spilled_register_)); |
+ __ pop(Register::from_code(spilled_register_)); |
spilled_register_ = -1; |
} |
moves_.Rewind(0); |
@@ -213,7 +218,7 @@ void LGapResolver::Finish() { |
void LGapResolver::EnsureRestored(LOperand* operand) { |
if (operand->IsRegister() && operand->index() == spilled_register_) { |
- __ pop(Register::FromAllocationIndex(spilled_register_)); |
+ __ pop(Register::from_code(spilled_register_)); |
spilled_register_ = -1; |
} |
} |
@@ -222,7 +227,7 @@ void LGapResolver::EnsureRestored(LOperand* operand) { |
Register LGapResolver::EnsureTempRegister() { |
// 1. We may have already spilled to create a temp register. |
if (spilled_register_ >= 0) { |
- return Register::FromAllocationIndex(spilled_register_); |
+ return Register::from_code(spilled_register_); |
} |
// 2. We may have a free register that we can use without spilling. |
@@ -231,19 +236,21 @@ Register LGapResolver::EnsureTempRegister() { |
// 3. Prefer to spill a register that is not used in any remaining move |
// because it will not need to be restored until the end. |
- for (int i = 0; i < Register::NumAllocatableRegisters(); ++i) { |
- if (source_uses_[i] == 0 && destination_uses_[i] == 0) { |
- Register scratch = Register::FromAllocationIndex(i); |
+ const RegisterConfiguration* config = RegisterConfiguration::ArchDefault(); |
+ for (int i = 0; i < config->num_allocatable_general_registers(); ++i) { |
+ int code = config->GetAllocatableGeneralCode(i); |
+ if (source_uses_[code] == 0 && destination_uses_[code] == 0) { |
+ Register scratch = Register::from_code(code); |
__ push(scratch); |
- spilled_register_ = i; |
+ spilled_register_ = code; |
return scratch; |
} |
} |
// 4. Use an arbitrary register. Register 0 is as arbitrary as any other. |
- Register scratch = Register::FromAllocationIndex(0); |
+ spilled_register_ = config->GetAllocatableGeneralCode(0); |
+ Register scratch = Register::from_code(spilled_register_); |
__ push(scratch); |
- spilled_register_ = 0; |
return scratch; |
} |