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