OLD | NEW |
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 Loading... |
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(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 __ movl(result_reg, FieldAddress(instance_reg, field().Offset())); | 991 __ movl(result_reg, FieldAddress(instance_reg, field().Offset())); |
991 } | 992 } |
992 | 993 |
993 | 994 |
994 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const { | 995 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const { |
995 const intptr_t kNumInputs = 2; | 996 const intptr_t kNumInputs = 2; |
996 const intptr_t num_temps = 0; | 997 const intptr_t num_temps = 0; |
997 LocationSummary* summary = | 998 LocationSummary* summary = |
998 new LocationSummary(kNumInputs, num_temps, LocationSummary::kNoCall); | 999 new LocationSummary(kNumInputs, num_temps, LocationSummary::kNoCall); |
999 summary->set_in(0, Location::RequiresRegister()); | 1000 summary->set_in(0, Location::RequiresRegister()); |
1000 summary->set_in(1, Location::RequiresRegister()); | 1001 summary->set_in(1, |
| 1002 value()->NeedsStoreBuffer() ? Location::WritableRegister() |
| 1003 : Location::RequiresRegister()); |
1001 return summary; | 1004 return summary; |
1002 } | 1005 } |
1003 | 1006 |
1004 | 1007 |
1005 void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1008 void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1006 Register instance_reg = locs()->in(0).reg(); | 1009 Register instance_reg = locs()->in(0).reg(); |
1007 Register value_reg = locs()->in(1).reg(); | 1010 Register value_reg = locs()->in(1).reg(); |
1008 if (this->value()->NeedsStoreBuffer()) { | 1011 if (this->value()->NeedsStoreBuffer()) { |
1009 __ StoreIntoObject(instance_reg, | 1012 __ StoreIntoObject(instance_reg, |
1010 FieldAddress(instance_reg, field().Offset()), value_reg); | 1013 FieldAddress(instance_reg, field().Offset()), value_reg); |
(...skipping 13 matching lines...) Expand all Loading... |
1024 | 1027 |
1025 void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1028 void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1026 Register result = locs()->out().reg(); | 1029 Register result = locs()->out().reg(); |
1027 __ LoadObject(result, field()); | 1030 __ LoadObject(result, field()); |
1028 __ movl(result, FieldAddress(result, Field::value_offset())); | 1031 __ movl(result, FieldAddress(result, Field::value_offset())); |
1029 } | 1032 } |
1030 | 1033 |
1031 | 1034 |
1032 LocationSummary* StoreStaticFieldInstr::MakeLocationSummary() const { | 1035 LocationSummary* StoreStaticFieldInstr::MakeLocationSummary() const { |
1033 LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall); | 1036 LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall); |
1034 locs->set_in(0, Location::RequiresRegister()); | 1037 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister() |
| 1038 : Location::RequiresRegister()); |
1035 locs->set_temp(0, Location::RequiresRegister()); | 1039 locs->set_temp(0, Location::RequiresRegister()); |
1036 locs->set_out(is_used() ? Location::SameAsFirstInput() | |
1037 : Location::NoLocation()); | |
1038 return locs; | 1040 return locs; |
1039 } | 1041 } |
1040 | 1042 |
1041 | 1043 |
1042 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1044 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1043 Register value = locs()->in(0).reg(); | 1045 Register value = locs()->in(0).reg(); |
1044 Register temp = locs()->temp(0).reg(); | 1046 Register temp = locs()->temp(0).reg(); |
1045 ASSERT(!is_used() || (locs()->out().reg() == value)); | |
1046 | 1047 |
1047 __ LoadObject(temp, field()); | 1048 __ LoadObject(temp, field()); |
1048 if (this->value()->NeedsStoreBuffer()) { | 1049 if (this->value()->NeedsStoreBuffer()) { |
1049 __ StoreIntoObject(temp, FieldAddress(temp, Field::value_offset()), value); | 1050 __ StoreIntoObject(temp, FieldAddress(temp, Field::value_offset()), value); |
1050 } else { | 1051 } else { |
1051 __ StoreIntoObjectNoBarrier( | 1052 __ StoreIntoObjectNoBarrier( |
1052 temp, FieldAddress(temp, Field::value_offset()), value); | 1053 temp, FieldAddress(temp, Field::value_offset()), value); |
1053 } | 1054 } |
1054 } | 1055 } |
1055 | 1056 |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2284 __ j(ABOVE_EQUAL, deopt); | 2285 __ j(ABOVE_EQUAL, deopt); |
2285 } | 2286 } |
2286 } | 2287 } |
2287 | 2288 |
2288 | 2289 |
2289 } // namespace dart | 2290 } // namespace dart |
2290 | 2291 |
2291 #undef __ | 2292 #undef __ |
2292 | 2293 |
2293 #endif // defined TARGET_ARCH_X64 | 2294 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |