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

Side by Side Diff: vm/intermediate_language_x64.cc

Issue 10850014: Separate double binary operation into a separate instruction class. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: added ia32 Created 8 years, 4 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 | « 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 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 token_pos(), 1508 token_pos(),
1509 try_index(), 1509 try_index(),
1510 kStackOverflowRuntimeEntry); 1510 kStackOverflowRuntimeEntry);
1511 __ Bind(&no_stack_overflow); 1511 __ Bind(&no_stack_overflow);
1512 } 1512 }
1513 1513
1514 1514
1515 LocationSummary* BinaryOpComp::MakeLocationSummary() const { 1515 LocationSummary* BinaryOpComp::MakeLocationSummary() const {
1516 const intptr_t kNumInputs = 2; 1516 const intptr_t kNumInputs = 2;
1517 1517
1518 if (operands_type() == kDoubleOperands) { 1518 // Double operation are handled in DoubleBinaryOpComp.
1519 return MakeCallSummary(); // Calls into a stub for allocation. 1519 ASSERT(operands_type() != kDoubleOperands);
1520 }
1521 1520
1522 if (operands_type() == kMintOperands) { 1521 if (operands_type() == kMintOperands) {
1523 ASSERT(op_kind() == Token::kBIT_AND); 1522 ASSERT(op_kind() == Token::kBIT_AND);
1524 const intptr_t kNumTemps = 0; 1523 const intptr_t kNumTemps = 0;
1525 LocationSummary* summary = 1524 LocationSummary* summary =
1526 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 1525 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
1527 summary->set_in(0, Location::RegisterLocation(RAX)); 1526 summary->set_in(0, Location::RegisterLocation(RAX));
1528 summary->set_in(1, Location::RegisterLocation(RCX)); 1527 summary->set_in(1, Location::RegisterLocation(RCX));
1529 summary->set_out(Location::RegisterLocation(RAX)); 1528 summary->set_out(Location::RegisterLocation(RAX));
1530 return summary; 1529 return summary;
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 target, 1813 target,
1815 comp->instance_call()->ArgumentCount(), 1814 comp->instance_call()->ArgumentCount(),
1816 comp->instance_call()->argument_names()); 1815 comp->instance_call()->argument_names());
1817 ASSERT(result == RAX); 1816 ASSERT(result == RAX);
1818 } 1817 }
1819 } 1818 }
1820 __ Bind(&done); 1819 __ Bind(&done);
1821 } 1820 }
1822 1821
1823 1822
1824 static void EmitDoubleBinaryOp(FlowGraphCompiler* compiler, 1823 void BinaryOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
1825 BinaryOpComp* comp) { 1824 switch (operands_type()) {
1825 case kSmiOperands:
1826 EmitSmiBinaryOp(compiler, this);
1827 break;
1828
1829 case kMintOperands:
1830 EmitMintBinaryOp(compiler, this);
1831 break;
1832
1833 default:
1834 UNREACHABLE();
1835 }
1836 }
1837
1838
1839 LocationSummary* DoubleBinaryOpComp::MakeLocationSummary() const {
1840 return MakeCallSummary(); // Calls into a stub for allocation.
1841 }
1842
1843
1844 void DoubleBinaryOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
1826 Register left = RBX; 1845 Register left = RBX;
1827 Register right = RCX; 1846 Register right = RCX;
1828 Register temp = RDX; 1847 Register temp = RDX;
1829 Register result = comp->locs()->out().reg(); 1848 Register result = locs()->out().reg();
1830 1849
1831 const Class& double_class = compiler->double_class(); 1850 const Class& double_class = compiler->double_class();
1832 const Code& stub = 1851 const Code& stub =
1833 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); 1852 Code::Handle(StubCode::GetAllocationStubForClass(double_class));
1834 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); 1853 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint());
1835 compiler->GenerateCall(comp->instance_call()->token_pos(), 1854 compiler->GenerateCall(instance_call()->token_pos(),
1836 comp->instance_call()->try_index(), 1855 instance_call()->try_index(),
1837 &label, 1856 &label,
1838 PcDescriptors::kOther); 1857 PcDescriptors::kOther);
1839 // Newly allocated object is now in the result register (RAX). 1858 // Newly allocated object is now in the result register (RAX).
1840 ASSERT(result == RAX); 1859 ASSERT(result == RAX);
1841 __ popq(right); 1860 __ popq(right);
1842 __ popq(left); 1861 __ popq(left);
1843 1862
1844 Label* deopt = compiler->AddDeoptStub(comp->instance_call()->cid(), 1863 Label* deopt = compiler->AddDeoptStub(instance_call()->cid(),
1845 comp->instance_call()->token_pos(), 1864 instance_call()->token_pos(),
1846 comp->instance_call()->try_index(), 1865 instance_call()->try_index(),
1847 kDeoptDoubleBinaryOp, 1866 kDeoptDoubleBinaryOp,
1848 left, 1867 left,
1849 right); 1868 right);
1850 1869
1851 compiler->LoadDoubleOrSmiToXmm(XMM0, left, temp, deopt); 1870 compiler->LoadDoubleOrSmiToXmm(XMM0, left, temp, deopt);
1852 compiler->LoadDoubleOrSmiToXmm(XMM1, right, temp, deopt); 1871 compiler->LoadDoubleOrSmiToXmm(XMM1, right, temp, deopt);
1853 1872
1854 switch (comp->op_kind()) { 1873 switch (op_kind()) {
1855 case Token::kADD: __ addsd(XMM0, XMM1); break; 1874 case Token::kADD: __ addsd(XMM0, XMM1); break;
1856 case Token::kSUB: __ subsd(XMM0, XMM1); break; 1875 case Token::kSUB: __ subsd(XMM0, XMM1); break;
1857 case Token::kMUL: __ mulsd(XMM0, XMM1); break; 1876 case Token::kMUL: __ mulsd(XMM0, XMM1); break;
1858 case Token::kDIV: __ divsd(XMM0, XMM1); break; 1877 case Token::kDIV: __ divsd(XMM0, XMM1); break;
1859 default: UNREACHABLE(); 1878 default: UNREACHABLE();
1860 } 1879 }
1861 1880
1862 __ movsd(FieldAddress(result, Double::value_offset()), XMM0); 1881 __ movsd(FieldAddress(result, Double::value_offset()), XMM0);
1863 } 1882 }
1864 1883
1865 1884
1866 void BinaryOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
1867 switch (operands_type()) {
1868 case kSmiOperands:
1869 EmitSmiBinaryOp(compiler, this);
1870 break;
1871
1872 case kMintOperands:
1873 EmitMintBinaryOp(compiler, this);
1874 break;
1875
1876 case kDoubleOperands:
1877 EmitDoubleBinaryOp(compiler, this);
1878 break;
1879
1880 default:
1881 UNREACHABLE();
1882 }
1883 }
1884
1885
1886 LocationSummary* UnarySmiOpComp::MakeLocationSummary() const { 1885 LocationSummary* UnarySmiOpComp::MakeLocationSummary() const {
1887 const intptr_t kNumInputs = 1; 1886 const intptr_t kNumInputs = 1;
1888 const intptr_t kNumTemps = 0; 1887 const intptr_t kNumTemps = 0;
1889 LocationSummary* summary = 1888 LocationSummary* summary =
1890 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 1889 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
1891 summary->set_in(0, Location::RequiresRegister()); 1890 summary->set_in(0, Location::RequiresRegister());
1892 summary->set_out(Location::SameAsFirstInput()); 1891 summary->set_out(Location::SameAsFirstInput());
1893 return summary; 1892 return summary;
1894 } 1893 }
1895 1894
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
2204 ASSERT(locs()->out().reg() == RAX); 2203 ASSERT(locs()->out().reg() == RAX);
2205 __ CompareObject(locs()->out().reg(), compiler->bool_true()); 2204 __ CompareObject(locs()->out().reg(), compiler->bool_true());
2206 EmitBranchOnCondition(compiler, branch_condition); 2205 EmitBranchOnCondition(compiler, branch_condition);
2207 } 2206 }
2208 2207
2209 } // namespace dart 2208 } // namespace dart
2210 2209
2211 #undef __ 2210 #undef __
2212 2211
2213 #endif // defined TARGET_ARCH_X64 2212 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698