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 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1761 const Class& double_class = compiler->double_class(); | 1761 const Class& double_class = compiler->double_class(); |
1762 const Code& stub = | 1762 const Code& stub = |
1763 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); | 1763 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); |
1764 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); | 1764 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); |
1765 compiler->GenerateCall(instance_call()->token_pos(), | 1765 compiler->GenerateCall(instance_call()->token_pos(), |
1766 instance_call()->try_index(), | 1766 instance_call()->try_index(), |
1767 &label, | 1767 &label, |
1768 PcDescriptors::kOther); | 1768 PcDescriptors::kOther); |
1769 // Newly allocated object is now in the result register (RAX). | 1769 // Newly allocated object is now in the result register (RAX). |
1770 ASSERT(result == EAX); | 1770 ASSERT(result == EAX); |
1771 __ popl(right); | 1771 __ movl(right, Address(ESP, 0)); |
1772 __ popl(left); | 1772 __ movl(left, Address(ESP, kWordSize)); |
1773 | 1773 |
1774 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), | 1774 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), |
1775 instance_call()->token_pos(), | 1775 instance_call()->token_pos(), |
1776 instance_call()->try_index(), | 1776 instance_call()->try_index(), |
1777 kDeoptDoubleBinaryOp, | 1777 kDeoptDoubleBinaryOp); |
1778 left, | |
1779 right); | |
1780 | 1778 |
1781 // Binary operation of two Smi's produces a Smi not a double. | 1779 // Binary operation of two Smi's produces a Smi not a double. |
1782 __ movl(temp, left); | 1780 __ movl(temp, left); |
1783 __ orl(temp, right); | 1781 __ orl(temp, right); |
1784 __ testl(temp, Immediate(kSmiTagMask)); | 1782 __ testl(temp, Immediate(kSmiTagMask)); |
1785 __ j(ZERO, deopt); | 1783 __ j(ZERO, deopt); |
1786 | 1784 |
1787 compiler->LoadDoubleOrSmiToXmm(XMM0, left, temp, deopt); | 1785 compiler->LoadDoubleOrSmiToXmm(XMM0, left, temp, deopt); |
1788 compiler->LoadDoubleOrSmiToXmm(XMM1, right, temp, deopt); | 1786 compiler->LoadDoubleOrSmiToXmm(XMM1, right, temp, deopt); |
1789 | 1787 |
1790 switch (op_kind()) { | 1788 switch (op_kind()) { |
1791 case Token::kADD: __ addsd(XMM0, XMM1); break; | 1789 case Token::kADD: __ addsd(XMM0, XMM1); break; |
1792 case Token::kSUB: __ subsd(XMM0, XMM1); break; | 1790 case Token::kSUB: __ subsd(XMM0, XMM1); break; |
1793 case Token::kMUL: __ mulsd(XMM0, XMM1); break; | 1791 case Token::kMUL: __ mulsd(XMM0, XMM1); break; |
1794 case Token::kDIV: __ divsd(XMM0, XMM1); break; | 1792 case Token::kDIV: __ divsd(XMM0, XMM1); break; |
1795 default: UNREACHABLE(); | 1793 default: UNREACHABLE(); |
1796 } | 1794 } |
1797 | 1795 |
1798 __ movsd(FieldAddress(result, Double::value_offset()), XMM0); | 1796 __ movsd(FieldAddress(result, Double::value_offset()), XMM0); |
| 1797 |
| 1798 __ Drop(2); |
1799 } | 1799 } |
1800 | 1800 |
1801 | 1801 |
1802 LocationSummary* UnarySmiOpComp::MakeLocationSummary() const { | 1802 LocationSummary* UnarySmiOpComp::MakeLocationSummary() const { |
1803 const intptr_t kNumInputs = 1; | 1803 const intptr_t kNumInputs = 1; |
1804 const intptr_t kNumTemps = 0; | 1804 const intptr_t kNumTemps = 0; |
1805 LocationSummary* summary = | 1805 LocationSummary* summary = |
1806 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1806 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
1807 summary->set_in(0, Location::RequiresRegister()); | 1807 summary->set_in(0, Location::RequiresRegister()); |
1808 summary->set_out(Location::SameAsFirstInput()); | 1808 summary->set_out(Location::SameAsFirstInput()); |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2123 ASSERT(locs()->out().reg() == EAX); | 2123 ASSERT(locs()->out().reg() == EAX); |
2124 __ CompareObject(locs()->out().reg(), compiler->bool_true()); | 2124 __ CompareObject(locs()->out().reg(), compiler->bool_true()); |
2125 EmitBranchOnCondition(compiler, branch_condition); | 2125 EmitBranchOnCondition(compiler, branch_condition); |
2126 } | 2126 } |
2127 | 2127 |
2128 } // namespace dart | 2128 } // namespace dart |
2129 | 2129 |
2130 #undef __ | 2130 #undef __ |
2131 | 2131 |
2132 #endif // defined TARGET_ARCH_X64 | 2132 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |