Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: runtime/vm/intermediate_language_x64.cc

Issue 10914066: Remove old implementation of binary double operations. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1744 instance_call()->ArgumentCount(), 1744 instance_call()->ArgumentCount(),
1745 instance_call()->argument_names(), 1745 instance_call()->argument_names(),
1746 locs()); 1746 locs());
1747 ASSERT(result == RAX); 1747 ASSERT(result == RAX);
1748 } 1748 }
1749 } 1749 }
1750 __ Bind(&done); 1750 __ Bind(&done);
1751 } 1751 }
1752 1752
1753 1753
1754 LocationSummary* BinaryDoubleOpComp::MakeLocationSummary() const {
1755 return MakeCallSummary(); // Calls into a stub for allocation.
1756 }
1757
1758
1759 void BinaryDoubleOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
1760 Register left = RBX;
1761 Register right = RCX;
1762 Register temp = RDX;
1763 Register result = locs()->out().reg();
1764
1765 const Class& double_class = compiler->double_class();
1766 const Code& stub =
1767 Code::Handle(StubCode::GetAllocationStubForClass(double_class));
1768 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint());
1769 compiler->GenerateCall(instance_call()->token_pos(),
1770 &label,
1771 PcDescriptors::kOther,
1772 locs());
1773 // Newly allocated object is now in the result register (RAX).
1774 ASSERT(result == RAX);
1775 __ movq(right, Address(RSP, 0));
1776 __ movq(left, Address(RSP, kWordSize));
1777
1778 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
1779 kDeoptBinaryDoubleOp);
1780
1781 // Binary operation of two Smi's produces a Smi not a double.
1782 __ movq(temp, left);
1783 __ orq(temp, right);
1784 __ testq(temp, Immediate(kSmiTagMask));
1785 __ j(ZERO, deopt);
1786
1787 compiler->LoadDoubleOrSmiToXmm(XMM0, left, temp, deopt);
1788 compiler->LoadDoubleOrSmiToXmm(XMM1, right, temp, deopt);
1789
1790 switch (op_kind()) {
1791 case Token::kADD: __ addsd(XMM0, XMM1); break;
1792 case Token::kSUB: __ subsd(XMM0, XMM1); break;
1793 case Token::kMUL: __ mulsd(XMM0, XMM1); break;
1794 case Token::kDIV: __ divsd(XMM0, XMM1); break;
1795 default: UNREACHABLE();
1796 }
1797
1798 __ movsd(FieldAddress(result, Double::value_offset()), XMM0);
1799
1800 __ Drop(2);
1801 }
1802
1803
1804 LocationSummary* CheckEitherNonSmiComp::MakeLocationSummary() const { 1754 LocationSummary* CheckEitherNonSmiComp::MakeLocationSummary() const {
1805 ASSERT((left()->ResultCid() != kDoubleCid) && 1755 ASSERT((left()->ResultCid() != kDoubleCid) &&
1806 (right()->ResultCid() != kDoubleCid)); 1756 (right()->ResultCid() != kDoubleCid));
1807 const intptr_t kNumInputs = 2; 1757 const intptr_t kNumInputs = 2;
1808 const intptr_t kNumTemps = 1; 1758 const intptr_t kNumTemps = 1;
1809 LocationSummary* summary = 1759 LocationSummary* summary =
1810 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 1760 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
1811 summary->set_in(0, Location::RequiresRegister()); 1761 summary->set_in(0, Location::RequiresRegister());
1812 summary->set_in(1, Location::RequiresRegister()); 1762 summary->set_in(1, Location::RequiresRegister());
1813 summary->set_temp(0, Location::RequiresRegister()); 1763 summary->set_temp(0, Location::RequiresRegister());
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
2234 } 2184 }
2235 __ j(ABOVE_EQUAL, deopt); 2185 __ j(ABOVE_EQUAL, deopt);
2236 } 2186 }
2237 2187
2238 2188
2239 } // namespace dart 2189 } // namespace dart
2240 2190
2241 #undef __ 2191 #undef __
2242 2192
2243 #endif // defined TARGET_ARCH_X64 2193 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698