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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 } | 1036 } |
1037 return locs; | 1037 return locs; |
1038 } | 1038 } |
1039 | 1039 |
1040 | 1040 |
1041 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1041 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1042 Register array = locs()->in(0).reg(); | 1042 Register array = locs()->in(0).reg(); |
1043 Location index = locs()->in(1); | 1043 Location index = locs()->in(1); |
1044 | 1044 |
1045 Address element_address(kNoRegister, 0); | 1045 Address element_address(kNoRegister, 0); |
1046 if (IsExternal()) { | 1046 element_address = index.IsRegister() |
1047 element_address = index.IsRegister() | 1047 ? compiler->ElementAddressForRegIndex( |
1048 ? compiler->ExternalElementAddressForRegIndex( | 1048 true, // Load. |
1049 index_scale(), array, index.reg()) | 1049 IsExternal(), class_id(), index_scale(), array, index.reg()) |
1050 : compiler->ExternalElementAddressForIntIndex( | 1050 : compiler->ElementAddressForIntIndex( |
1051 index_scale(), array, Smi::Cast(index.constant()).Value()); | 1051 true, // Load. |
1052 } else { | 1052 IsExternal(), class_id(), index_scale(), array, |
1053 ASSERT(this->array()->definition()->representation() == kTagged); | 1053 Smi::Cast(index.constant()).Value()); |
1054 element_address = index.IsRegister() | |
1055 ? compiler->ElementAddressForRegIndex( | |
1056 class_id(), index_scale(), array, index.reg()) | |
1057 : compiler->ElementAddressForIntIndex( | |
1058 class_id(), index_scale(), array, | |
1059 Smi::Cast(index.constant()).Value()); | |
1060 } | |
1061 | 1054 |
1062 if ((representation() == kUnboxedDouble) || | 1055 if ((representation() == kUnboxedDouble) || |
1063 (representation() == kUnboxedFloat32x4) || | 1056 (representation() == kUnboxedFloat32x4) || |
1064 (representation() == kUnboxedInt32x4) || | 1057 (representation() == kUnboxedInt32x4) || |
1065 (representation() == kUnboxedFloat64x2)) { | 1058 (representation() == kUnboxedFloat64x2)) { |
1066 XmmRegister result = locs()->out(0).fpu_reg(); | 1059 XmmRegister result = locs()->out(0).fpu_reg(); |
1067 if ((index_scale() == 1) && index.IsRegister()) { | 1060 if ((index_scale() == 1) && index.IsRegister()) { |
1068 __ SmiUntag(index.reg()); | 1061 __ SmiUntag(index.reg()); |
1069 } | 1062 } |
1070 switch (class_id()) { | 1063 switch (class_id()) { |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 } | 1263 } |
1271 return locs; | 1264 return locs; |
1272 } | 1265 } |
1273 | 1266 |
1274 | 1267 |
1275 void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1268 void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1276 Register array = locs()->in(0).reg(); | 1269 Register array = locs()->in(0).reg(); |
1277 Location index = locs()->in(1); | 1270 Location index = locs()->in(1); |
1278 | 1271 |
1279 Address element_address(kNoRegister, 0); | 1272 Address element_address(kNoRegister, 0); |
1280 if (IsExternal()) { | 1273 element_address = index.IsRegister() |
1281 element_address = index.IsRegister() | 1274 ? compiler->ElementAddressForRegIndex( |
1282 ? compiler->ExternalElementAddressForRegIndex( | 1275 false, // Store. |
1283 index_scale(), array, index.reg()) | 1276 IsExternal(), class_id(), index_scale(), array, index.reg()) |
1284 : compiler->ExternalElementAddressForIntIndex( | 1277 : compiler->ElementAddressForIntIndex( |
1285 index_scale(), array, Smi::Cast(index.constant()).Value()); | 1278 false, // Store. |
1286 } else { | 1279 IsExternal(), class_id(), index_scale(), array, |
1287 ASSERT(this->array()->definition()->representation() == kTagged); | |
1288 element_address = index.IsRegister() | |
1289 ? compiler->ElementAddressForRegIndex( | |
1290 class_id(), index_scale(), array, index.reg()) | |
1291 : compiler->ElementAddressForIntIndex( | |
1292 class_id(), index_scale(), array, | |
1293 Smi::Cast(index.constant()).Value()); | 1280 Smi::Cast(index.constant()).Value()); |
1294 } | |
1295 | 1281 |
1296 if ((index_scale() == 1) && index.IsRegister()) { | 1282 if ((index_scale() == 1) && index.IsRegister()) { |
1297 __ SmiUntag(index.reg()); | 1283 __ SmiUntag(index.reg()); |
1298 } | 1284 } |
1299 switch (class_id()) { | 1285 switch (class_id()) { |
1300 case kArrayCid: | 1286 case kArrayCid: |
1301 if (ShouldEmitStoreBarrier()) { | 1287 if (ShouldEmitStoreBarrier()) { |
1302 Register value = locs()->in(2).reg(); | 1288 Register value = locs()->in(2).reg(); |
1303 __ StoreIntoObject(array, element_address, value); | 1289 __ StoreIntoObject(array, element_address, value); |
1304 } else if (locs()->in(2).IsConstant()) { | 1290 } else if (locs()->in(2).IsConstant()) { |
(...skipping 4936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6241 PcDescriptors::kOther, | 6227 PcDescriptors::kOther, |
6242 locs()); | 6228 locs()); |
6243 __ Drop(ArgumentCount()); // Discard arguments. | 6229 __ Drop(ArgumentCount()); // Discard arguments. |
6244 } | 6230 } |
6245 | 6231 |
6246 } // namespace dart | 6232 } // namespace dart |
6247 | 6233 |
6248 #undef __ | 6234 #undef __ |
6249 | 6235 |
6250 #endif // defined TARGET_ARCH_IA32 | 6236 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |