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

Side by Side Diff: vm/intermediate_language_ia32.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.cc ('k') | vm/intermediate_language_x64.cc » ('j') | 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_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 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 token_pos(), 1496 token_pos(),
1497 try_index(), 1497 try_index(),
1498 kStackOverflowRuntimeEntry); 1498 kStackOverflowRuntimeEntry);
1499 __ Bind(&no_stack_overflow); 1499 __ Bind(&no_stack_overflow);
1500 } 1500 }
1501 1501
1502 1502
1503 LocationSummary* BinaryOpComp::MakeLocationSummary() const { 1503 LocationSummary* BinaryOpComp::MakeLocationSummary() const {
1504 const intptr_t kNumInputs = 2; 1504 const intptr_t kNumInputs = 2;
1505 1505
1506 if (operands_type() == kDoubleOperands) { 1506 // Double operation are handled in DoubleBinaryOpComp.
1507 return MakeCallSummary(); // Calls into a stub for allocation. 1507 ASSERT(operands_type() != kDoubleOperands);
1508 }
1509 1508
1510 if (operands_type() == kMintOperands) { 1509 if (operands_type() == kMintOperands) {
1511 ASSERT(op_kind() == Token::kBIT_AND); 1510 ASSERT(op_kind() == Token::kBIT_AND);
1512 const intptr_t kNumTemps = 1; 1511 const intptr_t kNumTemps = 1;
1513 LocationSummary* summary = 1512 LocationSummary* summary =
1514 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 1513 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
1515 summary->set_in(0, Location::RegisterLocation(EAX)); 1514 summary->set_in(0, Location::RegisterLocation(EAX));
1516 summary->set_in(1, Location::RegisterLocation(ECX)); 1515 summary->set_in(1, Location::RegisterLocation(ECX));
1517 summary->set_temp(0, Location::RegisterLocation(EDX)); 1516 summary->set_temp(0, Location::RegisterLocation(EDX));
1518 summary->set_out(Location::RegisterLocation(EAX)); 1517 summary->set_out(Location::RegisterLocation(EAX));
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 target, 1803 target,
1805 comp->instance_call()->ArgumentCount(), 1804 comp->instance_call()->ArgumentCount(),
1806 comp->instance_call()->argument_names()); 1805 comp->instance_call()->argument_names());
1807 ASSERT(result == EAX); 1806 ASSERT(result == EAX);
1808 } 1807 }
1809 } 1808 }
1810 __ Bind(&done); 1809 __ Bind(&done);
1811 } 1810 }
1812 1811
1813 1812
1814 static void EmitDoubleBinaryOp(FlowGraphCompiler* compiler, 1813 void BinaryOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
1815 BinaryOpComp* comp) { 1814 switch (operands_type()) {
1815 case kSmiOperands:
1816 EmitSmiBinaryOp(compiler, this);
1817 break;
1818
1819 case kMintOperands:
1820 EmitMintBinaryOp(compiler, this);
1821 break;
1822
1823 default:
1824 UNREACHABLE();
1825 }
1826 }
1827
1828
1829 LocationSummary* DoubleBinaryOpComp::MakeLocationSummary() const {
1830 return MakeCallSummary(); // Calls into a stub for allocation.
1831 }
1832
1833
1834 void DoubleBinaryOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
1816 Register left = EBX; 1835 Register left = EBX;
1817 Register right = ECX; 1836 Register right = ECX;
1818 Register temp = EDX; 1837 Register temp = EDX;
1819 Register result = comp->locs()->out().reg(); 1838 Register result = locs()->out().reg();
1820 1839
1821 const Class& double_class = compiler->double_class(); 1840 const Class& double_class = compiler->double_class();
1822 const Code& stub = 1841 const Code& stub =
1823 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); 1842 Code::Handle(StubCode::GetAllocationStubForClass(double_class));
1824 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); 1843 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint());
1825 compiler->GenerateCall(comp->instance_call()->token_pos(), 1844 compiler->GenerateCall(instance_call()->token_pos(),
1826 comp->instance_call()->try_index(), 1845 instance_call()->try_index(),
1827 &label, 1846 &label,
1828 PcDescriptors::kOther); 1847 PcDescriptors::kOther);
1829 // Newly allocated object is now in the result register (RAX). 1848 // Newly allocated object is now in the result register (RAX).
1830 ASSERT(result == EAX); 1849 ASSERT(result == EAX);
1831 __ popl(right); 1850 __ popl(right);
1832 __ popl(left); 1851 __ popl(left);
1833 1852
1834 Label* deopt = compiler->AddDeoptStub(comp->instance_call()->cid(), 1853 Label* deopt = compiler->AddDeoptStub(instance_call()->cid(),
1835 comp->instance_call()->token_pos(), 1854 instance_call()->token_pos(),
1836 comp->instance_call()->try_index(), 1855 instance_call()->try_index(),
1837 kDeoptDoubleBinaryOp, 1856 kDeoptDoubleBinaryOp,
1838 left, 1857 left,
1839 right); 1858 right);
1840 1859
1841 compiler->LoadDoubleOrSmiToXmm(XMM0, left, temp, deopt); 1860 compiler->LoadDoubleOrSmiToXmm(XMM0, left, temp, deopt);
1842 compiler->LoadDoubleOrSmiToXmm(XMM1, right, temp, deopt); 1861 compiler->LoadDoubleOrSmiToXmm(XMM1, right, temp, deopt);
1843 1862
1844 switch (comp->op_kind()) { 1863 switch (op_kind()) {
1845 case Token::kADD: __ addsd(XMM0, XMM1); break; 1864 case Token::kADD: __ addsd(XMM0, XMM1); break;
1846 case Token::kSUB: __ subsd(XMM0, XMM1); break; 1865 case Token::kSUB: __ subsd(XMM0, XMM1); break;
1847 case Token::kMUL: __ mulsd(XMM0, XMM1); break; 1866 case Token::kMUL: __ mulsd(XMM0, XMM1); break;
1848 case Token::kDIV: __ divsd(XMM0, XMM1); break; 1867 case Token::kDIV: __ divsd(XMM0, XMM1); break;
1849 default: UNREACHABLE(); 1868 default: UNREACHABLE();
1850 } 1869 }
1851 1870
1852 __ movsd(FieldAddress(result, Double::value_offset()), XMM0); 1871 __ movsd(FieldAddress(result, Double::value_offset()), XMM0);
1853 } 1872 }
1854 1873
1855 1874
1856 void BinaryOpComp::EmitNativeCode(FlowGraphCompiler* compiler) {
1857 switch (operands_type()) {
1858 case kSmiOperands:
1859 EmitSmiBinaryOp(compiler, this);
1860 break;
1861
1862 case kMintOperands:
1863 EmitMintBinaryOp(compiler, this);
1864 break;
1865
1866 case kDoubleOperands:
1867 EmitDoubleBinaryOp(compiler, this);
1868 break;
1869
1870 default:
1871 UNREACHABLE();
1872 }
1873 }
1874
1875
1876 LocationSummary* UnarySmiOpComp::MakeLocationSummary() const { 1875 LocationSummary* UnarySmiOpComp::MakeLocationSummary() const {
1877 const intptr_t kNumInputs = 1; 1876 const intptr_t kNumInputs = 1;
1878 const intptr_t kNumTemps = 0; 1877 const intptr_t kNumTemps = 0;
1879 LocationSummary* summary = 1878 LocationSummary* summary =
1880 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 1879 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
1881 summary->set_in(0, Location::RequiresRegister()); 1880 summary->set_in(0, Location::RequiresRegister());
1882 summary->set_out(Location::SameAsFirstInput()); 1881 summary->set_out(Location::SameAsFirstInput());
1883 return summary; 1882 return summary;
1884 } 1883 }
1885 1884
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
2197 ASSERT(locs()->out().reg() == EAX); 2196 ASSERT(locs()->out().reg() == EAX);
2198 __ CompareObject(locs()->out().reg(), compiler->bool_true()); 2197 __ CompareObject(locs()->out().reg(), compiler->bool_true());
2199 EmitBranchOnCondition(compiler, branch_condition); 2198 EmitBranchOnCondition(compiler, branch_condition);
2200 } 2199 }
2201 2200
2202 } // namespace dart 2201 } // namespace dart
2203 2202
2204 #undef __ 2203 #undef __
2205 2204
2206 #endif // defined TARGET_ARCH_X64 2205 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « vm/intermediate_language.cc ('k') | vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698