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_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/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "lib/error.h" | 10 #include "lib/error.h" |
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 const Class& double_class = compiler->double_class(); | 1771 const Class& double_class = compiler->double_class(); |
1772 const Code& stub = | 1772 const Code& stub = |
1773 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); | 1773 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); |
1774 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); | 1774 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); |
1775 compiler->GenerateCall(instance_call()->token_pos(), | 1775 compiler->GenerateCall(instance_call()->token_pos(), |
1776 instance_call()->try_index(), | 1776 instance_call()->try_index(), |
1777 &label, | 1777 &label, |
1778 PcDescriptors::kOther); | 1778 PcDescriptors::kOther); |
1779 // Newly allocated object is now in the result register (RAX). | 1779 // Newly allocated object is now in the result register (RAX). |
1780 ASSERT(result == RAX); | 1780 ASSERT(result == RAX); |
1781 __ popq(right); | 1781 __ movq(right, Address(ESP, 0)); |
1782 __ popq(left); | 1782 __ movq(left, Address(ESP, kWordSize)); |
1783 | 1783 |
1784 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), | 1784 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), |
1785 instance_call()->token_pos(), | 1785 instance_call()->token_pos(), |
1786 instance_call()->try_index(), | 1786 instance_call()->try_index(), |
1787 kDeoptDoubleBinaryOp, | 1787 kDeoptDoubleBinaryOp); |
1788 left, | |
1789 right); | |
1790 | 1788 |
1791 // Binary operation of two Smi's produces a Smi not a double. | 1789 // Binary operation of two Smi's produces a Smi not a double. |
1792 __ movq(temp, left); | 1790 __ movq(temp, left); |
1793 __ orq(temp, right); | 1791 __ orq(temp, right); |
1794 __ testq(temp, Immediate(kSmiTagMask)); | 1792 __ testq(temp, Immediate(kSmiTagMask)); |
1795 __ j(ZERO, deopt); | 1793 __ j(ZERO, deopt); |
1796 | 1794 |
1797 compiler->LoadDoubleOrSmiToXmm(XMM0, left, temp, deopt); | 1795 compiler->LoadDoubleOrSmiToXmm(XMM0, left, temp, deopt); |
1798 compiler->LoadDoubleOrSmiToXmm(XMM1, right, temp, deopt); | 1796 compiler->LoadDoubleOrSmiToXmm(XMM1, right, temp, deopt); |
1799 | 1797 |
1800 switch (op_kind()) { | 1798 switch (op_kind()) { |
1801 case Token::kADD: __ addsd(XMM0, XMM1); break; | 1799 case Token::kADD: __ addsd(XMM0, XMM1); break; |
1802 case Token::kSUB: __ subsd(XMM0, XMM1); break; | 1800 case Token::kSUB: __ subsd(XMM0, XMM1); break; |
1803 case Token::kMUL: __ mulsd(XMM0, XMM1); break; | 1801 case Token::kMUL: __ mulsd(XMM0, XMM1); break; |
1804 case Token::kDIV: __ divsd(XMM0, XMM1); break; | 1802 case Token::kDIV: __ divsd(XMM0, XMM1); break; |
1805 default: UNREACHABLE(); | 1803 default: UNREACHABLE(); |
1806 } | 1804 } |
1807 | 1805 |
1808 __ movsd(FieldAddress(result, Double::value_offset()), XMM0); | 1806 __ movsd(FieldAddress(result, Double::value_offset()), XMM0); |
| 1807 |
| 1808 __ Drop(2); |
1809 } | 1809 } |
1810 | 1810 |
1811 | 1811 |
1812 LocationSummary* UnarySmiOpComp::MakeLocationSummary() const { | 1812 LocationSummary* UnarySmiOpComp::MakeLocationSummary() const { |
1813 const intptr_t kNumInputs = 1; | 1813 const intptr_t kNumInputs = 1; |
1814 const intptr_t kNumTemps = 0; | 1814 const intptr_t kNumTemps = 0; |
1815 LocationSummary* summary = | 1815 LocationSummary* summary = |
1816 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1816 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
1817 summary->set_in(0, Location::RequiresRegister()); | 1817 summary->set_in(0, Location::RequiresRegister()); |
1818 summary->set_out(Location::SameAsFirstInput()); | 1818 summary->set_out(Location::SameAsFirstInput()); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2130 ASSERT(locs()->out().reg() == RAX); | 2130 ASSERT(locs()->out().reg() == RAX); |
2131 __ CompareObject(locs()->out().reg(), compiler->bool_true()); | 2131 __ CompareObject(locs()->out().reg(), compiler->bool_true()); |
2132 EmitBranchOnCondition(compiler, branch_condition); | 2132 EmitBranchOnCondition(compiler, branch_condition); |
2133 } | 2133 } |
2134 | 2134 |
2135 } // namespace dart | 2135 } // namespace dart |
2136 | 2136 |
2137 #undef __ | 2137 #undef __ |
2138 | 2138 |
2139 #endif // defined TARGET_ARCH_X64 | 2139 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |