| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1728 instance_call()->ArgumentCount(), | 1728 instance_call()->ArgumentCount(), |
| 1729 instance_call()->argument_names(), | 1729 instance_call()->argument_names(), |
| 1730 locs()); | 1730 locs()); |
| 1731 ASSERT(result == EAX); | 1731 ASSERT(result == EAX); |
| 1732 } | 1732 } |
| 1733 } | 1733 } |
| 1734 __ Bind(&done); | 1734 __ Bind(&done); |
| 1735 } | 1735 } |
| 1736 | 1736 |
| 1737 | 1737 |
| 1738 LocationSummary* BinaryDoubleOpComp::MakeLocationSummary() const { | |
| 1739 return MakeCallSummary(); // Calls into a stub for allocation. | |
| 1740 } | |
| 1741 | |
| 1742 | |
| 1743 void BinaryDoubleOpComp::EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 1744 Register left = EBX; | |
| 1745 Register right = ECX; | |
| 1746 Register temp = EDX; | |
| 1747 Register result = locs()->out().reg(); | |
| 1748 | |
| 1749 const Class& double_class = compiler->double_class(); | |
| 1750 const Code& stub = | |
| 1751 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); | |
| 1752 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); | |
| 1753 compiler->GenerateCall(instance_call()->token_pos(), | |
| 1754 &label, | |
| 1755 PcDescriptors::kOther, | |
| 1756 locs()); | |
| 1757 // Newly allocated object is now in the result register (RAX). | |
| 1758 ASSERT(result == EAX); | |
| 1759 __ movl(right, Address(ESP, 0)); | |
| 1760 __ movl(left, Address(ESP, kWordSize)); | |
| 1761 | |
| 1762 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), | |
| 1763 kDeoptBinaryDoubleOp); | |
| 1764 | |
| 1765 // Binary operation of two Smi's produces a Smi not a double. | |
| 1766 __ movl(temp, left); | |
| 1767 __ orl(temp, right); | |
| 1768 __ testl(temp, Immediate(kSmiTagMask)); | |
| 1769 __ j(ZERO, deopt); | |
| 1770 | |
| 1771 compiler->LoadDoubleOrSmiToXmm(XMM0, left, temp, deopt); | |
| 1772 compiler->LoadDoubleOrSmiToXmm(XMM1, right, temp, deopt); | |
| 1773 | |
| 1774 switch (op_kind()) { | |
| 1775 case Token::kADD: __ addsd(XMM0, XMM1); break; | |
| 1776 case Token::kSUB: __ subsd(XMM0, XMM1); break; | |
| 1777 case Token::kMUL: __ mulsd(XMM0, XMM1); break; | |
| 1778 case Token::kDIV: __ divsd(XMM0, XMM1); break; | |
| 1779 default: UNREACHABLE(); | |
| 1780 } | |
| 1781 | |
| 1782 __ movsd(FieldAddress(result, Double::value_offset()), XMM0); | |
| 1783 | |
| 1784 __ Drop(2); | |
| 1785 } | |
| 1786 | |
| 1787 | |
| 1788 LocationSummary* CheckEitherNonSmiComp::MakeLocationSummary() const { | 1738 LocationSummary* CheckEitherNonSmiComp::MakeLocationSummary() const { |
| 1789 ASSERT((left()->ResultCid() != kDoubleCid) && | 1739 ASSERT((left()->ResultCid() != kDoubleCid) && |
| 1790 (right()->ResultCid() != kDoubleCid)); | 1740 (right()->ResultCid() != kDoubleCid)); |
| 1791 const intptr_t kNumInputs = 2; | 1741 const intptr_t kNumInputs = 2; |
| 1792 const intptr_t kNumTemps = 1; | 1742 const intptr_t kNumTemps = 1; |
| 1793 LocationSummary* summary = | 1743 LocationSummary* summary = |
| 1794 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1744 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1795 summary->set_in(0, Location::RequiresRegister()); | 1745 summary->set_in(0, Location::RequiresRegister()); |
| 1796 summary->set_in(1, Location::RequiresRegister()); | 1746 summary->set_in(1, Location::RequiresRegister()); |
| 1797 summary->set_temp(0, Location::RequiresRegister()); | 1747 summary->set_temp(0, Location::RequiresRegister()); |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2220 } | 2170 } |
| 2221 __ j(ABOVE_EQUAL, deopt); | 2171 __ j(ABOVE_EQUAL, deopt); |
| 2222 } | 2172 } |
| 2223 | 2173 |
| 2224 | 2174 |
| 2225 } // namespace dart | 2175 } // namespace dart |
| 2226 | 2176 |
| 2227 #undef __ | 2177 #undef __ |
| 2228 | 2178 |
| 2229 #endif // defined TARGET_ARCH_X64 | 2179 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |