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

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

Issue 10910252: Improve register usage for StoreInstanceField. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Addressed comment and improved StoreIndexed as well. Created 8 years, 3 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_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 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 924
925 LocationSummary* StoreIndexedInstr::MakeLocationSummary() const { 925 LocationSummary* StoreIndexedInstr::MakeLocationSummary() const {
926 const intptr_t kNumInputs = 3; 926 const intptr_t kNumInputs = 3;
927 const intptr_t kNumTemps = 0; 927 const intptr_t kNumTemps = 0;
928 LocationSummary* locs = 928 LocationSummary* locs =
929 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 929 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
930 locs->set_in(0, Location::RequiresRegister()); 930 locs->set_in(0, Location::RequiresRegister());
931 locs->set_in(1, CanBeImmediateIndex(index()) 931 locs->set_in(1, CanBeImmediateIndex(index())
932 ? Location::RegisterOrConstant(index()) 932 ? Location::RegisterOrConstant(index())
933 : Location::RequiresRegister()); 933 : Location::RequiresRegister());
934 locs->set_in(2, value()->NeedsStoreBuffer() 934 locs->set_in(2, ShouldEmitStoreBarrier()
935 ? Location::WritableRegister() 935 ? Location::WritableRegister()
936 : Location::RegisterOrConstant(value())); 936 : Location::RegisterOrConstant(value()));
937 return locs; 937 return locs;
938 } 938 }
939 939
940 940
941 void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 941 void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
942 Register array = locs()->in(0).reg(); 942 Register array = locs()->in(0).reg();
943 943
944 // Note that index is Smi, i.e, times 4. 944 // Note that index is Smi, i.e, times 4.
945 ASSERT(kSmiTagShift == 1); 945 ASSERT(kSmiTagShift == 1);
946 Location index = locs()->in(1); 946 Location index = locs()->in(1);
947 FieldAddress field_address = index.IsConstant() 947 FieldAddress field_address = index.IsConstant()
948 ? FieldAddress( 948 ? FieldAddress(
949 array, 949 array,
950 static_cast<int32_t>( 950 static_cast<int32_t>(
951 Smi::Cast(index.constant()).Value() * kWordSize + sizeof(RawArray))) 951 Smi::Cast(index.constant()).Value() * kWordSize + sizeof(RawArray)))
952 : FieldAddress(array, index.reg(), TIMES_4, sizeof(RawArray)); 952 : FieldAddress(array, index.reg(), TIMES_4, sizeof(RawArray));
953 953
954 if (this->value()->NeedsStoreBuffer() && emit_store_barrier()) { 954 if (ShouldEmitStoreBarrier()) {
955 Register value = locs()->in(2).reg(); 955 Register value = locs()->in(2).reg();
956 __ StoreIntoObject(array, field_address, value); 956 __ StoreIntoObject(array, field_address, value);
957 } else { 957 } else {
958 if (locs()->in(2).IsConstant()) { 958 if (locs()->in(2).IsConstant()) {
959 const Object& constant = locs()->in(2).constant(); 959 const Object& constant = locs()->in(2).constant();
960 __ StoreObject(field_address, constant); 960 __ StoreObject(field_address, constant);
961 } else { 961 } else {
962 Register value = locs()->in(2).reg(); 962 Register value = locs()->in(2).reg();
963 __ StoreIntoObjectNoBarrier(array, field_address, value); 963 __ StoreIntoObjectNoBarrier(array, field_address, value);
964 } 964 }
965 } 965 }
966 } 966 }
967 967
968 968
969 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const { 969 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const {
970 const intptr_t kNumInputs = 2; 970 const intptr_t kNumInputs = 2;
971 const intptr_t num_temps = 0; 971 const intptr_t num_temps = 0;
972 LocationSummary* summary = 972 LocationSummary* summary =
973 new LocationSummary(kNumInputs, num_temps, LocationSummary::kNoCall); 973 new LocationSummary(kNumInputs, num_temps, LocationSummary::kNoCall);
974 summary->set_in(0, Location::RequiresRegister()); 974 summary->set_in(0, Location::RequiresRegister());
975 summary->set_in(1, 975 summary->set_in(1, ShouldEmitStoreBarrier()
976 value()->NeedsStoreBuffer() ? Location::WritableRegister() 976 ? Location::WritableRegister()
977 : Location::RequiresRegister()); 977 : Location::RegisterOrConstant(value()));
978 return summary; 978 return summary;
979 } 979 }
980 980
981 981
982 void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 982 void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
983 Register instance_reg = locs()->in(0).reg(); 983 Register instance_reg = locs()->in(0).reg();
984 Register value_reg = locs()->in(1).reg(); 984 if (ShouldEmitStoreBarrier()) {
985 if (this->value()->NeedsStoreBuffer() && emit_store_barrier()) { 985 Register value_reg = locs()->in(1).reg();
986 __ StoreIntoObject(instance_reg, 986 __ StoreIntoObject(instance_reg,
987 FieldAddress(instance_reg, field().Offset()), value_reg); 987 FieldAddress(instance_reg, field().Offset()), value_reg);
988 } else { 988 } else {
989 __ StoreIntoObjectNoBarrier(instance_reg, 989 if (locs()->in(1).IsConstant()) {
990 FieldAddress(instance_reg, field().Offset()), value_reg); 990 __ StoreObject(FieldAddress(instance_reg, field().Offset()),
991 locs()->in(1).constant());
992 } else {
993 Register value_reg = locs()->in(1).reg();
994 __ StoreIntoObjectNoBarrier(instance_reg,
995 FieldAddress(instance_reg, field().Offset()), value_reg);
996 }
991 } 997 }
992 } 998 }
993 999
994 1000
995 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary() const { 1001 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary() const {
996 return LocationSummary::Make(0, 1002 return LocationSummary::Make(0,
997 Location::RequiresRegister(), 1003 Location::RequiresRegister(),
998 LocationSummary::kNoCall); 1004 LocationSummary::kNoCall);
999 } 1005 }
1000 1006
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after
2287 __ j(ABOVE_EQUAL, deopt); 2293 __ j(ABOVE_EQUAL, deopt);
2288 } 2294 }
2289 } 2295 }
2290 2296
2291 2297
2292 } // namespace dart 2298 } // namespace dart
2293 2299
2294 #undef __ 2300 #undef __
2295 2301
2296 #endif // defined TARGET_ARCH_X64 2302 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698