OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
9 | 9 |
10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 } | 1587 } |
1588 } else if (destination.IsFpuRegister()) { | 1588 } else if (destination.IsFpuRegister()) { |
1589 const Double& constant = Double::Cast(source.constant()); | 1589 const Double& constant = Double::Cast(source.constant()); |
1590 uword addr = FlowGraphBuilder::FindDoubleConstant(constant.value()); | 1590 uword addr = FlowGraphBuilder::FindDoubleConstant(constant.value()); |
1591 if (addr == 0) { | 1591 if (addr == 0) { |
1592 __ pushl(EAX); | 1592 __ pushl(EAX); |
1593 __ LoadObject(EAX, constant); | 1593 __ LoadObject(EAX, constant); |
1594 __ movsd(destination.fpu_reg(), | 1594 __ movsd(destination.fpu_reg(), |
1595 FieldAddress(EAX, Double::value_offset())); | 1595 FieldAddress(EAX, Double::value_offset())); |
1596 __ popl(EAX); | 1596 __ popl(EAX); |
| 1597 } else if (Utils::DoublesBitEqual(constant.value(), 0.0)) { |
| 1598 __ xorps(destination.fpu_reg(), destination.fpu_reg()); |
1597 } else { | 1599 } else { |
1598 __ movsd(destination.fpu_reg(), Address::Absolute(addr)); | 1600 __ movsd(destination.fpu_reg(), Address::Absolute(addr)); |
1599 } | 1601 } |
1600 } else if (destination.IsDoubleStackSlot()) { | 1602 } else if (destination.IsDoubleStackSlot()) { |
1601 const Double& constant = Double::Cast(source.constant()); | 1603 const Double& constant = Double::Cast(source.constant()); |
1602 uword addr = FlowGraphBuilder::FindDoubleConstant(constant.value()); | 1604 uword addr = FlowGraphBuilder::FindDoubleConstant(constant.value()); |
1603 if (addr == 0) { | 1605 if (addr == 0) { |
1604 __ pushl(EAX); | 1606 __ pushl(EAX); |
1605 __ LoadObject(EAX, constant); | 1607 __ LoadObject(EAX, constant); |
1606 __ movsd(XMM0, FieldAddress(EAX, Double::value_offset())); | 1608 __ movsd(XMM0, FieldAddress(EAX, Double::value_offset())); |
1607 __ popl(EAX); | 1609 __ popl(EAX); |
| 1610 } else if (Utils::DoublesBitEqual(constant.value(), 0.0)) { |
| 1611 __ xorps(XMM0, XMM0); |
1608 } else { | 1612 } else { |
1609 __ movsd(XMM0, Address::Absolute(addr)); | 1613 __ movsd(XMM0, Address::Absolute(addr)); |
1610 } | 1614 } |
1611 __ movsd(destination.ToStackSlotAddress(), XMM0); | 1615 __ movsd(destination.ToStackSlotAddress(), XMM0); |
1612 } else { | 1616 } else { |
1613 ASSERT(destination.IsStackSlot()); | 1617 ASSERT(destination.IsStackSlot()); |
1614 StoreObject(destination.ToStackSlotAddress(), source.constant()); | 1618 StoreObject(destination.ToStackSlotAddress(), source.constant()); |
1615 } | 1619 } |
1616 } | 1620 } |
1617 | 1621 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 __ movups(reg, Address(ESP, 0)); | 1769 __ movups(reg, Address(ESP, 0)); |
1766 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1770 __ addl(ESP, Immediate(kFpuRegisterSize)); |
1767 } | 1771 } |
1768 | 1772 |
1769 | 1773 |
1770 #undef __ | 1774 #undef __ |
1771 | 1775 |
1772 } // namespace dart | 1776 } // namespace dart |
1773 | 1777 |
1774 #endif // defined TARGET_ARCH_IA32 | 1778 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |