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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
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 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 ASSERT(destination.IsQuadStackSlot()); | 1588 ASSERT(destination.IsQuadStackSlot()); |
1589 __ movups(XMM0, source.ToStackSlotAddress()); | 1589 __ movups(XMM0, source.ToStackSlotAddress()); |
1590 __ movups(destination.ToStackSlotAddress(), XMM0); | 1590 __ movups(destination.ToStackSlotAddress(), XMM0); |
1591 } | 1591 } |
1592 } else { | 1592 } else { |
1593 ASSERT(source.IsConstant()); | 1593 ASSERT(source.IsConstant()); |
1594 const Object& constant = source.constant(); | 1594 const Object& constant = source.constant(); |
1595 if (destination.IsRegister()) { | 1595 if (destination.IsRegister()) { |
1596 if (constant.IsSmi() && (Smi::Cast(constant).Value() == 0)) { | 1596 if (constant.IsSmi() && (Smi::Cast(constant).Value() == 0)) { |
1597 __ xorq(destination.reg(), destination.reg()); | 1597 __ xorq(destination.reg(), destination.reg()); |
| 1598 } else if (constant.IsSmi() && |
| 1599 (source.constant_instruction()->representation() == kUnboxedInt32)) { |
| 1600 __ movl(destination.reg(), Immediate(Smi::Cast(constant).Value())); |
1598 } else { | 1601 } else { |
1599 __ LoadObject(destination.reg(), constant, PP); | 1602 __ LoadObject(destination.reg(), constant, PP); |
1600 } | 1603 } |
1601 } else if (destination.IsFpuRegister()) { | 1604 } else if (destination.IsFpuRegister()) { |
1602 if (Utils::DoublesBitEqual(Double::Cast(constant).value(), 0.0)) { | 1605 if (Utils::DoublesBitEqual(Double::Cast(constant).value(), 0.0)) { |
1603 __ xorps(destination.fpu_reg(), destination.fpu_reg()); | 1606 __ xorps(destination.fpu_reg(), destination.fpu_reg()); |
1604 } else { | 1607 } else { |
1605 __ LoadObject(TMP, constant, PP); | 1608 __ LoadObject(TMP, constant, PP); |
1606 __ movsd(destination.fpu_reg(), | 1609 __ movsd(destination.fpu_reg(), |
1607 FieldAddress(TMP, Double::value_offset())); | 1610 FieldAddress(TMP, Double::value_offset())); |
1608 } | 1611 } |
1609 } else if (destination.IsDoubleStackSlot()) { | 1612 } else if (destination.IsDoubleStackSlot()) { |
1610 if (Utils::DoublesBitEqual(Double::Cast(constant).value(), 0.0)) { | 1613 if (Utils::DoublesBitEqual(Double::Cast(constant).value(), 0.0)) { |
1611 __ xorps(XMM0, XMM0); | 1614 __ xorps(XMM0, XMM0); |
1612 } else { | 1615 } else { |
1613 __ LoadObject(TMP, constant, PP); | 1616 __ LoadObject(TMP, constant, PP); |
1614 __ movsd(XMM0, FieldAddress(TMP, Double::value_offset())); | 1617 __ movsd(XMM0, FieldAddress(TMP, Double::value_offset())); |
1615 } | 1618 } |
1616 __ movsd(destination.ToStackSlotAddress(), XMM0); | 1619 __ movsd(destination.ToStackSlotAddress(), XMM0); |
1617 } else { | 1620 } else { |
1618 ASSERT(destination.IsStackSlot()); | 1621 ASSERT(destination.IsStackSlot()); |
1619 StoreObject(destination.ToStackSlotAddress(), constant); | 1622 if (constant.IsSmi() && |
| 1623 (source.constant_instruction()->representation() == kUnboxedInt32)) { |
| 1624 __ movl(destination.ToStackSlotAddress(), |
| 1625 Immediate(Smi::Cast(constant).Value())); |
| 1626 } else { |
| 1627 StoreObject(destination.ToStackSlotAddress(), constant); |
| 1628 } |
1620 } | 1629 } |
1621 } | 1630 } |
1622 | 1631 |
1623 move->Eliminate(); | 1632 move->Eliminate(); |
1624 } | 1633 } |
1625 | 1634 |
1626 | 1635 |
1627 void ParallelMoveResolver::EmitSwap(int index) { | 1636 void ParallelMoveResolver::EmitSwap(int index) { |
1628 MoveOperands* move = moves_[index]; | 1637 MoveOperands* move = moves_[index]; |
1629 const Location source = move->src(); | 1638 const Location source = move->src(); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 __ movups(reg, Address(RSP, 0)); | 1767 __ movups(reg, Address(RSP, 0)); |
1759 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1768 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); |
1760 } | 1769 } |
1761 | 1770 |
1762 | 1771 |
1763 #undef __ | 1772 #undef __ |
1764 | 1773 |
1765 } // namespace dart | 1774 } // namespace dart |
1766 | 1775 |
1767 #endif // defined TARGET_ARCH_X64 | 1776 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |