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

Side by Side Diff: runtime/vm/intermediate_language_ia32.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_arm.cc ('k') | runtime/vm/intermediate_language_mips.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_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 "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 StoreInstanceFieldInstr* instruction_; 1622 StoreInstanceFieldInstr* instruction_;
1623 const Class& cls_; 1623 const Class& cls_;
1624 }; 1624 };
1625 1625
1626 1626
1627 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(bool opt) const { 1627 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(bool opt) const {
1628 const intptr_t kNumInputs = 2; 1628 const intptr_t kNumInputs = 2;
1629 const intptr_t kNumTemps = 0; 1629 const intptr_t kNumTemps = 0;
1630 LocationSummary* summary = 1630 LocationSummary* summary =
1631 new LocationSummary(kNumInputs, kNumTemps, 1631 new LocationSummary(kNumInputs, kNumTemps,
1632 (field().guarded_cid() == kIllegalCid) || (is_initialization_) 1632 !field().IsNull() &&
1633 ((field().guarded_cid() == kIllegalCid) || is_initialization_)
1633 ? LocationSummary::kCallOnSlowPath 1634 ? LocationSummary::kCallOnSlowPath
1634 : LocationSummary::kNoCall); 1635 : LocationSummary::kNoCall);
1635 1636
1636 summary->set_in(0, Location::RequiresRegister()); 1637 summary->set_in(0, Location::RequiresRegister());
1637 if (IsUnboxedStore() && opt) { 1638 if (IsUnboxedStore() && opt) {
1638 summary->set_in(1, Location::RequiresFpuRegister()); 1639 summary->set_in(1, Location::RequiresFpuRegister());
1639 summary->AddTemp(Location::RequiresRegister()); 1640 summary->AddTemp(Location::RequiresRegister());
1640 summary->AddTemp(Location::RequiresRegister()); 1641 summary->AddTemp(Location::RequiresRegister());
1641 } else if (IsPotentialUnboxedStore()) { 1642 } else if (IsPotentialUnboxedStore()) {
1642 summary->set_in(1, ShouldEmitStoreBarrier() 1643 summary->set_in(1, ShouldEmitStoreBarrier()
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 compiler->AddSlowPathCode(slow_path); 1685 compiler->AddSlowPathCode(slow_path);
1685 1686
1686 __ TryAllocate(*cls, 1687 __ TryAllocate(*cls,
1687 slow_path->entry_label(), 1688 slow_path->entry_label(),
1688 Assembler::kFarJump, 1689 Assembler::kFarJump,
1689 temp, 1690 temp,
1690 temp2); 1691 temp2);
1691 __ Bind(slow_path->exit_label()); 1692 __ Bind(slow_path->exit_label());
1692 __ movl(temp2, temp); 1693 __ movl(temp2, temp);
1693 __ StoreIntoObject(instance_reg, 1694 __ StoreIntoObject(instance_reg,
1694 FieldAddress(instance_reg, field().Offset()), 1695 FieldAddress(instance_reg, offset_in_bytes_),
1695 temp2); 1696 temp2);
1696 } else { 1697 } else {
1697 __ movl(temp, FieldAddress(instance_reg, field().Offset())); 1698 __ movl(temp, FieldAddress(instance_reg, offset_in_bytes_));
1698 } 1699 }
1699 switch (cid) { 1700 switch (cid) {
1700 case kDoubleCid: 1701 case kDoubleCid:
1701 __ Comment("UnboxedDoubleStoreInstanceFieldInstr"); 1702 __ Comment("UnboxedDoubleStoreInstanceFieldInstr");
1702 __ movsd(FieldAddress(temp, Double::value_offset()), value); 1703 __ movsd(FieldAddress(temp, Double::value_offset()), value);
1703 break; 1704 break;
1704 case kFloat32x4Cid: 1705 case kFloat32x4Cid:
1705 __ Comment("UnboxedFloat32x4StoreInstanceFieldInstr"); 1706 __ Comment("UnboxedFloat32x4StoreInstanceFieldInstr");
1706 __ movups(FieldAddress(temp, Float32x4::value_offset()), value); 1707 __ movups(FieldAddress(temp, Float32x4::value_offset()), value);
1707 break; 1708 break;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 { 1752 {
1752 __ Bind(&store_double); 1753 __ Bind(&store_double);
1753 Label copy_double; 1754 Label copy_double;
1754 1755
1755 StoreInstanceFieldSlowPath* slow_path = 1756 StoreInstanceFieldSlowPath* slow_path =
1756 new StoreInstanceFieldSlowPath(this, compiler->double_class()); 1757 new StoreInstanceFieldSlowPath(this, compiler->double_class());
1757 compiler->AddSlowPathCode(slow_path); 1758 compiler->AddSlowPathCode(slow_path);
1758 1759
1759 const Immediate& raw_null = 1760 const Immediate& raw_null =
1760 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1761 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1761 __ movl(temp, FieldAddress(instance_reg, field().Offset())); 1762 __ movl(temp, FieldAddress(instance_reg, offset_in_bytes_));
1762 __ cmpl(temp, raw_null); 1763 __ cmpl(temp, raw_null);
1763 __ j(NOT_EQUAL, &copy_double); 1764 __ j(NOT_EQUAL, &copy_double);
1764 1765
1765 __ TryAllocate(compiler->double_class(), 1766 __ TryAllocate(compiler->double_class(),
1766 slow_path->entry_label(), 1767 slow_path->entry_label(),
1767 Assembler::kFarJump, 1768 Assembler::kFarJump,
1768 temp, 1769 temp,
1769 temp2); 1770 temp2);
1770 __ Bind(slow_path->exit_label()); 1771 __ Bind(slow_path->exit_label());
1771 __ movl(temp2, temp); 1772 __ movl(temp2, temp);
1772 __ StoreIntoObject(instance_reg, 1773 __ StoreIntoObject(instance_reg,
1773 FieldAddress(instance_reg, field().Offset()), 1774 FieldAddress(instance_reg, offset_in_bytes_),
1774 temp2); 1775 temp2);
1775 1776
1776 __ Bind(&copy_double); 1777 __ Bind(&copy_double);
1777 __ movsd(fpu_temp, FieldAddress(value_reg, Double::value_offset())); 1778 __ movsd(fpu_temp, FieldAddress(value_reg, Double::value_offset()));
1778 __ movsd(FieldAddress(temp, Double::value_offset()), fpu_temp); 1779 __ movsd(FieldAddress(temp, Double::value_offset()), fpu_temp);
1779 __ jmp(&skip_store); 1780 __ jmp(&skip_store);
1780 } 1781 }
1781 1782
1782 { 1783 {
1783 __ Bind(&store_float32x4); 1784 __ Bind(&store_float32x4);
1784 Label copy_float32x4; 1785 Label copy_float32x4;
1785 1786
1786 StoreInstanceFieldSlowPath* slow_path = 1787 StoreInstanceFieldSlowPath* slow_path =
1787 new StoreInstanceFieldSlowPath(this, compiler->float32x4_class()); 1788 new StoreInstanceFieldSlowPath(this, compiler->float32x4_class());
1788 compiler->AddSlowPathCode(slow_path); 1789 compiler->AddSlowPathCode(slow_path);
1789 1790
1790 const Immediate& raw_null = 1791 const Immediate& raw_null =
1791 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1792 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1792 __ movl(temp, FieldAddress(instance_reg, field().Offset())); 1793 __ movl(temp, FieldAddress(instance_reg, offset_in_bytes_));
1793 __ cmpl(temp, raw_null); 1794 __ cmpl(temp, raw_null);
1794 __ j(NOT_EQUAL, &copy_float32x4); 1795 __ j(NOT_EQUAL, &copy_float32x4);
1795 1796
1796 __ TryAllocate(compiler->float32x4_class(), 1797 __ TryAllocate(compiler->float32x4_class(),
1797 slow_path->entry_label(), 1798 slow_path->entry_label(),
1798 Assembler::kFarJump, 1799 Assembler::kFarJump,
1799 temp, 1800 temp,
1800 temp2); 1801 temp2);
1801 __ Bind(slow_path->exit_label()); 1802 __ Bind(slow_path->exit_label());
1802 __ movl(temp2, temp); 1803 __ movl(temp2, temp);
1803 __ StoreIntoObject(instance_reg, 1804 __ StoreIntoObject(instance_reg,
1804 FieldAddress(instance_reg, field().Offset()), 1805 FieldAddress(instance_reg, offset_in_bytes_),
1805 temp2); 1806 temp2);
1806 1807
1807 __ Bind(&copy_float32x4); 1808 __ Bind(&copy_float32x4);
1808 __ movups(fpu_temp, FieldAddress(value_reg, Float32x4::value_offset())); 1809 __ movups(fpu_temp, FieldAddress(value_reg, Float32x4::value_offset()));
1809 __ movups(FieldAddress(temp, Float32x4::value_offset()), fpu_temp); 1810 __ movups(FieldAddress(temp, Float32x4::value_offset()), fpu_temp);
1810 __ jmp(&skip_store); 1811 __ jmp(&skip_store);
1811 } 1812 }
1812 __ Bind(&store_pointer); 1813 __ Bind(&store_pointer);
1813 } 1814 }
1814 1815
1815 if (ShouldEmitStoreBarrier()) { 1816 if (ShouldEmitStoreBarrier()) {
1816 Register value_reg = locs()->in(1).reg(); 1817 Register value_reg = locs()->in(1).reg();
1817 __ StoreIntoObject(instance_reg, 1818 __ StoreIntoObject(instance_reg,
1818 FieldAddress(instance_reg, field().Offset()), 1819 FieldAddress(instance_reg, offset_in_bytes_),
1819 value_reg, 1820 value_reg,
1820 CanValueBeSmi()); 1821 CanValueBeSmi());
1821 } else { 1822 } else {
1822 if (locs()->in(1).IsConstant()) { 1823 if (locs()->in(1).IsConstant()) {
1823 __ StoreIntoObjectNoBarrier( 1824 __ StoreIntoObjectNoBarrier(
1824 instance_reg, 1825 instance_reg,
1825 FieldAddress(instance_reg, field().Offset()), 1826 FieldAddress(instance_reg, offset_in_bytes_),
1826 locs()->in(1).constant()); 1827 locs()->in(1).constant());
1827 } else { 1828 } else {
1828 Register value_reg = locs()->in(1).reg(); 1829 Register value_reg = locs()->in(1).reg();
1829 __ StoreIntoObjectNoBarrier(instance_reg, 1830 __ StoreIntoObjectNoBarrier(instance_reg,
1830 FieldAddress(instance_reg, field().Offset()), value_reg); 1831 FieldAddress(instance_reg, offset_in_bytes_), value_reg);
1831 } 1832 }
1832 } 1833 }
1833 __ Bind(&skip_store); 1834 __ Bind(&skip_store);
1834 } 1835 }
1835 1836
1836 1837
1837 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(bool opt) const { 1838 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(bool opt) const {
1838 const intptr_t kNumInputs = 1; 1839 const intptr_t kNumInputs = 1;
1839 const intptr_t kNumTemps = 0; 1840 const intptr_t kNumTemps = 0;
1840 LocationSummary* summary = 1841 LocationSummary* summary =
(...skipping 3498 matching lines...) Expand 10 before | Expand all | Expand 10 after
5339 5340
5340 Label done; 5341 Label done;
5341 __ LoadObject(result, Bool::True()); 5342 __ LoadObject(result, Bool::True());
5342 __ CompareRegisters(result, value); 5343 __ CompareRegisters(result, value);
5343 __ j(NOT_EQUAL, &done, Assembler::kNearJump); 5344 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
5344 __ LoadObject(result, Bool::False()); 5345 __ LoadObject(result, Bool::False());
5345 __ Bind(&done); 5346 __ Bind(&done);
5346 } 5347 }
5347 5348
5348 5349
5349 LocationSummary* StoreVMFieldInstr::MakeLocationSummary(bool opt) const {
5350 const intptr_t kNumInputs = 2;
5351 const intptr_t kNumTemps = 0;
5352 LocationSummary* locs =
5353 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
5354 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister()
5355 : Location::RequiresRegister());
5356 locs->set_in(1, Location::RequiresRegister());
5357 return locs;
5358 }
5359
5360
5361 void StoreVMFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5362 Register value_reg = locs()->in(0).reg();
5363 Register dest_reg = locs()->in(1).reg();
5364
5365 if (value()->NeedsStoreBuffer()) {
5366 __ StoreIntoObject(dest_reg, FieldAddress(dest_reg, offset_in_bytes()),
5367 value_reg);
5368 } else {
5369 __ StoreIntoObjectNoBarrier(
5370 dest_reg, FieldAddress(dest_reg, offset_in_bytes()), value_reg);
5371 }
5372 }
5373
5374
5375 LocationSummary* AllocateObjectInstr::MakeLocationSummary(bool opt) const { 5350 LocationSummary* AllocateObjectInstr::MakeLocationSummary(bool opt) const {
5376 return MakeCallSummary(); 5351 return MakeCallSummary();
5377 } 5352 }
5378 5353
5379 5354
5380 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5355 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5381 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls())); 5356 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls()));
5382 const ExternalLabel label(cls().ToCString(), stub.EntryPoint()); 5357 const ExternalLabel label(cls().ToCString(), stub.EntryPoint());
5383 compiler->GenerateCall(token_pos(), 5358 compiler->GenerateCall(token_pos(),
5384 &label, 5359 &label,
(...skipping 19 matching lines...) Expand all
5404 PcDescriptors::kOther, 5379 PcDescriptors::kOther,
5405 locs()); 5380 locs());
5406 __ Drop(2); // Discard type arguments and receiver. 5381 __ Drop(2); // Discard type arguments and receiver.
5407 } 5382 }
5408 5383
5409 } // namespace dart 5384 } // namespace dart
5410 5385
5411 #undef __ 5386 #undef __
5412 5387
5413 #endif // defined TARGET_ARCH_IA32 5388 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698