| Index: src/x87/codegen-x87.cc
|
| diff --git a/src/ia32/codegen-ia32.cc b/src/x87/codegen-x87.cc
|
| similarity index 53%
|
| copy from src/ia32/codegen-ia32.cc
|
| copy to src/x87/codegen-x87.cc
|
| index 04d00648cb944516de086e15c19a5c87d3b7dd5c..01e346f145bf5d5914d1b54d80902b6cc14674c4 100644
|
| --- a/src/ia32/codegen-ia32.cc
|
| +++ b/src/x87/codegen-x87.cc
|
| @@ -4,7 +4,7 @@
|
|
|
| #include "v8.h"
|
|
|
| -#if V8_TARGET_ARCH_IA32
|
| +#if V8_TARGET_ARCH_X87
|
|
|
| #include "codegen.h"
|
| #include "heap.h"
|
| @@ -35,68 +35,14 @@ void StubRuntimeCallHelper::AfterCall(MacroAssembler* masm) const {
|
|
|
|
|
| UnaryMathFunction CreateExpFunction() {
|
| - if (!FLAG_fast_math) return &std::exp;
|
| - size_t actual_size;
|
| - byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true));
|
| - if (buffer == NULL) return &std::exp;
|
| - ExternalReference::InitializeMathExpData();
|
| -
|
| - MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size));
|
| - // esp[1 * kPointerSize]: raw double input
|
| - // esp[0 * kPointerSize]: return address
|
| - {
|
| - XMMRegister input = xmm1;
|
| - XMMRegister result = xmm2;
|
| - __ movsd(input, Operand(esp, 1 * kPointerSize));
|
| - __ push(eax);
|
| - __ push(ebx);
|
| -
|
| - MathExpGenerator::EmitMathExp(&masm, input, result, xmm0, eax, ebx);
|
| -
|
| - __ pop(ebx);
|
| - __ pop(eax);
|
| - __ movsd(Operand(esp, 1 * kPointerSize), result);
|
| - __ fld_d(Operand(esp, 1 * kPointerSize));
|
| - __ Ret();
|
| - }
|
| -
|
| - CodeDesc desc;
|
| - masm.GetCode(&desc);
|
| - ASSERT(!RelocInfo::RequiresRelocation(desc));
|
| -
|
| - CPU::FlushICache(buffer, actual_size);
|
| - OS::ProtectCode(buffer, actual_size);
|
| - return FUNCTION_CAST<UnaryMathFunction>(buffer);
|
| + // No SSE2 support
|
| + return &std::exp;
|
| }
|
|
|
|
|
| UnaryMathFunction CreateSqrtFunction() {
|
| - size_t actual_size;
|
| - // Allocate buffer in executable space.
|
| - byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB,
|
| - &actual_size,
|
| - true));
|
| - if (buffer == NULL) return &std::sqrt;
|
| - MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size));
|
| - // esp[1 * kPointerSize]: raw double input
|
| - // esp[0 * kPointerSize]: return address
|
| - // Move double input into registers.
|
| - {
|
| - __ movsd(xmm0, Operand(esp, 1 * kPointerSize));
|
| - __ sqrtsd(xmm0, xmm0);
|
| - __ movsd(Operand(esp, 1 * kPointerSize), xmm0);
|
| - // Load result into floating point register as return value.
|
| - __ fld_d(Operand(esp, 1 * kPointerSize));
|
| - __ Ret();
|
| - }
|
| -
|
| - CodeDesc desc;
|
| - masm.GetCode(&desc);
|
| - ASSERT(!RelocInfo::RequiresRelocation(desc));
|
| -
|
| - CPU::FlushICache(buffer, actual_size);
|
| - OS::ProtectCode(buffer, actual_size);
|
| - return FUNCTION_CAST<UnaryMathFunction>(buffer);
|
| + // No SSE2 support
|
| + return &std::sqrt;
|
| }
|
|
|
|
|
| @@ -107,62 +53,6 @@ UnaryMathFunction CreateSqrtFunction() {
|
| enum Direction { FORWARD, BACKWARD };
|
| enum Alignment { MOVE_ALIGNED, MOVE_UNALIGNED };
|
|
|
| -// Expects registers:
|
| -// esi - source, aligned if alignment == ALIGNED
|
| -// edi - destination, always aligned
|
| -// ecx - count (copy size in bytes)
|
| -// edx - loop count (number of 64 byte chunks)
|
| -void MemMoveEmitMainLoop(MacroAssembler* masm,
|
| - Label* move_last_15,
|
| - Direction direction,
|
| - Alignment alignment) {
|
| - Register src = esi;
|
| - Register dst = edi;
|
| - Register count = ecx;
|
| - Register loop_count = edx;
|
| - Label loop, move_last_31, move_last_63;
|
| - __ cmp(loop_count, 0);
|
| - __ j(equal, &move_last_63);
|
| - __ bind(&loop);
|
| - // Main loop. Copy in 64 byte chunks.
|
| - if (direction == BACKWARD) __ sub(src, Immediate(0x40));
|
| - __ movdq(alignment == MOVE_ALIGNED, xmm0, Operand(src, 0x00));
|
| - __ movdq(alignment == MOVE_ALIGNED, xmm1, Operand(src, 0x10));
|
| - __ movdq(alignment == MOVE_ALIGNED, xmm2, Operand(src, 0x20));
|
| - __ movdq(alignment == MOVE_ALIGNED, xmm3, Operand(src, 0x30));
|
| - if (direction == FORWARD) __ add(src, Immediate(0x40));
|
| - if (direction == BACKWARD) __ sub(dst, Immediate(0x40));
|
| - __ movdqa(Operand(dst, 0x00), xmm0);
|
| - __ movdqa(Operand(dst, 0x10), xmm1);
|
| - __ movdqa(Operand(dst, 0x20), xmm2);
|
| - __ movdqa(Operand(dst, 0x30), xmm3);
|
| - if (direction == FORWARD) __ add(dst, Immediate(0x40));
|
| - __ dec(loop_count);
|
| - __ j(not_zero, &loop);
|
| - // At most 63 bytes left to copy.
|
| - __ bind(&move_last_63);
|
| - __ test(count, Immediate(0x20));
|
| - __ j(zero, &move_last_31);
|
| - if (direction == BACKWARD) __ sub(src, Immediate(0x20));
|
| - __ movdq(alignment == MOVE_ALIGNED, xmm0, Operand(src, 0x00));
|
| - __ movdq(alignment == MOVE_ALIGNED, xmm1, Operand(src, 0x10));
|
| - if (direction == FORWARD) __ add(src, Immediate(0x20));
|
| - if (direction == BACKWARD) __ sub(dst, Immediate(0x20));
|
| - __ movdqa(Operand(dst, 0x00), xmm0);
|
| - __ movdqa(Operand(dst, 0x10), xmm1);
|
| - if (direction == FORWARD) __ add(dst, Immediate(0x20));
|
| - // At most 31 bytes left to copy.
|
| - __ bind(&move_last_31);
|
| - __ test(count, Immediate(0x10));
|
| - __ j(zero, move_last_15);
|
| - if (direction == BACKWARD) __ sub(src, Immediate(0x10));
|
| - __ movdq(alignment == MOVE_ALIGNED, xmm0, Operand(src, 0));
|
| - if (direction == FORWARD) __ add(src, Immediate(0x10));
|
| - if (direction == BACKWARD) __ sub(dst, Immediate(0x10));
|
| - __ movdqa(Operand(dst, 0), xmm0);
|
| - if (direction == FORWARD) __ add(dst, Immediate(0x10));
|
| -}
|
| -
|
|
|
| void MemMoveEmitPopAndReturn(MacroAssembler* masm) {
|
| __ pop(esi);
|
| @@ -210,16 +100,6 @@ OS::MemMoveFunction CreateMemMoveFunction() {
|
| const int kSourceOffset = 2 * kPointerSize;
|
| const int kSizeOffset = 3 * kPointerSize;
|
|
|
| - // When copying up to this many bytes, use special "small" handlers.
|
| - const size_t kSmallCopySize = 8;
|
| - // When copying up to this many bytes, use special "medium" handlers.
|
| - const size_t kMediumCopySize = 63;
|
| - // When non-overlapping region of src and dst is less than this,
|
| - // use a more careful implementation (slightly slower).
|
| - const size_t kMinMoveDistance = 16;
|
| - // Note that these values are dictated by the implementation below,
|
| - // do not just change them and hope things will work!
|
| -
|
| int stack_offset = 0; // Update if we change the stack height.
|
|
|
| Label backward, backward_much_overlap;
|
| @@ -230,7 +110,6 @@ OS::MemMoveFunction CreateMemMoveFunction() {
|
| Register dst = edi;
|
| Register src = esi;
|
| Register count = ecx;
|
| - Register loop_count = edx;
|
| __ mov(dst, Operand(esp, stack_offset + kDestinationOffset));
|
| __ mov(src, Operand(esp, stack_offset + kSourceOffset));
|
| __ mov(count, Operand(esp, stack_offset + kSizeOffset));
|
| @@ -238,264 +117,62 @@ OS::MemMoveFunction CreateMemMoveFunction() {
|
| __ cmp(dst, src);
|
| __ j(equal, &pop_and_return);
|
|
|
| - __ prefetch(Operand(src, 0), 1);
|
| - __ cmp(count, kSmallCopySize);
|
| - __ j(below_equal, &small_size);
|
| - __ cmp(count, kMediumCopySize);
|
| - __ j(below_equal, &medium_size);
|
| + // No SSE2.
|
| + Label forward;
|
| + __ cmp(count, 0);
|
| + __ j(equal, &pop_and_return);
|
| __ cmp(dst, src);
|
| __ j(above, &backward);
|
| -
|
| + __ jmp(&forward);
|
| {
|
| - // |dst| is a lower address than |src|. Copy front-to-back.
|
| - Label unaligned_source, move_last_15, skip_last_move;
|
| - __ mov(eax, src);
|
| - __ sub(eax, dst);
|
| - __ cmp(eax, kMinMoveDistance);
|
| - __ j(below, &forward_much_overlap);
|
| - // Copy first 16 bytes.
|
| - __ movdqu(xmm0, Operand(src, 0));
|
| - __ movdqu(Operand(dst, 0), xmm0);
|
| - // Determine distance to alignment: 16 - (dst & 0xF).
|
| - __ mov(edx, dst);
|
| - __ and_(edx, 0xF);
|
| - __ neg(edx);
|
| - __ add(edx, Immediate(16));
|
| - __ add(dst, edx);
|
| - __ add(src, edx);
|
| - __ sub(count, edx);
|
| - // dst is now aligned. Main copy loop.
|
| - __ mov(loop_count, count);
|
| - __ shr(loop_count, 6);
|
| - // Check if src is also aligned.
|
| - __ test(src, Immediate(0xF));
|
| - __ j(not_zero, &unaligned_source);
|
| - // Copy loop for aligned source and destination.
|
| - MemMoveEmitMainLoop(&masm, &move_last_15, FORWARD, MOVE_ALIGNED);
|
| - // At most 15 bytes to copy. Copy 16 bytes at end of string.
|
| - __ bind(&move_last_15);
|
| - __ and_(count, 0xF);
|
| - __ j(zero, &skip_last_move, Label::kNear);
|
| - __ movdqu(xmm0, Operand(src, count, times_1, -0x10));
|
| - __ movdqu(Operand(dst, count, times_1, -0x10), xmm0);
|
| - __ bind(&skip_last_move);
|
| - MemMoveEmitPopAndReturn(&masm);
|
| -
|
| - // Copy loop for unaligned source and aligned destination.
|
| - __ bind(&unaligned_source);
|
| - MemMoveEmitMainLoop(&masm, &move_last_15, FORWARD, MOVE_UNALIGNED);
|
| - __ jmp(&move_last_15);
|
| -
|
| - // Less than kMinMoveDistance offset between dst and src.
|
| - Label loop_until_aligned, last_15_much_overlap;
|
| - __ bind(&loop_until_aligned);
|
| + // Simple forward copier.
|
| + Label forward_loop_1byte, forward_loop_4byte;
|
| + __ bind(&forward_loop_4byte);
|
| + __ mov(eax, Operand(src, 0));
|
| + __ sub(count, Immediate(4));
|
| + __ add(src, Immediate(4));
|
| + __ mov(Operand(dst, 0), eax);
|
| + __ add(dst, Immediate(4));
|
| + __ bind(&forward); // Entry point.
|
| + __ cmp(count, 3);
|
| + __ j(above, &forward_loop_4byte);
|
| + __ bind(&forward_loop_1byte);
|
| + __ cmp(count, 0);
|
| + __ j(below_equal, &pop_and_return);
|
| __ mov_b(eax, Operand(src, 0));
|
| + __ dec(count);
|
| __ inc(src);
|
| __ mov_b(Operand(dst, 0), eax);
|
| __ inc(dst);
|
| - __ dec(count);
|
| - __ bind(&forward_much_overlap); // Entry point into this block.
|
| - __ test(dst, Immediate(0xF));
|
| - __ j(not_zero, &loop_until_aligned);
|
| - // dst is now aligned, src can't be. Main copy loop.
|
| - __ mov(loop_count, count);
|
| - __ shr(loop_count, 6);
|
| - MemMoveEmitMainLoop(&masm, &last_15_much_overlap,
|
| - FORWARD, MOVE_UNALIGNED);
|
| - __ bind(&last_15_much_overlap);
|
| - __ and_(count, 0xF);
|
| - __ j(zero, &pop_and_return);
|
| - __ cmp(count, kSmallCopySize);
|
| - __ j(below_equal, &small_size);
|
| - __ jmp(&medium_size);
|
| + __ jmp(&forward_loop_1byte);
|
| }
|
| -
|
| {
|
| - // |dst| is a higher address than |src|. Copy backwards.
|
| - Label unaligned_source, move_first_15, skip_last_move;
|
| + // Simple backward copier.
|
| + Label backward_loop_1byte, backward_loop_4byte, entry_shortcut;
|
| __ bind(&backward);
|
| - // |dst| and |src| always point to the end of what's left to copy.
|
| - __ add(dst, count);
|
| __ add(src, count);
|
| - __ mov(eax, dst);
|
| - __ sub(eax, src);
|
| - __ cmp(eax, kMinMoveDistance);
|
| - __ j(below, &backward_much_overlap);
|
| - // Copy last 16 bytes.
|
| - __ movdqu(xmm0, Operand(src, -0x10));
|
| - __ movdqu(Operand(dst, -0x10), xmm0);
|
| - // Find distance to alignment: dst & 0xF
|
| - __ mov(edx, dst);
|
| - __ and_(edx, 0xF);
|
| - __ sub(dst, edx);
|
| - __ sub(src, edx);
|
| - __ sub(count, edx);
|
| - // dst is now aligned. Main copy loop.
|
| - __ mov(loop_count, count);
|
| - __ shr(loop_count, 6);
|
| - // Check if src is also aligned.
|
| - __ test(src, Immediate(0xF));
|
| - __ j(not_zero, &unaligned_source);
|
| - // Copy loop for aligned source and destination.
|
| - MemMoveEmitMainLoop(&masm, &move_first_15, BACKWARD, MOVE_ALIGNED);
|
| - // At most 15 bytes to copy. Copy 16 bytes at beginning of string.
|
| - __ bind(&move_first_15);
|
| - __ and_(count, 0xF);
|
| - __ j(zero, &skip_last_move, Label::kNear);
|
| - __ sub(src, count);
|
| - __ sub(dst, count);
|
| - __ movdqu(xmm0, Operand(src, 0));
|
| - __ movdqu(Operand(dst, 0), xmm0);
|
| - __ bind(&skip_last_move);
|
| - MemMoveEmitPopAndReturn(&masm);
|
| -
|
| - // Copy loop for unaligned source and aligned destination.
|
| - __ bind(&unaligned_source);
|
| - MemMoveEmitMainLoop(&masm, &move_first_15, BACKWARD, MOVE_UNALIGNED);
|
| - __ jmp(&move_first_15);
|
| -
|
| - // Less than kMinMoveDistance offset between dst and src.
|
| - Label loop_until_aligned, first_15_much_overlap;
|
| - __ bind(&loop_until_aligned);
|
| + __ add(dst, count);
|
| + __ cmp(count, 3);
|
| + __ j(below_equal, &entry_shortcut);
|
| +
|
| + __ bind(&backward_loop_4byte);
|
| + __ sub(src, Immediate(4));
|
| + __ sub(count, Immediate(4));
|
| + __ mov(eax, Operand(src, 0));
|
| + __ sub(dst, Immediate(4));
|
| + __ mov(Operand(dst, 0), eax);
|
| + __ cmp(count, 3);
|
| + __ j(above, &backward_loop_4byte);
|
| + __ bind(&backward_loop_1byte);
|
| + __ cmp(count, 0);
|
| + __ j(below_equal, &pop_and_return);
|
| + __ bind(&entry_shortcut);
|
| __ dec(src);
|
| - __ dec(dst);
|
| - __ mov_b(eax, Operand(src, 0));
|
| - __ mov_b(Operand(dst, 0), eax);
|
| __ dec(count);
|
| - __ bind(&backward_much_overlap); // Entry point into this block.
|
| - __ test(dst, Immediate(0xF));
|
| - __ j(not_zero, &loop_until_aligned);
|
| - // dst is now aligned, src can't be. Main copy loop.
|
| - __ mov(loop_count, count);
|
| - __ shr(loop_count, 6);
|
| - MemMoveEmitMainLoop(&masm, &first_15_much_overlap,
|
| - BACKWARD, MOVE_UNALIGNED);
|
| - __ bind(&first_15_much_overlap);
|
| - __ and_(count, 0xF);
|
| - __ j(zero, &pop_and_return);
|
| - // Small/medium handlers expect dst/src to point to the beginning.
|
| - __ sub(dst, count);
|
| - __ sub(src, count);
|
| - __ cmp(count, kSmallCopySize);
|
| - __ j(below_equal, &small_size);
|
| - __ jmp(&medium_size);
|
| - }
|
| - {
|
| - // Special handlers for 9 <= copy_size < 64. No assumptions about
|
| - // alignment or move distance, so all reads must be unaligned and
|
| - // must happen before any writes.
|
| - Label medium_handlers, f9_16, f17_32, f33_48, f49_63;
|
| -
|
| - __ bind(&f9_16);
|
| - __ movsd(xmm0, Operand(src, 0));
|
| - __ movsd(xmm1, Operand(src, count, times_1, -8));
|
| - __ movsd(Operand(dst, 0), xmm0);
|
| - __ movsd(Operand(dst, count, times_1, -8), xmm1);
|
| - MemMoveEmitPopAndReturn(&masm);
|
| -
|
| - __ bind(&f17_32);
|
| - __ movdqu(xmm0, Operand(src, 0));
|
| - __ movdqu(xmm1, Operand(src, count, times_1, -0x10));
|
| - __ movdqu(Operand(dst, 0x00), xmm0);
|
| - __ movdqu(Operand(dst, count, times_1, -0x10), xmm1);
|
| - MemMoveEmitPopAndReturn(&masm);
|
| -
|
| - __ bind(&f33_48);
|
| - __ movdqu(xmm0, Operand(src, 0x00));
|
| - __ movdqu(xmm1, Operand(src, 0x10));
|
| - __ movdqu(xmm2, Operand(src, count, times_1, -0x10));
|
| - __ movdqu(Operand(dst, 0x00), xmm0);
|
| - __ movdqu(Operand(dst, 0x10), xmm1);
|
| - __ movdqu(Operand(dst, count, times_1, -0x10), xmm2);
|
| - MemMoveEmitPopAndReturn(&masm);
|
| -
|
| - __ bind(&f49_63);
|
| - __ movdqu(xmm0, Operand(src, 0x00));
|
| - __ movdqu(xmm1, Operand(src, 0x10));
|
| - __ movdqu(xmm2, Operand(src, 0x20));
|
| - __ movdqu(xmm3, Operand(src, count, times_1, -0x10));
|
| - __ movdqu(Operand(dst, 0x00), xmm0);
|
| - __ movdqu(Operand(dst, 0x10), xmm1);
|
| - __ movdqu(Operand(dst, 0x20), xmm2);
|
| - __ movdqu(Operand(dst, count, times_1, -0x10), xmm3);
|
| - MemMoveEmitPopAndReturn(&masm);
|
| -
|
| - __ bind(&medium_handlers);
|
| - __ dd(conv.address(&f9_16));
|
| - __ dd(conv.address(&f17_32));
|
| - __ dd(conv.address(&f33_48));
|
| - __ dd(conv.address(&f49_63));
|
| -
|
| - __ bind(&medium_size); // Entry point into this block.
|
| - __ mov(eax, count);
|
| - __ dec(eax);
|
| - __ shr(eax, 4);
|
| - if (FLAG_debug_code) {
|
| - Label ok;
|
| - __ cmp(eax, 3);
|
| - __ j(below_equal, &ok);
|
| - __ int3();
|
| - __ bind(&ok);
|
| - }
|
| - __ mov(eax, Operand(eax, times_4, conv.address(&medium_handlers)));
|
| - __ jmp(eax);
|
| - }
|
| - {
|
| - // Specialized copiers for copy_size <= 8 bytes.
|
| - Label small_handlers, f0, f1, f2, f3, f4, f5_8;
|
| - __ bind(&f0);
|
| - MemMoveEmitPopAndReturn(&masm);
|
| -
|
| - __ bind(&f1);
|
| __ mov_b(eax, Operand(src, 0));
|
| + __ dec(dst);
|
| __ mov_b(Operand(dst, 0), eax);
|
| - MemMoveEmitPopAndReturn(&masm);
|
| -
|
| - __ bind(&f2);
|
| - __ mov_w(eax, Operand(src, 0));
|
| - __ mov_w(Operand(dst, 0), eax);
|
| - MemMoveEmitPopAndReturn(&masm);
|
| -
|
| - __ bind(&f3);
|
| - __ mov_w(eax, Operand(src, 0));
|
| - __ mov_b(edx, Operand(src, 2));
|
| - __ mov_w(Operand(dst, 0), eax);
|
| - __ mov_b(Operand(dst, 2), edx);
|
| - MemMoveEmitPopAndReturn(&masm);
|
| -
|
| - __ bind(&f4);
|
| - __ mov(eax, Operand(src, 0));
|
| - __ mov(Operand(dst, 0), eax);
|
| - MemMoveEmitPopAndReturn(&masm);
|
| -
|
| - __ bind(&f5_8);
|
| - __ mov(eax, Operand(src, 0));
|
| - __ mov(edx, Operand(src, count, times_1, -4));
|
| - __ mov(Operand(dst, 0), eax);
|
| - __ mov(Operand(dst, count, times_1, -4), edx);
|
| - MemMoveEmitPopAndReturn(&masm);
|
| -
|
| - __ bind(&small_handlers);
|
| - __ dd(conv.address(&f0));
|
| - __ dd(conv.address(&f1));
|
| - __ dd(conv.address(&f2));
|
| - __ dd(conv.address(&f3));
|
| - __ dd(conv.address(&f4));
|
| - __ dd(conv.address(&f5_8));
|
| - __ dd(conv.address(&f5_8));
|
| - __ dd(conv.address(&f5_8));
|
| - __ dd(conv.address(&f5_8));
|
| -
|
| - __ bind(&small_size); // Entry point into this block.
|
| - if (FLAG_debug_code) {
|
| - Label ok;
|
| - __ cmp(count, 8);
|
| - __ j(below_equal, &ok);
|
| - __ int3();
|
| - __ bind(&ok);
|
| - }
|
| - __ mov(eax, Operand(count, times_4, conv.address(&small_handlers)));
|
| - __ jmp(eax);
|
| + __ jmp(&backward_loop_1byte);
|
| }
|
|
|
| __ bind(&pop_and_return);
|
| @@ -541,7 +218,6 @@ void ElementsTransitionGenerator::GenerateMapChangeElementsTransition(
|
| HeapObject::kMapOffset,
|
| ebx,
|
| edi,
|
| - kDontSaveFPRegs,
|
| EMIT_REMEMBERED_SET,
|
| OMIT_SMI_CHECK);
|
| }
|
| @@ -595,7 +271,6 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
|
| JSObject::kElementsOffset,
|
| ebx,
|
| edi,
|
| - kDontSaveFPRegs,
|
| EMIT_REMEMBERED_SET,
|
| OMIT_SMI_CHECK);
|
|
|
| @@ -604,9 +279,6 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
|
| // Prepare for conversion loop.
|
| ExternalReference canonical_the_hole_nan_reference =
|
| ExternalReference::address_of_the_hole_nan();
|
| - XMMRegister the_hole_nan = xmm1;
|
| - __ movsd(the_hole_nan,
|
| - Operand::StaticVariable(canonical_the_hole_nan_reference));
|
| __ jmp(&entry);
|
|
|
| // Call into runtime if GC is required.
|
| @@ -627,9 +299,10 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
|
|
|
| // Normal smi, convert it to double and store.
|
| __ SmiUntag(ebx);
|
| - __ Cvtsi2sd(xmm0, ebx);
|
| - __ movsd(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize),
|
| - xmm0);
|
| + __ push(ebx);
|
| + __ fild_s(Operand(esp, 0));
|
| + __ pop(ebx);
|
| + __ fstp_d(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize));
|
| __ jmp(&entry);
|
|
|
| // Found hole, store hole_nan_as_double instead.
|
| @@ -640,8 +313,8 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
|
| __ Assert(equal, kObjectFoundInSmiOnlyArray);
|
| }
|
|
|
| - __ movsd(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize),
|
| - the_hole_nan);
|
| + __ fld_d(Operand::StaticVariable(canonical_the_hole_nan_reference));
|
| + __ fstp_d(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize));
|
|
|
| __ bind(&entry);
|
| __ sub(edi, Immediate(Smi::FromInt(1)));
|
| @@ -662,7 +335,6 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
|
| HeapObject::kMapOffset,
|
| ebx,
|
| edi,
|
| - kDontSaveFPRegs,
|
| OMIT_REMEMBERED_SET,
|
| OMIT_SMI_CHECK);
|
| }
|
| @@ -718,7 +390,6 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
|
| HeapObject::kMapOffset,
|
| ebx,
|
| edi,
|
| - kDontSaveFPRegs,
|
| OMIT_REMEMBERED_SET,
|
| OMIT_SMI_CHECK);
|
| __ jmp(&success);
|
| @@ -743,15 +414,15 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
|
| // Non-hole double, copy value into a heap number.
|
| __ AllocateHeapNumber(edx, esi, no_reg, &gc_required);
|
| // edx: new heap number
|
| - __ movsd(xmm0,
|
| - FieldOperand(edi, ebx, times_4, FixedDoubleArray::kHeaderSize));
|
| - __ movsd(FieldOperand(edx, HeapNumber::kValueOffset), xmm0);
|
| + __ mov(esi, FieldOperand(edi, ebx, times_4, FixedDoubleArray::kHeaderSize));
|
| + __ mov(FieldOperand(edx, HeapNumber::kValueOffset), esi);
|
| + __ mov(esi, FieldOperand(edi, ebx, times_4, offset));
|
| + __ mov(FieldOperand(edx, HeapNumber::kValueOffset + kPointerSize), esi);
|
| __ mov(FieldOperand(eax, ebx, times_2, FixedArray::kHeaderSize), edx);
|
| __ mov(esi, ebx);
|
| __ RecordWriteArray(eax,
|
| edx,
|
| esi,
|
| - kDontSaveFPRegs,
|
| EMIT_REMEMBERED_SET,
|
| OMIT_SMI_CHECK);
|
| __ jmp(&entry, Label::kNear);
|
| @@ -775,7 +446,6 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
|
| HeapObject::kMapOffset,
|
| ebx,
|
| edi,
|
| - kDontSaveFPRegs,
|
| OMIT_REMEMBERED_SET,
|
| OMIT_SMI_CHECK);
|
| // Replace receiver's backing store with newly created and filled FixedArray.
|
| @@ -784,7 +454,6 @@ void ElementsTransitionGenerator::GenerateDoubleToObject(
|
| JSObject::kElementsOffset,
|
| eax,
|
| edi,
|
| - kDontSaveFPRegs,
|
| EMIT_REMEMBERED_SET,
|
| OMIT_SMI_CHECK);
|
|
|
| @@ -900,62 +569,6 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm,
|
| }
|
|
|
|
|
| -static Operand ExpConstant(int index) {
|
| - return Operand::StaticVariable(ExternalReference::math_exp_constants(index));
|
| -}
|
| -
|
| -
|
| -void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
|
| - XMMRegister input,
|
| - XMMRegister result,
|
| - XMMRegister double_scratch,
|
| - Register temp1,
|
| - Register temp2) {
|
| - ASSERT(!input.is(double_scratch));
|
| - ASSERT(!input.is(result));
|
| - ASSERT(!result.is(double_scratch));
|
| - ASSERT(!temp1.is(temp2));
|
| - ASSERT(ExternalReference::math_exp_constants(0).address() != NULL);
|
| -
|
| - Label done;
|
| -
|
| - __ movsd(double_scratch, ExpConstant(0));
|
| - __ xorpd(result, result);
|
| - __ ucomisd(double_scratch, input);
|
| - __ j(above_equal, &done);
|
| - __ ucomisd(input, ExpConstant(1));
|
| - __ movsd(result, ExpConstant(2));
|
| - __ j(above_equal, &done);
|
| - __ movsd(double_scratch, ExpConstant(3));
|
| - __ movsd(result, ExpConstant(4));
|
| - __ mulsd(double_scratch, input);
|
| - __ addsd(double_scratch, result);
|
| - __ movd(temp2, double_scratch);
|
| - __ subsd(double_scratch, result);
|
| - __ movsd(result, ExpConstant(6));
|
| - __ mulsd(double_scratch, ExpConstant(5));
|
| - __ subsd(double_scratch, input);
|
| - __ subsd(result, double_scratch);
|
| - __ movsd(input, double_scratch);
|
| - __ mulsd(input, double_scratch);
|
| - __ mulsd(result, input);
|
| - __ mov(temp1, temp2);
|
| - __ mulsd(result, ExpConstant(7));
|
| - __ subsd(result, double_scratch);
|
| - __ add(temp1, Immediate(0x1ff800));
|
| - __ addsd(result, ExpConstant(8));
|
| - __ and_(temp2, Immediate(0x7ff));
|
| - __ shr(temp1, 11);
|
| - __ shl(temp1, 20);
|
| - __ movd(input, temp1);
|
| - __ pshufd(input, input, static_cast<uint8_t>(0xe1)); // Order: 11 10 00 01
|
| - __ movsd(double_scratch, Operand::StaticArray(
|
| - temp2, times_8, ExternalReference::math_exp_log_table()));
|
| - __ orps(input, double_scratch);
|
| - __ mulsd(result, input);
|
| - __ bind(&done);
|
| -}
|
| -
|
| #undef __
|
|
|
|
|
| @@ -1016,4 +629,4 @@ void Code::PatchPlatformCodeAge(Isolate* isolate,
|
|
|
| } } // namespace v8::internal
|
|
|
| -#endif // V8_TARGET_ARCH_IA32
|
| +#endif // V8_TARGET_ARCH_X87
|
|
|