| 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_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 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 | 925 |
| 926 default: | 926 default: |
| 927 UNREACHABLE(); | 927 UNREACHABLE(); |
| 928 break; | 928 break; |
| 929 } | 929 } |
| 930 } | 930 } |
| 931 | 931 |
| 932 | 932 |
| 933 LocationSummary* StoreIndexedInstr::MakeLocationSummary() const { | 933 LocationSummary* StoreIndexedInstr::MakeLocationSummary() const { |
| 934 const intptr_t kNumInputs = 3; | 934 const intptr_t kNumInputs = 3; |
| 935 const intptr_t kNumTemps = |
| 936 (receiver_type() == kGrowableObjectArrayCid) ? 1 : 0; |
| 937 LocationSummary* locs = |
| 938 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 939 locs->set_in(0, Location::RequiresRegister()); |
| 940 locs->set_in(1, Location::RequiresRegister()); |
| 941 locs->set_in(2, value()->NeedsStoreBuffer() ? Location::WritableRegister() |
| 942 : Location::RequiresRegister()); |
| 935 if (receiver_type() == kGrowableObjectArrayCid) { | 943 if (receiver_type() == kGrowableObjectArrayCid) { |
| 936 const intptr_t kNumTemps = 1; | |
| 937 LocationSummary* locs = | |
| 938 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | |
| 939 locs->set_in(0, Location::RequiresRegister()); | |
| 940 locs->set_in(1, Location::RequiresRegister()); | |
| 941 locs->set_in(2, Location::RequiresRegister()); | |
| 942 locs->set_temp(0, Location::RequiresRegister()); | 944 locs->set_temp(0, Location::RequiresRegister()); |
| 943 return locs; | |
| 944 } else { | |
| 945 ASSERT(receiver_type() == kArrayCid); | |
| 946 return LocationSummary::Make(kNumInputs, | |
| 947 Location::NoLocation(), | |
| 948 LocationSummary::kNoCall); | |
| 949 } | 945 } |
| 946 return locs; |
| 950 } | 947 } |
| 951 | 948 |
| 952 | 949 |
| 953 void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 950 void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 954 Register receiver = locs()->in(0).reg(); | 951 Register receiver = locs()->in(0).reg(); |
| 955 Register index = locs()->in(1).reg(); | 952 Register index = locs()->in(1).reg(); |
| 956 Register value = locs()->in(2).reg(); | 953 Register value = locs()->in(2).reg(); |
| 957 | 954 |
| 958 switch (receiver_type()) { | 955 switch (receiver_type()) { |
| 959 case kArrayCid: | 956 case kArrayCid: |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 __ movq(result_reg, FieldAddress(instance_reg, field().Offset())); | 1009 __ movq(result_reg, FieldAddress(instance_reg, field().Offset())); |
| 1013 } | 1010 } |
| 1014 | 1011 |
| 1015 | 1012 |
| 1016 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const { | 1013 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary() const { |
| 1017 const intptr_t kNumInputs = 2; | 1014 const intptr_t kNumInputs = 2; |
| 1018 const intptr_t num_temps = 0; | 1015 const intptr_t num_temps = 0; |
| 1019 LocationSummary* summary = | 1016 LocationSummary* summary = |
| 1020 new LocationSummary(kNumInputs, num_temps, LocationSummary::kNoCall); | 1017 new LocationSummary(kNumInputs, num_temps, LocationSummary::kNoCall); |
| 1021 summary->set_in(0, Location::RequiresRegister()); | 1018 summary->set_in(0, Location::RequiresRegister()); |
| 1022 summary->set_in(1, Location::RequiresRegister()); | 1019 summary->set_in(1, |
| 1020 value()->NeedsStoreBuffer() ? Location::WritableRegister() |
| 1021 : Location::RequiresRegister()); |
| 1023 return summary; | 1022 return summary; |
| 1024 } | 1023 } |
| 1025 | 1024 |
| 1026 | 1025 |
| 1027 void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1026 void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1028 Register instance_reg = locs()->in(0).reg(); | 1027 Register instance_reg = locs()->in(0).reg(); |
| 1029 Register value_reg = locs()->in(1).reg(); | 1028 Register value_reg = locs()->in(1).reg(); |
| 1030 if (this->value()->NeedsStoreBuffer()) { | 1029 if (this->value()->NeedsStoreBuffer()) { |
| 1031 __ StoreIntoObject(instance_reg, | 1030 __ StoreIntoObject(instance_reg, |
| 1032 FieldAddress(instance_reg, field().Offset()), value_reg); | 1031 FieldAddress(instance_reg, field().Offset()), value_reg); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1046 | 1045 |
| 1047 void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1046 void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1048 Register result = locs()->out().reg(); | 1047 Register result = locs()->out().reg(); |
| 1049 __ LoadObject(result, field()); | 1048 __ LoadObject(result, field()); |
| 1050 __ movq(result, FieldAddress(result, Field::value_offset())); | 1049 __ movq(result, FieldAddress(result, Field::value_offset())); |
| 1051 } | 1050 } |
| 1052 | 1051 |
| 1053 | 1052 |
| 1054 LocationSummary* StoreStaticFieldInstr::MakeLocationSummary() const { | 1053 LocationSummary* StoreStaticFieldInstr::MakeLocationSummary() const { |
| 1055 LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall); | 1054 LocationSummary* locs = new LocationSummary(1, 1, LocationSummary::kNoCall); |
| 1056 locs->set_in(0, Location::RequiresRegister()); | 1055 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister() |
| 1056 : Location::RequiresRegister()); |
| 1057 locs->set_temp(0, Location::RequiresRegister()); | 1057 locs->set_temp(0, Location::RequiresRegister()); |
| 1058 locs->set_out(is_used() ? Location::SameAsFirstInput() | |
| 1059 : Location::NoLocation()); | |
| 1060 return locs; | 1058 return locs; |
| 1061 } | 1059 } |
| 1062 | 1060 |
| 1063 | 1061 |
| 1064 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1062 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1065 Register value = locs()->in(0).reg(); | 1063 Register value = locs()->in(0).reg(); |
| 1066 Register temp = locs()->temp(0).reg(); | 1064 Register temp = locs()->temp(0).reg(); |
| 1067 ASSERT(!is_used() || (locs()->out().reg() == value)); | |
| 1068 | 1065 |
| 1069 __ LoadObject(temp, field()); | 1066 __ LoadObject(temp, field()); |
| 1070 if (this->value()->NeedsStoreBuffer()) { | 1067 if (this->value()->NeedsStoreBuffer()) { |
| 1071 __ StoreIntoObject(temp, FieldAddress(temp, Field::value_offset()), value); | 1068 __ StoreIntoObject(temp, FieldAddress(temp, Field::value_offset()), value); |
| 1072 } else { | 1069 } else { |
| 1073 __ StoreIntoObjectNoBarrier( | 1070 __ StoreIntoObjectNoBarrier( |
| 1074 temp, FieldAddress(temp, Field::value_offset()), value); | 1071 temp, FieldAddress(temp, Field::value_offset()), value); |
| 1075 } | 1072 } |
| 1076 } | 1073 } |
| 1077 | 1074 |
| (...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2313 __ j(ABOVE_EQUAL, deopt); | 2310 __ j(ABOVE_EQUAL, deopt); |
| 2314 } | 2311 } |
| 2315 } | 2312 } |
| 2316 | 2313 |
| 2317 | 2314 |
| 2318 } // namespace dart | 2315 } // namespace dart |
| 2319 | 2316 |
| 2320 #undef __ | 2317 #undef __ |
| 2321 | 2318 |
| 2322 #endif // defined TARGET_ARCH_X64 | 2319 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |