| 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 6428916fefa5119662d5583b10855a5a75276af7..3cd2175da900723645da504c0ceda248aefe12f8 100644
|
| --- a/src/ia32/lithium-gap-resolver-ia32.cc
|
| +++ b/src/ia32/lithium-gap-resolver-ia32.cc
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2011 the V8 project authors. All rights reserved.
|
| +// Copyright 2012 the V8 project authors. All rights reserved.
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| // met:
|
| @@ -191,7 +191,7 @@ 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::kNumAllocatableRegisters; ++i) {
|
| + for (int i = 0; i < Register::NumAllocatableRegisters(); ++i) {
|
| if (source_uses_[i] == 0 && destination_uses_[i] > 0 && i != skip_index) {
|
| return Register::FromAllocationIndex(i);
|
| }
|
| @@ -204,7 +204,7 @@ bool LGapResolver::HasBeenReset() {
|
| if (!moves_.is_empty()) return false;
|
| if (spilled_register_ >= 0) return false;
|
|
|
| - for (int i = 0; i < Register::kNumAllocatableRegisters; ++i) {
|
| + for (int i = 0; i < Register::NumAllocatableRegisters(); ++i) {
|
| if (source_uses_[i] != 0) return false;
|
| if (destination_uses_[i] != 0) return false;
|
| }
|
| @@ -256,7 +256,7 @@ 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::kNumAllocatableRegisters; ++i) {
|
| + for (int i = 0; i < Register::NumAllocatableRegisters(); ++i) {
|
| if (source_uses_[i] == 0 && destination_uses_[i] == 0) {
|
| Register scratch = Register::FromAllocationIndex(i);
|
| __ push(scratch);
|
| @@ -324,29 +324,38 @@ void LGapResolver::EmitMove(int index) {
|
| }
|
|
|
| } else if (source->IsDoubleRegister()) {
|
| - XMMRegister src = cgen_->ToDoubleRegister(source);
|
| - if (destination->IsDoubleRegister()) {
|
| - XMMRegister dst = cgen_->ToDoubleRegister(destination);
|
| - __ movaps(dst, src);
|
| + if (CpuFeatures::IsSupported(SSE2)) {
|
| + CpuFeatures::Scope scope(SSE2);
|
| + XMMRegister src = cgen_->ToDoubleRegister(source);
|
| + if (destination->IsDoubleRegister()) {
|
| + XMMRegister dst = cgen_->ToDoubleRegister(destination);
|
| + __ movaps(dst, src);
|
| + } else {
|
| + ASSERT(destination->IsDoubleStackSlot());
|
| + Operand dst = cgen_->ToOperand(destination);
|
| + __ movdbl(dst, src);
|
| + }
|
| } else {
|
| - ASSERT(destination->IsDoubleStackSlot());
|
| - Operand dst = cgen_->ToOperand(destination);
|
| - __ movdbl(dst, src);
|
| + UNREACHABLE();
|
| }
|
| } else if (source->IsDoubleStackSlot()) {
|
| - ASSERT(destination->IsDoubleRegister() ||
|
| - destination->IsDoubleStackSlot());
|
| - Operand src = cgen_->ToOperand(source);
|
| - if (destination->IsDoubleRegister()) {
|
| - XMMRegister dst = cgen_->ToDoubleRegister(destination);
|
| - __ movdbl(dst, src);
|
| + if (CpuFeatures::IsSupported(SSE2)) {
|
| + CpuFeatures::Scope scope(SSE2);
|
| + ASSERT(destination->IsDoubleRegister() ||
|
| + destination->IsDoubleStackSlot());
|
| + Operand src = cgen_->ToOperand(source);
|
| + if (destination->IsDoubleRegister()) {
|
| + XMMRegister dst = cgen_->ToDoubleRegister(destination);
|
| + __ movdbl(dst, src);
|
| + } else {
|
| + // We rely on having xmm0 available as a fixed scratch register.
|
| + Operand dst = cgen_->ToOperand(destination);
|
| + __ movdbl(xmm0, src);
|
| + __ movdbl(dst, xmm0);
|
| + }
|
| } else {
|
| - // We rely on having xmm0 available as a fixed scratch register.
|
| - Operand dst = cgen_->ToOperand(destination);
|
| - __ movdbl(xmm0, src);
|
| - __ movdbl(dst, xmm0);
|
| + UNREACHABLE();
|
| }
|
| -
|
| } else {
|
| UNREACHABLE();
|
| }
|
| @@ -410,6 +419,7 @@ void LGapResolver::EmitSwap(int index) {
|
| __ mov(src, tmp0);
|
| }
|
| } else if (source->IsDoubleRegister() && destination->IsDoubleRegister()) {
|
| + CpuFeatures::Scope scope(SSE2);
|
| // XMM register-register swap. We rely on having xmm0
|
| // available as a fixed scratch register.
|
| XMMRegister src = cgen_->ToDoubleRegister(source);
|
|
|