OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 case kTypedDataUint8ClampedArrayCid: | 1005 case kTypedDataUint8ClampedArrayCid: |
1006 case kExternalTypedDataUint8ArrayCid: | 1006 case kExternalTypedDataUint8ArrayCid: |
1007 case kExternalTypedDataUint8ClampedArrayCid: | 1007 case kExternalTypedDataUint8ClampedArrayCid: |
1008 case kTypedDataInt16ArrayCid: | 1008 case kTypedDataInt16ArrayCid: |
1009 case kTypedDataUint16ArrayCid: | 1009 case kTypedDataUint16ArrayCid: |
1010 case kOneByteStringCid: | 1010 case kOneByteStringCid: |
1011 case kTwoByteStringCid: | 1011 case kTwoByteStringCid: |
1012 return CompileType::FromCid(kSmiCid); | 1012 return CompileType::FromCid(kSmiCid); |
1013 | 1013 |
1014 case kTypedDataInt32ArrayCid: | 1014 case kTypedDataInt32ArrayCid: |
1015 case kTypedDataUint32ArrayCid: | |
1016 return Typed32BitIsSmi() ? CompileType::FromCid(kSmiCid) | 1015 return Typed32BitIsSmi() ? CompileType::FromCid(kSmiCid) |
1017 : CompileType::FromCid(kMintCid); | 1016 : CompileType::FromCid(kMintCid); |
1018 | 1017 case kTypedDataUint32ArrayCid: |
| 1018 return CompileType::FromCid(kMintCid); |
1019 default: | 1019 default: |
1020 UNIMPLEMENTED(); | 1020 UNIMPLEMENTED(); |
1021 return CompileType::Dynamic(); | 1021 return CompileType::Dynamic(); |
1022 } | 1022 } |
1023 } | 1023 } |
1024 | 1024 |
1025 | 1025 |
1026 Representation LoadIndexedInstr::representation() const { | 1026 Representation LoadIndexedInstr::representation() const { |
1027 switch (class_id_) { | 1027 switch (class_id_) { |
1028 case kArrayCid: | 1028 case kArrayCid: |
1029 case kImmutableArrayCid: | 1029 case kImmutableArrayCid: |
1030 case kTypedDataInt8ArrayCid: | 1030 case kTypedDataInt8ArrayCid: |
1031 case kTypedDataUint8ArrayCid: | 1031 case kTypedDataUint8ArrayCid: |
1032 case kTypedDataUint8ClampedArrayCid: | 1032 case kTypedDataUint8ClampedArrayCid: |
1033 case kExternalTypedDataUint8ArrayCid: | 1033 case kExternalTypedDataUint8ArrayCid: |
1034 case kExternalTypedDataUint8ClampedArrayCid: | 1034 case kExternalTypedDataUint8ClampedArrayCid: |
1035 case kTypedDataInt16ArrayCid: | 1035 case kTypedDataInt16ArrayCid: |
1036 case kTypedDataUint16ArrayCid: | 1036 case kTypedDataUint16ArrayCid: |
1037 case kOneByteStringCid: | 1037 case kOneByteStringCid: |
1038 case kTwoByteStringCid: | 1038 case kTwoByteStringCid: |
1039 return kTagged; | 1039 return kTagged; |
1040 case kTypedDataInt32ArrayCid: | 1040 case kTypedDataInt32ArrayCid: |
| 1041 return Typed32BitIsSmi() ? kTagged : kUnboxedMint; |
1041 case kTypedDataUint32ArrayCid: | 1042 case kTypedDataUint32ArrayCid: |
1042 return Typed32BitIsSmi() ? kTagged : kUnboxedMint; | 1043 return kUnboxedUint32; |
1043 case kTypedDataFloat32ArrayCid: | 1044 case kTypedDataFloat32ArrayCid: |
1044 case kTypedDataFloat64ArrayCid: | 1045 case kTypedDataFloat64ArrayCid: |
1045 return kUnboxedDouble; | 1046 return kUnboxedDouble; |
1046 case kTypedDataFloat32x4ArrayCid: | 1047 case kTypedDataFloat32x4ArrayCid: |
1047 return kUnboxedFloat32x4; | 1048 return kUnboxedFloat32x4; |
1048 case kTypedDataInt32x4ArrayCid: | 1049 case kTypedDataInt32x4ArrayCid: |
1049 return kUnboxedInt32x4; | 1050 return kUnboxedInt32x4; |
1050 case kTypedDataFloat64x2ArrayCid: | 1051 case kTypedDataFloat64x2ArrayCid: |
1051 return kUnboxedFloat64x2; | 1052 return kUnboxedFloat64x2; |
1052 default: | 1053 default: |
(...skipping 18 matching lines...) Expand all Loading... |
1071 // element sizes > 1). | 1072 // element sizes > 1). |
1072 locs->set_in(1, (index_scale() == 1) | 1073 locs->set_in(1, (index_scale() == 1) |
1073 ? Location::WritableRegister() | 1074 ? Location::WritableRegister() |
1074 : Location::RequiresRegister()); | 1075 : Location::RequiresRegister()); |
1075 } | 1076 } |
1076 if ((representation() == kUnboxedDouble) || | 1077 if ((representation() == kUnboxedDouble) || |
1077 (representation() == kUnboxedFloat32x4) || | 1078 (representation() == kUnboxedFloat32x4) || |
1078 (representation() == kUnboxedInt32x4) || | 1079 (representation() == kUnboxedInt32x4) || |
1079 (representation() == kUnboxedFloat64x2)) { | 1080 (representation() == kUnboxedFloat64x2)) { |
1080 locs->set_out(0, Location::RequiresFpuRegister()); | 1081 locs->set_out(0, Location::RequiresFpuRegister()); |
| 1082 } else if (representation() == kUnboxedUint32) { |
| 1083 ASSERT(class_id() == kTypedDataUint32ArrayCid); |
| 1084 locs->set_out(0, Location::RequiresRegister()); |
1081 } else if (representation() == kUnboxedMint) { | 1085 } else if (representation() == kUnboxedMint) { |
1082 if (class_id() == kTypedDataInt32ArrayCid) { | 1086 ASSERT(class_id() == kTypedDataInt32ArrayCid); |
1083 locs->set_out(0, Location::Pair(Location::RegisterLocation(EAX), | 1087 locs->set_out(0, Location::Pair(Location::RegisterLocation(EAX), |
1084 Location::RegisterLocation(EDX))); | 1088 Location::RegisterLocation(EDX))); |
1085 } else { | |
1086 ASSERT(class_id() == kTypedDataUint32ArrayCid); | |
1087 locs->set_out(0, Location::Pair(Location::RequiresRegister(), | |
1088 Location::RequiresRegister())); | |
1089 } | |
1090 } else { | 1089 } else { |
1091 ASSERT(representation() == kTagged); | 1090 ASSERT(representation() == kTagged); |
1092 locs->set_out(0, Location::RequiresRegister()); | 1091 locs->set_out(0, Location::RequiresRegister()); |
1093 } | 1092 } |
1094 return locs; | 1093 return locs; |
1095 } | 1094 } |
1096 | 1095 |
1097 | 1096 |
1098 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1097 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1099 // The array register points to the backing store for external arrays. | 1098 // The array register points to the backing store for external arrays. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 if ((index_scale() == 1) && index.IsRegister()) { | 1140 if ((index_scale() == 1) && index.IsRegister()) { |
1142 __ SmiUntag(index.reg()); | 1141 __ SmiUntag(index.reg()); |
1143 } | 1142 } |
1144 switch (class_id()) { | 1143 switch (class_id()) { |
1145 case kTypedDataInt32ArrayCid: | 1144 case kTypedDataInt32ArrayCid: |
1146 ASSERT(result1 == EAX); | 1145 ASSERT(result1 == EAX); |
1147 ASSERT(result2 == EDX); | 1146 ASSERT(result2 == EDX); |
1148 __ movl(result1, element_address); | 1147 __ movl(result1, element_address); |
1149 __ cdq(); | 1148 __ cdq(); |
1150 break; | 1149 break; |
1151 case kTypedDataUint32ArrayCid: | |
1152 __ movl(result1, element_address); | |
1153 __ xorl(result2, result2); | |
1154 break; | |
1155 default: | 1150 default: |
1156 UNREACHABLE(); | 1151 UNREACHABLE(); |
1157 } | 1152 } |
1158 return; | 1153 return; |
1159 } | 1154 } |
1160 | 1155 |
| 1156 if (representation() == kUnboxedUint32) { |
| 1157 ASSERT(class_id() == kTypedDataUint32ArrayCid); |
| 1158 Register result = locs()->out(0).reg(); |
| 1159 if ((index_scale() == 1) && index.IsRegister()) { |
| 1160 __ SmiUntag(index.reg()); |
| 1161 } |
| 1162 __ movl(result, element_address); |
| 1163 return; |
| 1164 } |
| 1165 |
1161 ASSERT(representation() == kTagged); | 1166 ASSERT(representation() == kTagged); |
1162 | 1167 |
1163 Register result = locs()->out(0).reg(); | 1168 Register result = locs()->out(0).reg(); |
1164 if ((index_scale() == 1) && index.IsRegister()) { | 1169 if ((index_scale() == 1) && index.IsRegister()) { |
1165 __ SmiUntag(index.reg()); | 1170 __ SmiUntag(index.reg()); |
1166 } | 1171 } |
1167 switch (class_id()) { | 1172 switch (class_id()) { |
1168 case kTypedDataInt8ArrayCid: | 1173 case kTypedDataInt8ArrayCid: |
1169 ASSERT(index_scale() == 1); | 1174 ASSERT(index_scale() == 1); |
1170 __ movsxb(result, element_address); | 1175 __ movsxb(result, element_address); |
(...skipping 5614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6785 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 6790 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
6786 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 6791 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
6787 #endif | 6792 #endif |
6788 } | 6793 } |
6789 | 6794 |
6790 } // namespace dart | 6795 } // namespace dart |
6791 | 6796 |
6792 #undef __ | 6797 #undef __ |
6793 | 6798 |
6794 #endif // defined TARGET_ARCH_IA32 | 6799 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |