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 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 const Class& double_class = compiler->double_class(); | 1705 const Class& double_class = compiler->double_class(); |
1706 const Code& stub = | 1706 const Code& stub = |
1707 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); | 1707 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); |
1708 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); | 1708 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); |
1709 compiler->GenerateCall(instance_call()->token_pos(), | 1709 compiler->GenerateCall(instance_call()->token_pos(), |
1710 instance_call()->try_index(), | 1710 instance_call()->try_index(), |
1711 &label, | 1711 &label, |
1712 PcDescriptors::kOther); | 1712 PcDescriptors::kOther); |
1713 // Newly allocated object is now in the result register (RAX). | 1713 // Newly allocated object is now in the result register (RAX). |
1714 ASSERT(result == RAX); | 1714 ASSERT(result == RAX); |
1715 __ popq(right); | 1715 __ movq(right, Address(RSP, 0)); |
1716 __ popq(left); | 1716 __ movq(left, Address(RSP, kWordSize)); |
1717 | 1717 |
1718 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), | 1718 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), |
1719 instance_call()->try_index(), | 1719 instance_call()->try_index(), |
1720 kDeoptDoubleBinaryOp, | 1720 kDeoptDoubleBinaryOp); |
1721 left, | |
1722 right); | |
1723 | 1721 |
1724 // Binary operation of two Smi's produces a Smi not a double. | 1722 // Binary operation of two Smi's produces a Smi not a double. |
1725 __ movq(temp, left); | 1723 __ movq(temp, left); |
1726 __ orq(temp, right); | 1724 __ orq(temp, right); |
1727 __ testq(temp, Immediate(kSmiTagMask)); | 1725 __ testq(temp, Immediate(kSmiTagMask)); |
1728 __ j(ZERO, deopt); | 1726 __ j(ZERO, deopt); |
1729 | 1727 |
1730 compiler->LoadDoubleOrSmiToXmm(XMM0, left, temp, deopt); | 1728 compiler->LoadDoubleOrSmiToXmm(XMM0, left, temp, deopt); |
1731 compiler->LoadDoubleOrSmiToXmm(XMM1, right, temp, deopt); | 1729 compiler->LoadDoubleOrSmiToXmm(XMM1, right, temp, deopt); |
1732 | 1730 |
1733 switch (op_kind()) { | 1731 switch (op_kind()) { |
1734 case Token::kADD: __ addsd(XMM0, XMM1); break; | 1732 case Token::kADD: __ addsd(XMM0, XMM1); break; |
1735 case Token::kSUB: __ subsd(XMM0, XMM1); break; | 1733 case Token::kSUB: __ subsd(XMM0, XMM1); break; |
1736 case Token::kMUL: __ mulsd(XMM0, XMM1); break; | 1734 case Token::kMUL: __ mulsd(XMM0, XMM1); break; |
1737 case Token::kDIV: __ divsd(XMM0, XMM1); break; | 1735 case Token::kDIV: __ divsd(XMM0, XMM1); break; |
1738 default: UNREACHABLE(); | 1736 default: UNREACHABLE(); |
1739 } | 1737 } |
1740 | 1738 |
1741 __ movsd(FieldAddress(result, Double::value_offset()), XMM0); | 1739 __ movsd(FieldAddress(result, Double::value_offset()), XMM0); |
| 1740 |
| 1741 __ Drop(2); |
1742 } | 1742 } |
1743 | 1743 |
1744 | 1744 |
1745 LocationSummary* UnarySmiOpComp::MakeLocationSummary() const { | 1745 LocationSummary* UnarySmiOpComp::MakeLocationSummary() const { |
1746 const intptr_t kNumInputs = 1; | 1746 const intptr_t kNumInputs = 1; |
1747 const intptr_t kNumTemps = 0; | 1747 const intptr_t kNumTemps = 0; |
1748 LocationSummary* summary = | 1748 LocationSummary* summary = |
1749 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1749 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
1750 summary->set_in(0, Location::RequiresRegister()); | 1750 summary->set_in(0, Location::RequiresRegister()); |
1751 summary->set_out(Location::SameAsFirstInput()); | 1751 summary->set_out(Location::SameAsFirstInput()); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2068 kNumArgsChecked); | 2068 kNumArgsChecked); |
2069 __ CompareObject(RAX, compiler->bool_true()); | 2069 __ CompareObject(RAX, compiler->bool_true()); |
2070 EmitBranchOnCondition(compiler, branch_condition); | 2070 EmitBranchOnCondition(compiler, branch_condition); |
2071 } | 2071 } |
2072 | 2072 |
2073 } // namespace dart | 2073 } // namespace dart |
2074 | 2074 |
2075 #undef __ | 2075 #undef __ |
2076 | 2076 |
2077 #endif // defined TARGET_ARCH_X64 | 2077 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |