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

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

Issue 179443004: VM: Replace StoreVMField with StoreInstanceField. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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.cc ('k') | runtime/vm/intermediate_language_ia32.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 StoreInstanceFieldInstr* instruction_; 1632 StoreInstanceFieldInstr* instruction_;
1633 const Class& cls_; 1633 const Class& cls_;
1634 }; 1634 };
1635 1635
1636 1636
1637 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(bool opt) const { 1637 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(bool opt) const {
1638 const intptr_t kNumInputs = 2; 1638 const intptr_t kNumInputs = 2;
1639 const intptr_t kNumTemps = 0; 1639 const intptr_t kNumTemps = 0;
1640 LocationSummary* summary = 1640 LocationSummary* summary =
1641 new LocationSummary(kNumInputs, kNumTemps, 1641 new LocationSummary(kNumInputs, kNumTemps,
1642 (field().guarded_cid() == kIllegalCid) || (is_initialization_) 1642 !field().IsNull() &&
1643 ((field().guarded_cid() == kIllegalCid) || is_initialization_)
1643 ? LocationSummary::kCallOnSlowPath 1644 ? LocationSummary::kCallOnSlowPath
1644 : LocationSummary::kNoCall); 1645 : LocationSummary::kNoCall);
1645 1646
1646 summary->set_in(0, Location::RequiresRegister()); 1647 summary->set_in(0, Location::RequiresRegister());
1647 if (IsUnboxedStore() && opt) { 1648 if (IsUnboxedStore() && opt) {
1648 summary->set_in(1, Location::RequiresFpuRegister()); 1649 summary->set_in(1, Location::RequiresFpuRegister());
1649 summary->AddTemp(Location::RequiresRegister()); 1650 summary->AddTemp(Location::RequiresRegister());
1650 summary->AddTemp(Location::RequiresRegister()); 1651 summary->AddTemp(Location::RequiresRegister());
1651 } else if (IsPotentialUnboxedStore()) { 1652 } else if (IsPotentialUnboxedStore()) {
1652 summary->set_in(1, ShouldEmitStoreBarrier() 1653 summary->set_in(1, ShouldEmitStoreBarrier()
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 new StoreInstanceFieldSlowPath(this, *cls); 1695 new StoreInstanceFieldSlowPath(this, *cls);
1695 compiler->AddSlowPathCode(slow_path); 1696 compiler->AddSlowPathCode(slow_path);
1696 1697
1697 __ TryAllocate(*cls, 1698 __ TryAllocate(*cls,
1698 slow_path->entry_label(), 1699 slow_path->entry_label(),
1699 temp, 1700 temp,
1700 temp2); 1701 temp2);
1701 __ Bind(slow_path->exit_label()); 1702 __ Bind(slow_path->exit_label());
1702 __ MoveRegister(temp2, temp); 1703 __ MoveRegister(temp2, temp);
1703 __ StoreIntoObject(instance_reg, 1704 __ StoreIntoObject(instance_reg,
1704 FieldAddress(instance_reg, field().Offset()), 1705 FieldAddress(instance_reg, offset_in_bytes_),
1705 temp2); 1706 temp2);
1706 } else { 1707 } else {
1707 __ ldr(temp, FieldAddress(instance_reg, field().Offset())); 1708 __ ldr(temp, FieldAddress(instance_reg, offset_in_bytes_));
1708 } 1709 }
1709 switch (cid) { 1710 switch (cid) {
1710 case kDoubleCid: 1711 case kDoubleCid:
1711 __ Comment("UnboxedDoubleStoreInstanceFieldInstr"); 1712 __ Comment("UnboxedDoubleStoreInstanceFieldInstr");
1712 __ StoreDToOffset(value, temp, Double::value_offset() - kHeapObjectTag); 1713 __ StoreDToOffset(value, temp, Double::value_offset() - kHeapObjectTag);
1713 break; 1714 break;
1714 case kFloat32x4Cid: 1715 case kFloat32x4Cid:
1715 __ Comment("UnboxedFloat32x4StoreInstanceFieldInstr"); 1716 __ Comment("UnboxedFloat32x4StoreInstanceFieldInstr");
1716 __ StoreDToOffset(value, temp, 1717 __ StoreDToOffset(value, temp,
1717 Float32x4::value_offset() - kHeapObjectTag); 1718 Float32x4::value_offset() - kHeapObjectTag);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 locs()->live_registers()->Add(locs()->in(1)); 1763 locs()->live_registers()->Add(locs()->in(1));
1763 } 1764 }
1764 1765
1765 { 1766 {
1766 __ Bind(&store_double); 1767 __ Bind(&store_double);
1767 Label copy_double; 1768 Label copy_double;
1768 StoreInstanceFieldSlowPath* slow_path = 1769 StoreInstanceFieldSlowPath* slow_path =
1769 new StoreInstanceFieldSlowPath(this, compiler->double_class()); 1770 new StoreInstanceFieldSlowPath(this, compiler->double_class());
1770 compiler->AddSlowPathCode(slow_path); 1771 compiler->AddSlowPathCode(slow_path);
1771 1772
1772 __ ldr(temp, FieldAddress(instance_reg, field().Offset())); 1773 __ ldr(temp, FieldAddress(instance_reg, offset_in_bytes_));
1773 __ CompareImmediate(temp, 1774 __ CompareImmediate(temp,
1774 reinterpret_cast<intptr_t>(Object::null())); 1775 reinterpret_cast<intptr_t>(Object::null()));
1775 __ b(&copy_double, NE); 1776 __ b(&copy_double, NE);
1776 1777
1777 __ TryAllocate(compiler->double_class(), 1778 __ TryAllocate(compiler->double_class(),
1778 slow_path->entry_label(), 1779 slow_path->entry_label(),
1779 temp, 1780 temp,
1780 temp2); 1781 temp2);
1781 __ Bind(slow_path->exit_label()); 1782 __ Bind(slow_path->exit_label());
1782 __ MoveRegister(temp2, temp); 1783 __ MoveRegister(temp2, temp);
1783 __ StoreIntoObject(instance_reg, 1784 __ StoreIntoObject(instance_reg,
1784 FieldAddress(instance_reg, field().Offset()), 1785 FieldAddress(instance_reg, offset_in_bytes_),
1785 temp2); 1786 temp2);
1786 __ Bind(&copy_double); 1787 __ Bind(&copy_double);
1787 __ LoadDFromOffset(fpu_temp, 1788 __ LoadDFromOffset(fpu_temp,
1788 value_reg, 1789 value_reg,
1789 Double::value_offset() - kHeapObjectTag); 1790 Double::value_offset() - kHeapObjectTag);
1790 __ StoreDToOffset(fpu_temp, 1791 __ StoreDToOffset(fpu_temp,
1791 temp, 1792 temp,
1792 Double::value_offset() - kHeapObjectTag); 1793 Double::value_offset() - kHeapObjectTag);
1793 __ b(&skip_store); 1794 __ b(&skip_store);
1794 } 1795 }
1795 1796
1796 { 1797 {
1797 __ Bind(&store_float32x4); 1798 __ Bind(&store_float32x4);
1798 Label copy_float32x4; 1799 Label copy_float32x4;
1799 StoreInstanceFieldSlowPath* slow_path = 1800 StoreInstanceFieldSlowPath* slow_path =
1800 new StoreInstanceFieldSlowPath(this, compiler->float32x4_class()); 1801 new StoreInstanceFieldSlowPath(this, compiler->float32x4_class());
1801 compiler->AddSlowPathCode(slow_path); 1802 compiler->AddSlowPathCode(slow_path);
1802 1803
1803 __ ldr(temp, FieldAddress(instance_reg, field().Offset())); 1804 __ ldr(temp, FieldAddress(instance_reg, offset_in_bytes_));
1804 __ CompareImmediate(temp, 1805 __ CompareImmediate(temp,
1805 reinterpret_cast<intptr_t>(Object::null())); 1806 reinterpret_cast<intptr_t>(Object::null()));
1806 __ b(&copy_float32x4, NE); 1807 __ b(&copy_float32x4, NE);
1807 1808
1808 __ TryAllocate(compiler->float32x4_class(), 1809 __ TryAllocate(compiler->float32x4_class(),
1809 slow_path->entry_label(), 1810 slow_path->entry_label(),
1810 temp, 1811 temp,
1811 temp2); 1812 temp2);
1812 __ Bind(slow_path->exit_label()); 1813 __ Bind(slow_path->exit_label());
1813 __ MoveRegister(temp2, temp); 1814 __ MoveRegister(temp2, temp);
1814 __ StoreIntoObject(instance_reg, 1815 __ StoreIntoObject(instance_reg,
1815 FieldAddress(instance_reg, field().Offset()), 1816 FieldAddress(instance_reg, offset_in_bytes_),
1816 temp2); 1817 temp2);
1817 __ Bind(&copy_float32x4); 1818 __ Bind(&copy_float32x4);
1818 // TODO(zra): Maybe use vldmd here. 1819 // TODO(zra): Maybe use vldmd here.
1819 __ LoadDFromOffset(fpu_temp, value_reg, 1820 __ LoadDFromOffset(fpu_temp, value_reg,
1820 Float32x4::value_offset() - kHeapObjectTag); 1821 Float32x4::value_offset() - kHeapObjectTag);
1821 __ LoadDFromOffset(fpu_temp_odd, value_reg, 1822 __ LoadDFromOffset(fpu_temp_odd, value_reg,
1822 Float32x4::value_offset() + 2 * kWordSize - kHeapObjectTag); 1823 Float32x4::value_offset() + 2 * kWordSize - kHeapObjectTag);
1823 __ StoreDToOffset(fpu_temp, temp, 1824 __ StoreDToOffset(fpu_temp, temp,
1824 Float32x4::value_offset() - kHeapObjectTag); 1825 Float32x4::value_offset() - kHeapObjectTag);
1825 __ StoreDToOffset(fpu_temp_odd, temp, 1826 __ StoreDToOffset(fpu_temp_odd, temp,
1826 Float32x4::value_offset() + 2 * kWordSize - kHeapObjectTag); 1827 Float32x4::value_offset() + 2 * kWordSize - kHeapObjectTag);
1827 __ b(&skip_store); 1828 __ b(&skip_store);
1828 } 1829 }
1829 1830
1830 __ Bind(&store_pointer); 1831 __ Bind(&store_pointer);
1831 } 1832 }
1832 1833
1833 if (ShouldEmitStoreBarrier()) { 1834 if (ShouldEmitStoreBarrier()) {
1834 Register value_reg = locs()->in(1).reg(); 1835 Register value_reg = locs()->in(1).reg();
1835 __ StoreIntoObject(instance_reg, 1836 __ StoreIntoObject(instance_reg,
1836 FieldAddress(instance_reg, field().Offset()), 1837 FieldAddress(instance_reg, offset_in_bytes_),
1837 value_reg, 1838 value_reg,
1838 CanValueBeSmi()); 1839 CanValueBeSmi());
1839 } else { 1840 } else {
1840 if (locs()->in(1).IsConstant()) { 1841 if (locs()->in(1).IsConstant()) {
1841 __ StoreIntoObjectNoBarrier( 1842 __ StoreIntoObjectNoBarrier(
1842 instance_reg, 1843 instance_reg,
1843 FieldAddress(instance_reg, field().Offset()), 1844 FieldAddress(instance_reg, offset_in_bytes_),
1844 locs()->in(1).constant()); 1845 locs()->in(1).constant());
1845 } else { 1846 } else {
1846 Register value_reg = locs()->in(1).reg(); 1847 Register value_reg = locs()->in(1).reg();
1847 __ StoreIntoObjectNoBarrier(instance_reg, 1848 __ StoreIntoObjectNoBarrier(instance_reg,
1848 FieldAddress(instance_reg, field().Offset()), value_reg); 1849 FieldAddress(instance_reg, offset_in_bytes_), value_reg);
1849 } 1850 }
1850 } 1851 }
1851 __ Bind(&skip_store); 1852 __ Bind(&skip_store);
1852 } 1853 }
1853 1854
1854 1855
1855 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(bool opt) const { 1856 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(bool opt) const {
1856 const intptr_t kNumInputs = 1; 1857 const intptr_t kNumInputs = 1;
1857 const intptr_t kNumTemps = 0; 1858 const intptr_t kNumTemps = 0;
1858 LocationSummary* summary = 1859 LocationSummary* summary =
(...skipping 3122 matching lines...) Expand 10 before | Expand all | Expand 10 after
4981 void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4982 void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4982 Register value = locs()->in(0).reg(); 4983 Register value = locs()->in(0).reg();
4983 Register result = locs()->out().reg(); 4984 Register result = locs()->out().reg();
4984 4985
4985 __ LoadObject(result, Bool::True()); 4986 __ LoadObject(result, Bool::True());
4986 __ cmp(result, ShifterOperand(value)); 4987 __ cmp(result, ShifterOperand(value));
4987 __ LoadObject(result, Bool::False(), EQ); 4988 __ LoadObject(result, Bool::False(), EQ);
4988 } 4989 }
4989 4990
4990 4991
4991 LocationSummary* StoreVMFieldInstr::MakeLocationSummary(bool opt) const {
4992 const intptr_t kNumInputs = 2;
4993 const intptr_t kNumTemps = 0;
4994 LocationSummary* locs =
4995 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
4996 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister()
4997 : Location::RequiresRegister());
4998 locs->set_in(1, Location::RequiresRegister());
4999 return locs;
5000 }
5001
5002
5003 void StoreVMFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5004 Register value_reg = locs()->in(0).reg();
5005 Register dest_reg = locs()->in(1).reg();
5006
5007 if (value()->NeedsStoreBuffer()) {
5008 __ StoreIntoObject(dest_reg, FieldAddress(dest_reg, offset_in_bytes()),
5009 value_reg);
5010 } else {
5011 __ StoreIntoObjectNoBarrier(
5012 dest_reg, FieldAddress(dest_reg, offset_in_bytes()), value_reg);
5013 }
5014 }
5015
5016
5017 LocationSummary* AllocateObjectInstr::MakeLocationSummary(bool opt) const { 4992 LocationSummary* AllocateObjectInstr::MakeLocationSummary(bool opt) const {
5018 return MakeCallSummary(); 4993 return MakeCallSummary();
5019 } 4994 }
5020 4995
5021 4996
5022 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4997 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5023 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls())); 4998 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls()));
5024 const ExternalLabel label(cls().ToCString(), stub.EntryPoint()); 4999 const ExternalLabel label(cls().ToCString(), stub.EntryPoint());
5025 compiler->GenerateCall(token_pos(), 5000 compiler->GenerateCall(token_pos(),
5026 &label, 5001 &label,
(...skipping 17 matching lines...) Expand all
5044 compiler->GenerateCall(token_pos(), 5019 compiler->GenerateCall(token_pos(),
5045 &label, 5020 &label,
5046 PcDescriptors::kOther, 5021 PcDescriptors::kOther,
5047 locs()); 5022 locs());
5048 __ Drop(2); // Discard type arguments and receiver. 5023 __ Drop(2); // Discard type arguments and receiver.
5049 } 5024 }
5050 5025
5051 } // namespace dart 5026 } // namespace dart
5052 5027
5053 #endif // defined TARGET_ARCH_ARM 5028 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698