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 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 __ testl(index, Immediate(kSmiTagMask)); | 894 __ testl(index, Immediate(kSmiTagMask)); |
895 __ j(NOT_ZERO, deopt); | 895 __ j(NOT_ZERO, deopt); |
896 | 896 |
897 switch (receiver_type()) { | 897 switch (receiver_type()) { |
898 case kArrayCid: | 898 case kArrayCid: |
899 case kImmutableArrayCid: | 899 case kImmutableArrayCid: |
900 __ cmpl(index, FieldAddress(receiver, Array::length_offset())); | 900 __ cmpl(index, FieldAddress(receiver, Array::length_offset())); |
901 __ j(ABOVE_EQUAL, deopt); | 901 __ j(ABOVE_EQUAL, deopt); |
902 // Note that index is Smi, i.e, times 2. | 902 // Note that index is Smi, i.e, times 2. |
903 ASSERT(kSmiTagShift == 1); | 903 ASSERT(kSmiTagShift == 1); |
904 if (this->value()->BindsToConstant()) { | 904 if (this->value()->NeedsStoreBuffer()) { |
905 // Compile time constants are Smi or allocated in the old space. | |
906 __ movl(FieldAddress(receiver, index, TIMES_2, sizeof(RawArray)), | |
907 value); | |
908 } else { | |
909 __ StoreIntoObject(receiver, | 905 __ StoreIntoObject(receiver, |
910 FieldAddress(receiver, index, TIMES_2, sizeof(RawArray)), | 906 FieldAddress(receiver, index, TIMES_2, sizeof(RawArray)), |
911 value); | 907 value); |
| 908 } else { |
| 909 __ StoreIntoObjectNoBarrier(receiver, |
| 910 FieldAddress(receiver, index, TIMES_2, sizeof(RawArray)), |
| 911 value); |
912 } | 912 } |
913 break; | 913 break; |
914 | 914 |
915 case kGrowableObjectArrayCid: { | 915 case kGrowableObjectArrayCid: { |
916 __ cmpl(index, | 916 __ cmpl(index, |
917 FieldAddress(receiver, GrowableObjectArray::length_offset())); | 917 FieldAddress(receiver, GrowableObjectArray::length_offset())); |
918 __ j(ABOVE_EQUAL, deopt); | 918 __ j(ABOVE_EQUAL, deopt); |
919 __ movl(temp, FieldAddress(receiver, GrowableObjectArray::data_offset())); | 919 __ movl(temp, FieldAddress(receiver, GrowableObjectArray::data_offset())); |
920 // Note that index is Smi, i.e, times 2. | 920 // Note that index is Smi, i.e, times 2. |
921 ASSERT(kSmiTagShift == 1); | 921 ASSERT(kSmiTagShift == 1); |
922 if (this->value()->BindsToConstant()) { | 922 if (this->value()->NeedsStoreBuffer()) { |
923 // Compile time constants are Smi or allocated in the old space. | |
924 __ movl(FieldAddress(temp, index, TIMES_2, sizeof(RawArray)), | |
925 value); | |
926 } else { | |
927 __ StoreIntoObject(temp, | 923 __ StoreIntoObject(temp, |
928 FieldAddress(temp, index, TIMES_2, sizeof(RawArray)), | 924 FieldAddress(temp, index, TIMES_2, sizeof(RawArray)), |
929 value); | 925 value); |
| 926 } else { |
| 927 __ StoreIntoObjectNoBarrier(temp, |
| 928 FieldAddress(temp, index, TIMES_2, sizeof(RawArray)), |
| 929 value); |
930 } | 930 } |
931 break; | 931 break; |
932 } | 932 } |
933 | 933 |
934 default: | 934 default: |
935 UNREACHABLE(); | 935 UNREACHABLE(); |
936 break; | 936 break; |
937 } | 937 } |
938 } | 938 } |
939 | 939 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 Label* deopt = compiler->AddDeoptStub(original()->deopt_id(), | 991 Label* deopt = compiler->AddDeoptStub(original()->deopt_id(), |
992 original()->try_index(), | 992 original()->try_index(), |
993 kDeoptInstanceGetterSameTarget); | 993 kDeoptInstanceGetterSameTarget); |
994 // Smis do not have instance fields (Smi class is always first). | 994 // Smis do not have instance fields (Smi class is always first). |
995 Register temp_reg = locs()->temp(0).reg(); | 995 Register temp_reg = locs()->temp(0).reg(); |
996 ASSERT(temp_reg != instance_reg); | 996 ASSERT(temp_reg != instance_reg); |
997 ASSERT(temp_reg != value_reg); | 997 ASSERT(temp_reg != value_reg); |
998 ASSERT(ic_data() != NULL); | 998 ASSERT(ic_data() != NULL); |
999 compiler->EmitClassChecksNoSmi(*ic_data(), instance_reg, temp_reg, deopt); | 999 compiler->EmitClassChecksNoSmi(*ic_data(), instance_reg, temp_reg, deopt); |
1000 } | 1000 } |
1001 if (this->value()->BindsToConstant()) { | 1001 if (this->value()->NeedsStoreBuffer()) { |
1002 // Compile time constants are Smi or allocated in the old space. | 1002 __ StoreIntoObject(instance_reg, |
1003 __ movl(FieldAddress(instance_reg, field().Offset()), value_reg); | 1003 FieldAddress(instance_reg, field().Offset()), value_reg); |
1004 } else { | 1004 } else { |
1005 __ StoreIntoObject(instance_reg, | 1005 __ StoreIntoObjectNoBarrier(instance_reg, |
1006 FieldAddress(instance_reg, field().Offset()), value_reg); | 1006 FieldAddress(instance_reg, field().Offset()), value_reg); |
1007 } | 1007 } |
1008 } | 1008 } |
1009 | 1009 |
1010 | 1010 |
1011 LocationSummary* LoadStaticFieldComp::MakeLocationSummary() const { | 1011 LocationSummary* LoadStaticFieldComp::MakeLocationSummary() const { |
1012 return LocationSummary::Make(0, | 1012 return LocationSummary::Make(0, |
1013 Location::RequiresRegister(), | 1013 Location::RequiresRegister(), |
1014 LocationSummary::kNoCall); | 1014 LocationSummary::kNoCall); |
1015 } | 1015 } |
(...skipping 14 matching lines...) Expand all Loading... |
1030 return locs; | 1030 return locs; |
1031 } | 1031 } |
1032 | 1032 |
1033 | 1033 |
1034 void StoreStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1034 void StoreStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
1035 Register value = locs()->in(0).reg(); | 1035 Register value = locs()->in(0).reg(); |
1036 Register temp = locs()->temp(0).reg(); | 1036 Register temp = locs()->temp(0).reg(); |
1037 ASSERT(locs()->out().reg() == value); | 1037 ASSERT(locs()->out().reg() == value); |
1038 | 1038 |
1039 __ LoadObject(temp, field()); | 1039 __ LoadObject(temp, field()); |
1040 if (this->value()->BindsToConstant()) { | 1040 if (this->value()->NeedsStoreBuffer()) { |
1041 // Compile time constants are Smi or allocated in the old space. | 1041 __ StoreIntoObject(temp, FieldAddress(temp, Field::value_offset()), value); |
1042 __ movl(FieldAddress(temp, Field::value_offset()), value); | |
1043 } else { | 1042 } else { |
1044 __ StoreIntoObject(temp, FieldAddress(temp, Field::value_offset()), value); | 1043 __ StoreIntoObjectNoBarrier( |
| 1044 temp, FieldAddress(temp, Field::value_offset()), value); |
1045 } | 1045 } |
1046 } | 1046 } |
1047 | 1047 |
1048 | 1048 |
1049 LocationSummary* InstanceOfComp::MakeLocationSummary() const { | 1049 LocationSummary* InstanceOfComp::MakeLocationSummary() const { |
1050 const intptr_t kNumInputs = 3; | 1050 const intptr_t kNumInputs = 3; |
1051 const intptr_t kNumTemps = 0; | 1051 const intptr_t kNumTemps = 0; |
1052 LocationSummary* summary = | 1052 LocationSummary* summary = |
1053 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 1053 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
1054 summary->set_in(0, Location::RegisterLocation(EAX)); | 1054 summary->set_in(0, Location::RegisterLocation(EAX)); |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2430 __ testl(value, Immediate(kSmiTagMask)); | 2430 __ testl(value, Immediate(kSmiTagMask)); |
2431 __ j(NOT_ZERO, deopt); | 2431 __ j(NOT_ZERO, deopt); |
2432 } | 2432 } |
2433 | 2433 |
2434 | 2434 |
2435 } // namespace dart | 2435 } // namespace dart |
2436 | 2436 |
2437 #undef __ | 2437 #undef __ |
2438 | 2438 |
2439 #endif // defined TARGET_ARCH_X64 | 2439 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |