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 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 __ testq(index, Immediate(kSmiTagMask)); | 913 __ testq(index, Immediate(kSmiTagMask)); |
914 __ j(NOT_ZERO, deopt); | 914 __ j(NOT_ZERO, deopt); |
915 | 915 |
916 switch (receiver_type()) { | 916 switch (receiver_type()) { |
917 case kArrayCid: | 917 case kArrayCid: |
918 case kImmutableArrayCid: | 918 case kImmutableArrayCid: |
919 __ cmpq(index, FieldAddress(receiver, Array::length_offset())); | 919 __ cmpq(index, FieldAddress(receiver, Array::length_offset())); |
920 __ j(ABOVE_EQUAL, deopt); | 920 __ j(ABOVE_EQUAL, deopt); |
921 // Note that index is Smi, i.e, times 4. | 921 // Note that index is Smi, i.e, times 4. |
922 ASSERT(kSmiTagShift == 1); | 922 ASSERT(kSmiTagShift == 1); |
923 if (this->value()->BindsToConstant()) { | 923 if (this->value()->NeedsStoreBuffer()) { |
924 // Compile time constants are Smi or allocated in the old space. | |
925 __ movq(FieldAddress(receiver, index, TIMES_4, sizeof(RawArray)), | |
926 value); | |
927 } else { | |
928 __ StoreIntoObject(receiver, | 924 __ StoreIntoObject(receiver, |
929 FieldAddress(receiver, index, TIMES_4, sizeof(RawArray)), | 925 FieldAddress(receiver, index, TIMES_4, sizeof(RawArray)), |
930 value); | 926 value); |
| 927 } else { |
| 928 __ StoreIntoObjectNoBarrier(receiver, |
| 929 FieldAddress(receiver, index, TIMES_4, sizeof(RawArray)), |
| 930 value); |
931 } | 931 } |
932 break; | 932 break; |
933 | 933 |
934 case kGrowableObjectArrayCid: { | 934 case kGrowableObjectArrayCid: { |
935 Register temp = locs()->temp(0).reg(); | 935 Register temp = locs()->temp(0).reg(); |
936 __ cmpq(index, | 936 __ cmpq(index, |
937 FieldAddress(receiver, GrowableObjectArray::length_offset())); | 937 FieldAddress(receiver, GrowableObjectArray::length_offset())); |
938 __ j(ABOVE_EQUAL, deopt); | 938 __ j(ABOVE_EQUAL, deopt); |
939 __ movq(temp, FieldAddress(receiver, GrowableObjectArray::data_offset())); | 939 __ movq(temp, FieldAddress(receiver, GrowableObjectArray::data_offset())); |
940 // Note that index is Smi, i.e, times 4. | 940 // Note that index is Smi, i.e, times 4. |
941 ASSERT(kSmiTagShift == 1); | 941 ASSERT(kSmiTagShift == 1); |
942 if (this->value()->BindsToConstant()) { | 942 if (this->value()->NeedsStoreBuffer()) { |
943 // Compile time constants are Smi or allocated in the old space. | |
944 __ movq(FieldAddress(temp, index, TIMES_4, sizeof(RawArray)), | |
945 value); | |
946 } else { | |
947 __ StoreIntoObject(temp, | 943 __ StoreIntoObject(temp, |
948 FieldAddress(temp, index, TIMES_4, sizeof(RawArray)), | 944 FieldAddress(temp, index, TIMES_4, sizeof(RawArray)), |
949 value); | 945 value); |
| 946 } else { |
| 947 __ StoreIntoObjectNoBarrier(temp, |
| 948 FieldAddress(temp, index, TIMES_4, sizeof(RawArray)), |
| 949 value); |
950 } | 950 } |
951 break; | 951 break; |
952 } | 952 } |
953 | 953 |
954 default: | 954 default: |
955 UNREACHABLE(); | 955 UNREACHABLE(); |
956 break; | 956 break; |
957 } | 957 } |
958 } | 958 } |
959 | 959 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 Label* deopt = compiler->AddDeoptStub(original()->deopt_id(), | 1011 Label* deopt = compiler->AddDeoptStub(original()->deopt_id(), |
1012 original()->try_index(), | 1012 original()->try_index(), |
1013 kDeoptInstanceGetterSameTarget); | 1013 kDeoptInstanceGetterSameTarget); |
1014 // Smis do not have instance fields (Smi class is always first). | 1014 // Smis do not have instance fields (Smi class is always first). |
1015 Register temp_reg = locs()->temp(0).reg(); | 1015 Register temp_reg = locs()->temp(0).reg(); |
1016 ASSERT(temp_reg != instance_reg); | 1016 ASSERT(temp_reg != instance_reg); |
1017 ASSERT(temp_reg != value_reg); | 1017 ASSERT(temp_reg != value_reg); |
1018 ASSERT(ic_data() != NULL); | 1018 ASSERT(ic_data() != NULL); |
1019 compiler->EmitClassChecksNoSmi(*ic_data(), instance_reg, temp_reg, deopt); | 1019 compiler->EmitClassChecksNoSmi(*ic_data(), instance_reg, temp_reg, deopt); |
1020 } | 1020 } |
1021 if (this->value()->BindsToConstant()) { | 1021 if (this->value()->NeedsStoreBuffer()) { |
1022 // Compile time constants are Smi or allocated in the old space. | 1022 __ StoreIntoObject(instance_reg, |
1023 __ movq(FieldAddress(instance_reg, field().Offset()), value_reg); | 1023 FieldAddress(instance_reg, field().Offset()), value_reg); |
1024 } else { | 1024 } else { |
1025 __ StoreIntoObject(instance_reg, | 1025 __ StoreIntoObjectNoBarrier(instance_reg, |
1026 FieldAddress(instance_reg, field().Offset()), value_reg); | 1026 FieldAddress(instance_reg, field().Offset()), value_reg); |
1027 } | 1027 } |
1028 } | 1028 } |
1029 | 1029 |
1030 | 1030 |
1031 LocationSummary* LoadStaticFieldComp::MakeLocationSummary() const { | 1031 LocationSummary* LoadStaticFieldComp::MakeLocationSummary() const { |
1032 return LocationSummary::Make(0, | 1032 return LocationSummary::Make(0, |
1033 Location::RequiresRegister(), | 1033 Location::RequiresRegister(), |
1034 LocationSummary::kNoCall); | 1034 LocationSummary::kNoCall); |
1035 } | 1035 } |
(...skipping 14 matching lines...) Expand all Loading... |
1050 return locs; | 1050 return locs; |
1051 } | 1051 } |
1052 | 1052 |
1053 | 1053 |
1054 void StoreStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1054 void StoreStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
1055 Register value = locs()->in(0).reg(); | 1055 Register value = locs()->in(0).reg(); |
1056 Register temp = locs()->temp(0).reg(); | 1056 Register temp = locs()->temp(0).reg(); |
1057 ASSERT(locs()->out().reg() == value); | 1057 ASSERT(locs()->out().reg() == value); |
1058 | 1058 |
1059 __ LoadObject(temp, field()); | 1059 __ LoadObject(temp, field()); |
1060 if (this->value()->BindsToConstant()) { | 1060 if (this->value()->NeedsStoreBuffer()) { |
1061 // Compile time constants are Smi or allocated in the old space. | 1061 __ StoreIntoObject(temp, FieldAddress(temp, Field::value_offset()), value); |
1062 __ movq(FieldAddress(temp, Field::value_offset()), value); | |
1063 } else { | 1062 } else { |
1064 __ StoreIntoObject(temp, FieldAddress(temp, Field::value_offset()), value); | 1063 __ StoreIntoObjectNoBarrier( |
| 1064 temp, FieldAddress(temp, Field::value_offset()), value); |
1065 } | 1065 } |
1066 } | 1066 } |
1067 | 1067 |
1068 | 1068 |
1069 LocationSummary* InstanceOfComp::MakeLocationSummary() const { | 1069 LocationSummary* InstanceOfComp::MakeLocationSummary() const { |
1070 const intptr_t kNumInputs = 3; | 1070 const intptr_t kNumInputs = 3; |
1071 const intptr_t kNumTemps = 0; | 1071 const intptr_t kNumTemps = 0; |
1072 LocationSummary* summary = | 1072 LocationSummary* summary = |
1073 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 1073 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
1074 summary->set_in(0, Location::RegisterLocation(RAX)); | 1074 summary->set_in(0, Location::RegisterLocation(RAX)); |
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2442 __ testq(value, Immediate(kSmiTagMask)); | 2442 __ testq(value, Immediate(kSmiTagMask)); |
2443 __ j(NOT_ZERO, deopt); | 2443 __ j(NOT_ZERO, deopt); |
2444 } | 2444 } |
2445 | 2445 |
2446 | 2446 |
2447 } // namespace dart | 2447 } // namespace dart |
2448 | 2448 |
2449 #undef __ | 2449 #undef __ |
2450 | 2450 |
2451 #endif // defined TARGET_ARCH_X64 | 2451 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |