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

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

Issue 10909169: Add support for WritableRegister policy in the register allocator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 913
914 LocationSummary* StoreIndexedInstr::MakeLocationSummary() const { 914 LocationSummary* StoreIndexedInstr::MakeLocationSummary() const {
915 ASSERT((receiver_type() == kGrowableObjectArrayCid) || 915 ASSERT((receiver_type() == kGrowableObjectArrayCid) ||
916 (receiver_type() == kArrayCid)); 916 (receiver_type() == kArrayCid));
917 const intptr_t kNumInputs = 3; 917 const intptr_t kNumInputs = 3;
918 const intptr_t kNumTemps = receiver_type() == kGrowableObjectArrayCid ? 1 : 0; 918 const intptr_t kNumTemps = receiver_type() == kGrowableObjectArrayCid ? 1 : 0;
919 LocationSummary* locs = 919 LocationSummary* locs =
920 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 920 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
921 locs->set_in(0, Location::RequiresRegister()); 921 locs->set_in(0, Location::RequiresRegister());
922 locs->set_in(1, Location::RequiresRegister()); 922 locs->set_in(1, Location::RequiresRegister());
923 locs->set_in(2, Location::RequiresRegister()); 923 locs->set_in(2, value()->NeedsStoreBuffer() ? Location::WritableRegister()
924 : Location::RequiresRegister());
924 if (receiver_type() == kGrowableObjectArrayCid) { 925 if (receiver_type() == kGrowableObjectArrayCid) {
925 locs->set_temp(0, Location::RequiresRegister()); 926 locs->set_temp(0, Location::RequiresRegister());
926 } 927 }
927 return locs; 928 return locs;
928 } 929 }
929 930
930 931
931 void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 932 void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
932 Register receiver = locs()->in(0).reg(); 933 Register receiver = locs()->in(0).reg();
933 Register index = locs()->in(1).reg(); 934 Register index = locs()->in(1).reg();
934 Register value = locs()->in(2).reg(); 935 Register value = locs()->in(2).reg();
935 936
936 switch (receiver_type()) { 937 switch (receiver_type()) {
937 case kArrayCid: 938 case kArrayCid:
938 case kImmutableArrayCid: 939 case kImmutableArrayCid:
939 // Note that index is Smi, i.e, times 2. 940 // Note that index is Smi, i.e, times 2.
940 ASSERT(kSmiTagShift == 1); 941 ASSERT(kSmiTagShift == 1);
941 if (this->value()->NeedsStoreBuffer()) { 942 if (this->value()->NeedsStoreBuffer()) {
942 __ StoreIntoObject(receiver, 943 __ StoreIntoObject(
Ivan Posva 2012/09/11 11:57:30 ?
Vyacheslav Egorov (Google) 2012/09/11 12:18:05 Done.
944 receiver,
943 FieldAddress(receiver, index, TIMES_2, sizeof(RawArray)), 945 FieldAddress(receiver, index, TIMES_2, sizeof(RawArray)),
944 value); 946 value);
945 } else { 947 } else {
946 __ StoreIntoObjectNoBarrier(receiver, 948 __ StoreIntoObjectNoBarrier(receiver,
947 FieldAddress(receiver, index, TIMES_2, sizeof(RawArray)), 949 FieldAddress(receiver, index, TIMES_2, sizeof(RawArray)),
948 value); 950 value);
949 } 951 }
950 break; 952 break;
951 953
952 case kGrowableObjectArrayCid: { 954 case kGrowableObjectArrayCid: {
953 Register temp = locs()->temp(0).reg(); 955 Register temp = locs()->temp(0).reg();
954 __ movl(temp, FieldAddress(receiver, GrowableObjectArray::data_offset())); 956 __ movl(temp, FieldAddress(receiver, GrowableObjectArray::data_offset()));
955 // Note that index is Smi, i.e, times 2. 957 // Note that index is Smi, i.e, times 2.
956 ASSERT(kSmiTagShift == 1); 958 ASSERT(kSmiTagShift == 1);
957 if (this->value()->NeedsStoreBuffer()) { 959 if (this->value()->NeedsStoreBuffer()) {
958 __ StoreIntoObject(temp, 960 __ StoreIntoObject(
Ivan Posva 2012/09/11 11:57:30 ?
Vyacheslav Egorov (Google) 2012/09/11 12:18:05 Done.
961 temp,
959 FieldAddress(temp, index, TIMES_2, sizeof(RawArray)), 962 FieldAddress(temp, index, TIMES_2, sizeof(RawArray)),
960 value); 963 value);
961 } else { 964 } else {
962 __ StoreIntoObjectNoBarrier(temp, 965 __ StoreIntoObjectNoBarrier(temp,
963 FieldAddress(temp, index, TIMES_2, sizeof(RawArray)), 966 FieldAddress(temp, index, TIMES_2, sizeof(RawArray)),
964 value); 967 value);
965 } 968 }
966 break; 969 break;
967 } 970 }
968 971
(...skipping 21 matching lines...) Expand all
990 __ movl(result_reg, FieldAddress(instance_reg, field().Offset())); 993 __ movl(result_reg, FieldAddress(instance_reg, field().Offset()));
991 } 994 }
992 995
993 996
994 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const { 997 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const {
995 const intptr_t kNumInputs = 2; 998 const intptr_t kNumInputs = 2;
996 const intptr_t num_temps = 0; 999 const intptr_t num_temps = 0;
997 LocationSummary* summary = 1000 LocationSummary* summary =
998 new LocationSummary(kNumInputs, num_temps, LocationSummary::kNoCall); 1001 new LocationSummary(kNumInputs, num_temps, LocationSummary::kNoCall);
999 summary->set_in(0, Location::RequiresRegister()); 1002 summary->set_in(0, Location::RequiresRegister());
1000 summary->set_in(1, Location::RequiresRegister()); 1003 summary->set_in(1,
1004 value()->NeedsStoreBuffer() ? Location::WritableRegister()
1005 : Location::RequiresRegister());
1001 return summary; 1006 return summary;
1002 } 1007 }
1003 1008
1004 1009
1005 void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1010 void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1006 Register instance_reg = locs()->in(0).reg(); 1011 Register instance_reg = locs()->in(0).reg();
1007 Register value_reg = locs()->in(1).reg(); 1012 Register value_reg = locs()->in(1).reg();
1008 if (this->value()->NeedsStoreBuffer()) { 1013 if (this->value()->NeedsStoreBuffer()) {
1009 __ StoreIntoObject(instance_reg, 1014 __ StoreIntoObject(
1010 FieldAddress(instance_reg, field().Offset()), value_reg); 1015 instance_reg,
1016 FieldAddress(instance_reg, field().Offset()),
1017 value_reg);
1011 } else { 1018 } else {
1012 __ StoreIntoObjectNoBarrier(instance_reg, 1019 __ StoreIntoObjectNoBarrier(instance_reg,
1013 FieldAddress(instance_reg, field().Offset()), value_reg); 1020 FieldAddress(instance_reg, field().Offset()), value_reg);
1014 } 1021 }
1015 } 1022 }
1016 1023
1017 1024
1018 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary() const { 1025 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary() const {
1019 return LocationSummary::Make(0, 1026 return LocationSummary::Make(0,
1020 Location::RequiresRegister(), 1027 Location::RequiresRegister(),
1021 LocationSummary::kNoCall); 1028 LocationSummary::kNoCall);
1022 } 1029 }
1023 1030
1024 1031
1025 void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1032 void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1026 Register result = locs()->out().reg(); 1033 Register result = locs()->out().reg();
1027 __ LoadObject(result, field()); 1034 __ LoadObject(result, field());
1028 __ movl(result, FieldAddress(result, Field::value_offset())); 1035 __ movl(result, FieldAddress(result, Field::value_offset()));
1029 } 1036 }
1030 1037
1031 1038
1032 LocationSummary* StoreStaticFieldInstr::MakeLocationSummary() const { 1039 LocationSummary* StoreStaticFieldInstr::MakeLocationSummary() const {
1033 LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall); 1040 LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall);
1034 locs->set_in(0, Location::RequiresRegister()); 1041 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister()
1042 : Location::RequiresRegister());
1035 locs->set_temp(0, Location::RequiresRegister()); 1043 locs->set_temp(0, Location::RequiresRegister());
1036 locs->set_out(is_used() ? Location::SameAsFirstInput()
1037 : Location::NoLocation());
1038 return locs; 1044 return locs;
1039 } 1045 }
1040 1046
1041 1047
1042 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1048 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1043 Register value = locs()->in(0).reg(); 1049 Register value = locs()->in(0).reg();
1044 Register temp = locs()->temp(0).reg(); 1050 Register temp = locs()->temp(0).reg();
1045 ASSERT(!is_used() || (locs()->out().reg() == value));
1046 1051
1047 __ LoadObject(temp, field()); 1052 __ LoadObject(temp, field());
1048 if (this->value()->NeedsStoreBuffer()) { 1053 if (this->value()->NeedsStoreBuffer()) {
1049 __ StoreIntoObject(temp, FieldAddress(temp, Field::value_offset()), value); 1054 __ StoreIntoObject(temp,
Ivan Posva 2012/09/11 11:57:30 ditto
Vyacheslav Egorov (Google) 2012/09/11 12:18:05 Done.
1055 FieldAddress(temp, Field::value_offset()),
1056 value);
1050 } else { 1057 } else {
1051 __ StoreIntoObjectNoBarrier( 1058 __ StoreIntoObjectNoBarrier(
1052 temp, FieldAddress(temp, Field::value_offset()), value); 1059 temp, FieldAddress(temp, Field::value_offset()), value);
1053 } 1060 }
1054 } 1061 }
1055 1062
1056 1063
1057 LocationSummary* InstanceOfInstr::MakeLocationSummary() const { 1064 LocationSummary* InstanceOfInstr::MakeLocationSummary() const {
1058 const intptr_t kNumInputs = 3; 1065 const intptr_t kNumInputs = 3;
1059 const intptr_t kNumTemps = 0; 1066 const intptr_t kNumTemps = 0;
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
2284 __ j(ABOVE_EQUAL, deopt); 2291 __ j(ABOVE_EQUAL, deopt);
2285 } 2292 }
2286 } 2293 }
2287 2294
2288 2295
2289 } // namespace dart 2296 } // namespace dart
2290 2297
2291 #undef __ 2298 #undef __
2292 2299
2293 #endif // defined TARGET_ARCH_X64 2300 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698