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

Side by Side Diff: runtime/vm/intermediate_language_ia32.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.h ('k') | runtime/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 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 906
907 LocationSummary* StoreIndexedInstr::MakeLocationSummary() const { 907 LocationSummary* StoreIndexedInstr::MakeLocationSummary() const {
908 const intptr_t kNumInputs = 3; 908 const intptr_t kNumInputs = 3;
909 const intptr_t kNumTemps = 0; 909 const intptr_t kNumTemps = 0;
910 LocationSummary* locs = 910 LocationSummary* locs =
911 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 911 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
912 locs->set_in(0, Location::RequiresRegister()); 912 locs->set_in(0, Location::RequiresRegister());
913 locs->set_in(1, CanBeImmediateIndex(index()) 913 locs->set_in(1, CanBeImmediateIndex(index())
914 ? Location::RegisterOrConstant(index()) 914 ? Location::RegisterOrConstant(index())
915 : Location::RequiresRegister()); 915 : Location::RequiresRegister());
916 locs->set_in(2, value()->NeedsStoreBuffer() 916 locs->set_in(2, ShouldEmitStoreBarrier()
917 ? Location::WritableRegister() 917 ? Location::WritableRegister()
918 : Location::RegisterOrConstant(value())); 918 : Location::RegisterOrConstant(value()));
919 return locs; 919 return locs;
920 } 920 }
921 921
922 922
923 void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 923 void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
924 Register array = locs()->in(0).reg(); 924 Register array = locs()->in(0).reg();
925 925
926 // Note that index is Smi, i.e, times 2. 926 // Note that index is Smi, i.e, times 2.
927 ASSERT(kSmiTagShift == 1); 927 ASSERT(kSmiTagShift == 1);
928 Location index = locs()->in(1); 928 Location index = locs()->in(1);
929 FieldAddress field_address = index.IsConstant() 929 FieldAddress field_address = index.IsConstant()
930 ? FieldAddress( 930 ? FieldAddress(
931 array, 931 array,
932 Smi::Cast(index.constant()).Value() * kWordSize + sizeof(RawArray)) 932 Smi::Cast(index.constant()).Value() * kWordSize + sizeof(RawArray))
933 : FieldAddress(array, index.reg(), TIMES_2, sizeof(RawArray)); 933 : FieldAddress(array, index.reg(), TIMES_2, sizeof(RawArray));
934 934
935 if (this->value()->NeedsStoreBuffer() && emit_store_barrier()) { 935 if (ShouldEmitStoreBarrier()) {
936 Register value = locs()->in(2).reg(); 936 Register value = locs()->in(2).reg();
937 __ StoreIntoObject(array, field_address, value); 937 __ StoreIntoObject(array, field_address, value);
938 } else { 938 } else {
939 if (locs()->in(2).IsConstant()) { 939 if (locs()->in(2).IsConstant()) {
940 const Object& constant = locs()->in(2).constant(); 940 const Object& constant = locs()->in(2).constant();
941 __ StoreIntoObjectNoBarrier(array, field_address, constant); 941 __ StoreIntoObjectNoBarrier(array, field_address, constant);
942 } else { 942 } else {
943 Register value = locs()->in(2).reg(); 943 Register value = locs()->in(2).reg();
944 __ StoreIntoObjectNoBarrier(array, field_address, value); 944 __ StoreIntoObjectNoBarrier(array, field_address, value);
945 } 945 }
946 } 946 }
947 } 947 }
948 948
949 949
950 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const { 950 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const {
951 const intptr_t kNumInputs = 2; 951 const intptr_t kNumInputs = 2;
952 const intptr_t num_temps = 0; 952 const intptr_t num_temps = 0;
953 LocationSummary* summary = 953 LocationSummary* summary =
954 new LocationSummary(kNumInputs, num_temps, LocationSummary::kNoCall); 954 new LocationSummary(kNumInputs, num_temps, LocationSummary::kNoCall);
955 summary->set_in(0, Location::RequiresRegister()); 955 summary->set_in(0, Location::RequiresRegister());
956 summary->set_in(1, 956 summary->set_in(1, ShouldEmitStoreBarrier()
957 value()->NeedsStoreBuffer() ? Location::WritableRegister() 957 ? Location::WritableRegister()
958 : Location::RequiresRegister()); 958 : Location::RegisterOrConstant(value()));
959 return summary; 959 return summary;
960 } 960 }
961 961
962 962
963 void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 963 void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
964 Register instance_reg = locs()->in(0).reg(); 964 Register instance_reg = locs()->in(0).reg();
965 Register value_reg = locs()->in(1).reg(); 965 if (ShouldEmitStoreBarrier()) {
966 if (this->value()->NeedsStoreBuffer() && emit_store_barrier()) { 966 Register value_reg = locs()->in(1).reg();
967 __ StoreIntoObject(instance_reg, 967 __ StoreIntoObject(instance_reg,
968 FieldAddress(instance_reg, field().Offset()), value_reg); 968 FieldAddress(instance_reg, field().Offset()), value_reg);
969 } else { 969 } else {
970 __ StoreIntoObjectNoBarrier(instance_reg, 970 if (locs()->in(1).IsConstant()) {
971 FieldAddress(instance_reg, field().Offset()), value_reg); 971 __ StoreIntoObjectNoBarrier(
972 instance_reg,
973 FieldAddress(instance_reg, field().Offset()),
974 locs()->in(1).constant());
975 } else {
976 Register value_reg = locs()->in(1).reg();
977 __ StoreIntoObjectNoBarrier(instance_reg,
978 FieldAddress(instance_reg, field().Offset()), value_reg);
979 }
972 } 980 }
973 } 981 }
974 982
975 983
976 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary() const { 984 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary() const {
977 return LocationSummary::Make(0, 985 return LocationSummary::Make(0,
978 Location::RequiresRegister(), 986 Location::RequiresRegister(),
979 LocationSummary::kNoCall); 987 LocationSummary::kNoCall);
980 } 988 }
981 989
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
2261 __ j(ABOVE_EQUAL, deopt); 2269 __ j(ABOVE_EQUAL, deopt);
2262 } 2270 }
2263 } 2271 }
2264 2272
2265 2273
2266 } // namespace dart 2274 } // namespace dart
2267 2275
2268 #undef __ 2276 #undef __
2269 2277
2270 #endif // defined TARGET_ARCH_X64 2278 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698