| Index: src/crankshaft/x87/lithium-gap-resolver-x87.cc
|
| diff --git a/src/crankshaft/x87/lithium-gap-resolver-x87.cc b/src/crankshaft/x87/lithium-gap-resolver-x87.cc
|
| index 74cb0ebf530b7a7657df7ca41da9a34c6a1292fc..aa9183541fc8b34c20328c15ba6c4b7012e04074 100644
|
| --- a/src/crankshaft/x87/lithium-gap-resolver-x87.cc
|
| +++ b/src/crankshaft/x87/lithium-gap-resolver-x87.cc
|
| @@ -5,6 +5,7 @@
|
| #if V8_TARGET_ARCH_X87
|
|
|
| #include "src/crankshaft/x87/lithium-gap-resolver-x87.h"
|
| +#include "src/register-configuration.h"
|
|
|
| #include "src/crankshaft/x87/lithium-codegen-x87.h"
|
|
|
| @@ -166,10 +167,14 @@ 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(RegisterConfiguration::CRANKSHAFT);
|
| + 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;
|
| @@ -179,10 +184,12 @@ 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(RegisterConfiguration::CRANKSHAFT);
|
| + 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;
|
| }
|
| @@ -205,7 +212,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);
|
| @@ -214,7 +221,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;
|
| }
|
| }
|
| @@ -223,7 +230,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.
|
| @@ -232,19 +239,22 @@ 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(RegisterConfiguration::CRANKSHAFT);
|
| + 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;
|
| }
|
|
|
|
|