| Index: src/x87/lithium-gap-resolver-x87.cc
|
| diff --git a/src/ia32/lithium-gap-resolver-ia32.cc b/src/x87/lithium-gap-resolver-x87.cc
|
| similarity index 82%
|
| copy from src/ia32/lithium-gap-resolver-ia32.cc
|
| copy to src/x87/lithium-gap-resolver-x87.cc
|
| index c80f89b86b9beb29b164ba201f48b1a39ac8861a..ce2140cd277c382b67b70b1b48156efa9d3cefa1 100644
|
| --- a/src/ia32/lithium-gap-resolver-ia32.cc
|
| +++ b/src/x87/lithium-gap-resolver-x87.cc
|
| @@ -4,10 +4,10 @@
|
|
|
| #include "v8.h"
|
|
|
| -#if V8_TARGET_ARCH_IA32
|
| +#if V8_TARGET_ARCH_X87
|
|
|
| -#include "ia32/lithium-gap-resolver-ia32.h"
|
| -#include "ia32/lithium-codegen-ia32.h"
|
| +#include "x87/lithium-gap-resolver-x87.h"
|
| +#include "x87/lithium-codegen-x87.h"
|
|
|
| namespace v8 {
|
| namespace internal {
|
| @@ -295,15 +295,11 @@ void LGapResolver::EmitMove(int index) {
|
| uint64_t int_val = BitCast<uint64_t, double>(v);
|
| int32_t lower = static_cast<int32_t>(int_val);
|
| int32_t upper = static_cast<int32_t>(int_val >> kBitsPerInt);
|
| - XMMRegister dst = cgen_->ToDoubleRegister(destination);
|
| - if (int_val == 0) {
|
| - __ xorps(dst, dst);
|
| - } else {
|
| - __ push(Immediate(upper));
|
| - __ push(Immediate(lower));
|
| - __ movsd(dst, Operand(esp, 0));
|
| - __ add(esp, Immediate(kDoubleSize));
|
| - }
|
| + __ push(Immediate(upper));
|
| + __ push(Immediate(lower));
|
| + X87Register dst = cgen_->ToX87Register(destination);
|
| + cgen_->X87Mov(dst, MemOperand(esp, 0));
|
| + __ add(esp, Immediate(kDoubleSize));
|
| } else {
|
| ASSERT(destination->IsStackSlot());
|
| Operand dst = cgen_->ToOperand(destination);
|
| @@ -319,27 +315,30 @@ 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);
|
| - } else {
|
| - ASSERT(destination->IsDoubleStackSlot());
|
| - Operand dst = cgen_->ToOperand(destination);
|
| - __ movsd(dst, src);
|
| - }
|
| + // load from the register onto the stack, store in destination, which must
|
| + // be a double stack slot in the non-SSE2 case.
|
| + ASSERT(destination->IsDoubleStackSlot());
|
| + Operand dst = cgen_->ToOperand(destination);
|
| + X87Register src = cgen_->ToX87Register(source);
|
| + cgen_->X87Mov(dst, src);
|
| } else if (source->IsDoubleStackSlot()) {
|
| - ASSERT(destination->IsDoubleRegister() ||
|
| - destination->IsDoubleStackSlot());
|
| - Operand src = cgen_->ToOperand(source);
|
| - if (destination->IsDoubleRegister()) {
|
| - XMMRegister dst = cgen_->ToDoubleRegister(destination);
|
| - __ movsd(dst, src);
|
| + // load from the stack slot on top of the floating point stack, and then
|
| + // store in destination. If destination is a double register, then it
|
| + // represents the top of the stack and nothing needs to be done.
|
| + if (destination->IsDoubleStackSlot()) {
|
| + Register tmp = EnsureTempRegister();
|
| + Operand src0 = cgen_->ToOperand(source);
|
| + Operand src1 = cgen_->HighOperand(source);
|
| + Operand dst0 = cgen_->ToOperand(destination);
|
| + Operand dst1 = cgen_->HighOperand(destination);
|
| + __ mov(tmp, src0); // Then use tmp to copy source to destination.
|
| + __ mov(dst0, tmp);
|
| + __ mov(tmp, src1);
|
| + __ mov(dst1, tmp);
|
| } else {
|
| - // We rely on having xmm0 available as a fixed scratch register.
|
| - Operand dst = cgen_->ToOperand(destination);
|
| - __ movsd(xmm0, src);
|
| - __ movsd(dst, xmm0);
|
| + Operand src = cgen_->ToOperand(source);
|
| + X87Register dst = cgen_->ToX87Register(destination);
|
| + cgen_->X87Mov(dst, src);
|
| }
|
| } else {
|
| UNREACHABLE();
|
| @@ -403,42 +402,6 @@ void LGapResolver::EmitSwap(int index) {
|
| __ mov(dst, tmp1);
|
| __ mov(src, tmp0);
|
| }
|
| - } else if (source->IsDoubleRegister() && destination->IsDoubleRegister()) {
|
| - // XMM register-register swap. We rely on having xmm0
|
| - // available as a fixed scratch register.
|
| - XMMRegister src = cgen_->ToDoubleRegister(source);
|
| - XMMRegister dst = cgen_->ToDoubleRegister(destination);
|
| - __ movaps(xmm0, src);
|
| - __ movaps(src, dst);
|
| - __ movaps(dst, xmm0);
|
| - } else if (source->IsDoubleRegister() || destination->IsDoubleRegister()) {
|
| - // XMM register-memory swap. We rely on having xmm0
|
| - // available as a fixed scratch register.
|
| - ASSERT(source->IsDoubleStackSlot() || destination->IsDoubleStackSlot());
|
| - XMMRegister reg = cgen_->ToDoubleRegister(source->IsDoubleRegister()
|
| - ? source
|
| - : destination);
|
| - Operand other =
|
| - cgen_->ToOperand(source->IsDoubleRegister() ? destination : source);
|
| - __ movsd(xmm0, other);
|
| - __ movsd(other, reg);
|
| - __ movaps(reg, xmm0);
|
| - } else if (source->IsDoubleStackSlot() && destination->IsDoubleStackSlot()) {
|
| - // Double-width memory-to-memory. Spill on demand to use a general
|
| - // purpose temporary register and also rely on having xmm0 available as
|
| - // a fixed scratch register.
|
| - Register tmp = EnsureTempRegister();
|
| - Operand src0 = cgen_->ToOperand(source);
|
| - Operand src1 = cgen_->HighOperand(source);
|
| - Operand dst0 = cgen_->ToOperand(destination);
|
| - Operand dst1 = cgen_->HighOperand(destination);
|
| - __ movsd(xmm0, dst0); // Save destination in xmm0.
|
| - __ mov(tmp, src0); // Then use tmp to copy source to destination.
|
| - __ mov(dst0, tmp);
|
| - __ mov(tmp, src1);
|
| - __ mov(dst1, tmp);
|
| - __ movsd(src0, xmm0);
|
| -
|
| } else {
|
| // No other combinations are possible.
|
| UNREACHABLE();
|
| @@ -479,4 +442,4 @@ void LGapResolver::EmitSwap(int index) {
|
|
|
| } } // namespace v8::internal
|
|
|
| -#endif // V8_TARGET_ARCH_IA32
|
| +#endif // V8_TARGET_ARCH_X87
|
|
|