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

Side by Side Diff: runtime/vm/intermediate_language_x64.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, 10 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_mips.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) 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_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 "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 StoreInstanceFieldInstr* instruction_; 1524 StoreInstanceFieldInstr* instruction_;
1525 const Class& cls_; 1525 const Class& cls_;
1526 }; 1526 };
1527 1527
1528 1528
1529 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(bool opt) const { 1529 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(bool opt) const {
1530 const intptr_t kNumInputs = 2; 1530 const intptr_t kNumInputs = 2;
1531 const intptr_t kNumTemps = 0; 1531 const intptr_t kNumTemps = 0;
1532 LocationSummary* summary = 1532 LocationSummary* summary =
1533 new LocationSummary(kNumInputs, kNumTemps, 1533 new LocationSummary(kNumInputs, kNumTemps,
1534 (field().guarded_cid() == kIllegalCid) || (is_initialization_) 1534 !field().IsNull() &&
1535 ((field().guarded_cid() == kIllegalCid) || is_initialization_)
1535 ? LocationSummary::kCallOnSlowPath 1536 ? LocationSummary::kCallOnSlowPath
1536 : LocationSummary::kNoCall); 1537 : LocationSummary::kNoCall);
1537 1538
1538 summary->set_in(0, Location::RequiresRegister()); 1539 summary->set_in(0, Location::RequiresRegister());
1539 if (IsUnboxedStore() && opt) { 1540 if (IsUnboxedStore() && opt) {
1540 summary->set_in(1, Location::RequiresFpuRegister()); 1541 summary->set_in(1, Location::RequiresFpuRegister());
1541 summary->AddTemp(Location::RequiresRegister()); 1542 summary->AddTemp(Location::RequiresRegister());
1542 summary->AddTemp(Location::RequiresRegister()); 1543 summary->AddTemp(Location::RequiresRegister());
1543 } else if (IsPotentialUnboxedStore()) { 1544 } else if (IsPotentialUnboxedStore()) {
1544 summary->set_in(1, ShouldEmitStoreBarrier() 1545 summary->set_in(1, ShouldEmitStoreBarrier()
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 compiler->AddSlowPathCode(slow_path); 1587 compiler->AddSlowPathCode(slow_path);
1587 1588
1588 __ TryAllocate(*cls, 1589 __ TryAllocate(*cls,
1589 slow_path->entry_label(), 1590 slow_path->entry_label(),
1590 Assembler::kFarJump, 1591 Assembler::kFarJump,
1591 temp, 1592 temp,
1592 PP); 1593 PP);
1593 __ Bind(slow_path->exit_label()); 1594 __ Bind(slow_path->exit_label());
1594 __ movq(temp2, temp); 1595 __ movq(temp2, temp);
1595 __ StoreIntoObject(instance_reg, 1596 __ StoreIntoObject(instance_reg,
1596 FieldAddress(instance_reg, field().Offset()), 1597 FieldAddress(instance_reg, offset_in_bytes_),
1597 temp2); 1598 temp2);
1598 } else { 1599 } else {
1599 __ movq(temp, FieldAddress(instance_reg, field().Offset())); 1600 __ movq(temp, FieldAddress(instance_reg, offset_in_bytes_));
1600 } 1601 }
1601 switch (cid) { 1602 switch (cid) {
1602 case kDoubleCid: 1603 case kDoubleCid:
1603 __ Comment("UnboxedDoubleStoreInstanceFieldInstr"); 1604 __ Comment("UnboxedDoubleStoreInstanceFieldInstr");
1604 __ movsd(FieldAddress(temp, Double::value_offset()), value); 1605 __ movsd(FieldAddress(temp, Double::value_offset()), value);
1605 break; 1606 break;
1606 case kFloat32x4Cid: 1607 case kFloat32x4Cid:
1607 __ Comment("UnboxedFloat32x4StoreInstanceFieldInstr"); 1608 __ Comment("UnboxedFloat32x4StoreInstanceFieldInstr");
1608 __ movups(FieldAddress(temp, Float32x4::value_offset()), value); 1609 __ movups(FieldAddress(temp, Float32x4::value_offset()), value);
1609 break; 1610 break;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 locs()->live_registers()->Add(locs()->in(1)); 1650 locs()->live_registers()->Add(locs()->in(1));
1650 } 1651 }
1651 1652
1652 { 1653 {
1653 __ Bind(&store_double); 1654 __ Bind(&store_double);
1654 Label copy_double; 1655 Label copy_double;
1655 StoreInstanceFieldSlowPath* slow_path = 1656 StoreInstanceFieldSlowPath* slow_path =
1656 new StoreInstanceFieldSlowPath(this, compiler->double_class()); 1657 new StoreInstanceFieldSlowPath(this, compiler->double_class());
1657 compiler->AddSlowPathCode(slow_path); 1658 compiler->AddSlowPathCode(slow_path);
1658 1659
1659 __ movq(temp, FieldAddress(instance_reg, field().Offset())); 1660 __ movq(temp, FieldAddress(instance_reg, offset_in_bytes_));
1660 __ CompareObject(temp, Object::null_object(), PP); 1661 __ CompareObject(temp, Object::null_object(), PP);
1661 __ j(NOT_EQUAL, &copy_double); 1662 __ j(NOT_EQUAL, &copy_double);
1662 1663
1663 __ TryAllocate(compiler->double_class(), 1664 __ TryAllocate(compiler->double_class(),
1664 slow_path->entry_label(), 1665 slow_path->entry_label(),
1665 Assembler::kFarJump, 1666 Assembler::kFarJump,
1666 temp, 1667 temp,
1667 PP); 1668 PP);
1668 __ Bind(slow_path->exit_label()); 1669 __ Bind(slow_path->exit_label());
1669 __ movq(temp2, temp); 1670 __ movq(temp2, temp);
1670 __ StoreIntoObject(instance_reg, 1671 __ StoreIntoObject(instance_reg,
1671 FieldAddress(instance_reg, field().Offset()), 1672 FieldAddress(instance_reg, offset_in_bytes_),
1672 temp2); 1673 temp2);
1673 1674
1674 __ Bind(&copy_double); 1675 __ Bind(&copy_double);
1675 __ movsd(fpu_temp, FieldAddress(value_reg, Double::value_offset())); 1676 __ movsd(fpu_temp, FieldAddress(value_reg, Double::value_offset()));
1676 __ movsd(FieldAddress(temp, Double::value_offset()), fpu_temp); 1677 __ movsd(FieldAddress(temp, Double::value_offset()), fpu_temp);
1677 __ jmp(&skip_store); 1678 __ jmp(&skip_store);
1678 } 1679 }
1679 1680
1680 { 1681 {
1681 __ Bind(&store_float32x4); 1682 __ Bind(&store_float32x4);
1682 Label copy_float32x4; 1683 Label copy_float32x4;
1683 StoreInstanceFieldSlowPath* slow_path = 1684 StoreInstanceFieldSlowPath* slow_path =
1684 new StoreInstanceFieldSlowPath(this, compiler->float32x4_class()); 1685 new StoreInstanceFieldSlowPath(this, compiler->float32x4_class());
1685 compiler->AddSlowPathCode(slow_path); 1686 compiler->AddSlowPathCode(slow_path);
1686 1687
1687 __ movq(temp, FieldAddress(instance_reg, field().Offset())); 1688 __ movq(temp, FieldAddress(instance_reg, offset_in_bytes_));
1688 __ CompareObject(temp, Object::null_object(), PP); 1689 __ CompareObject(temp, Object::null_object(), PP);
1689 __ j(NOT_EQUAL, &copy_float32x4); 1690 __ j(NOT_EQUAL, &copy_float32x4);
1690 1691
1691 __ TryAllocate(compiler->float32x4_class(), 1692 __ TryAllocate(compiler->float32x4_class(),
1692 slow_path->entry_label(), 1693 slow_path->entry_label(),
1693 Assembler::kFarJump, 1694 Assembler::kFarJump,
1694 temp, 1695 temp,
1695 PP); 1696 PP);
1696 __ Bind(slow_path->exit_label()); 1697 __ Bind(slow_path->exit_label());
1697 __ movq(temp2, temp); 1698 __ movq(temp2, temp);
1698 __ StoreIntoObject(instance_reg, 1699 __ StoreIntoObject(instance_reg,
1699 FieldAddress(instance_reg, field().Offset()), 1700 FieldAddress(instance_reg, offset_in_bytes_),
1700 temp2); 1701 temp2);
1701 1702
1702 __ Bind(&copy_float32x4); 1703 __ Bind(&copy_float32x4);
1703 __ movups(fpu_temp, FieldAddress(value_reg, Float32x4::value_offset())); 1704 __ movups(fpu_temp, FieldAddress(value_reg, Float32x4::value_offset()));
1704 __ movups(FieldAddress(temp, Float32x4::value_offset()), fpu_temp); 1705 __ movups(FieldAddress(temp, Float32x4::value_offset()), fpu_temp);
1705 __ jmp(&skip_store); 1706 __ jmp(&skip_store);
1706 } 1707 }
1707 1708
1708 __ Bind(&store_pointer); 1709 __ Bind(&store_pointer);
1709 } 1710 }
1710 1711
1711 if (ShouldEmitStoreBarrier()) { 1712 if (ShouldEmitStoreBarrier()) {
1712 Register value_reg = locs()->in(1).reg(); 1713 Register value_reg = locs()->in(1).reg();
1713 __ StoreIntoObject(instance_reg, 1714 __ StoreIntoObject(instance_reg,
1714 FieldAddress(instance_reg, field().Offset()), 1715 FieldAddress(instance_reg, offset_in_bytes_),
1715 value_reg, 1716 value_reg,
1716 CanValueBeSmi()); 1717 CanValueBeSmi());
1717 } else { 1718 } else {
1718 if (locs()->in(1).IsConstant()) { 1719 if (locs()->in(1).IsConstant()) {
1719 __ StoreObject(FieldAddress(instance_reg, field().Offset()), 1720 __ StoreObject(FieldAddress(instance_reg, offset_in_bytes_),
1720 locs()->in(1).constant(), PP); 1721 locs()->in(1).constant(), PP);
1721 } else { 1722 } else {
1722 Register value_reg = locs()->in(1).reg(); 1723 Register value_reg = locs()->in(1).reg();
1723 __ StoreIntoObjectNoBarrier(instance_reg, 1724 __ StoreIntoObjectNoBarrier(instance_reg,
1724 FieldAddress(instance_reg, field().Offset()), value_reg); 1725 FieldAddress(instance_reg, offset_in_bytes_), value_reg);
1725 } 1726 }
1726 } 1727 }
1727 __ Bind(&skip_store); 1728 __ Bind(&skip_store);
1728 } 1729 }
1729 1730
1730 1731
1731 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(bool opt) const { 1732 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(bool opt) const {
1732 const intptr_t kNumInputs = 1; 1733 const intptr_t kNumInputs = 1;
1733 const intptr_t kNumTemps = 0; 1734 const intptr_t kNumTemps = 0;
1734 LocationSummary* summary = 1735 LocationSummary* summary =
(...skipping 3315 matching lines...) Expand 10 before | Expand all | Expand 10 after
5050 5051
5051 Label done; 5052 Label done;
5052 __ LoadObject(result, Bool::True(), PP); 5053 __ LoadObject(result, Bool::True(), PP);
5053 __ CompareRegisters(result, value); 5054 __ CompareRegisters(result, value);
5054 __ j(NOT_EQUAL, &done, Assembler::kNearJump); 5055 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
5055 __ LoadObject(result, Bool::False(), PP); 5056 __ LoadObject(result, Bool::False(), PP);
5056 __ Bind(&done); 5057 __ Bind(&done);
5057 } 5058 }
5058 5059
5059 5060
5060 LocationSummary* StoreVMFieldInstr::MakeLocationSummary(bool opt) const {
5061 const intptr_t kNumInputs = 2;
5062 const intptr_t kNumTemps = 0;
5063 LocationSummary* locs =
5064 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
5065 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister()
5066 : Location::RequiresRegister());
5067 locs->set_in(1, Location::RequiresRegister());
5068 return locs;
5069 }
5070
5071
5072 void StoreVMFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5073 Register value_reg = locs()->in(0).reg();
5074 Register dest_reg = locs()->in(1).reg();
5075
5076 if (value()->NeedsStoreBuffer()) {
5077 __ StoreIntoObject(dest_reg, FieldAddress(dest_reg, offset_in_bytes()),
5078 value_reg);
5079 } else {
5080 __ StoreIntoObjectNoBarrier(
5081 dest_reg, FieldAddress(dest_reg, offset_in_bytes()), value_reg);
5082 }
5083 }
5084
5085
5086 LocationSummary* AllocateObjectInstr::MakeLocationSummary(bool opt) const { 5061 LocationSummary* AllocateObjectInstr::MakeLocationSummary(bool opt) const {
5087 return MakeCallSummary(); 5062 return MakeCallSummary();
5088 } 5063 }
5089 5064
5090 5065
5091 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5066 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5092 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls())); 5067 const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls()));
5093 const ExternalLabel label(cls().ToCString(), stub.EntryPoint()); 5068 const ExternalLabel label(cls().ToCString(), stub.EntryPoint());
5094 compiler->GenerateCall(token_pos(), 5069 compiler->GenerateCall(token_pos(),
5095 &label, 5070 &label,
(...skipping 19 matching lines...) Expand all
5115 PcDescriptors::kOther, 5090 PcDescriptors::kOther,
5116 locs()); 5091 locs());
5117 __ Drop(2); // Discard type arguments and receiver. 5092 __ Drop(2); // Discard type arguments and receiver.
5118 } 5093 }
5119 5094
5120 } // namespace dart 5095 } // namespace dart
5121 5096
5122 #undef __ 5097 #undef __
5123 5098
5124 #endif // defined TARGET_ARCH_X64 5099 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698