Chromium Code Reviews| 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1128 | 1128 |
| 1129 LocationSummary* LoadIndexedInstr::MakeLocationSummary(bool opt) const { | 1129 LocationSummary* LoadIndexedInstr::MakeLocationSummary(bool opt) const { |
| 1130 const intptr_t kNumInputs = 2; | 1130 const intptr_t kNumInputs = 2; |
| 1131 const intptr_t kNumTemps = 0; | 1131 const intptr_t kNumTemps = 0; |
| 1132 LocationSummary* locs = | 1132 LocationSummary* locs = |
| 1133 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1133 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1134 locs->set_in(0, Location::RequiresRegister()); | 1134 locs->set_in(0, Location::RequiresRegister()); |
| 1135 // The smi index is either untagged (element size == 1), or it is left smi | 1135 // The smi index is either untagged (element size == 1), or it is left smi |
| 1136 // tagged (for all element sizes > 1). | 1136 // tagged (for all element sizes > 1). |
| 1137 // TODO(regis): Revisit and see if the index can be immediate. | 1137 // TODO(regis): Revisit and see if the index can be immediate. |
| 1138 locs->set_in(1, Location::WritableRegister()); | 1138 if (index_scale() == 2 && IsExternal()) { |
| 1139 locs->set_in(1, Location::RequiresRegister()); | |
| 1140 } else { | |
| 1141 locs->set_in(1, Location::WritableRegister()); | |
| 1142 } | |
| 1139 if ((representation() == kUnboxedDouble) || | 1143 if ((representation() == kUnboxedDouble) || |
| 1140 (representation() == kUnboxedFloat32x4) || | 1144 (representation() == kUnboxedFloat32x4) || |
| 1141 (representation() == kUnboxedInt32x4) || | 1145 (representation() == kUnboxedInt32x4) || |
| 1142 (representation() == kUnboxedFloat64x2)) { | 1146 (representation() == kUnboxedFloat64x2)) { |
| 1143 if (class_id() == kTypedDataFloat32ArrayCid) { | 1147 if (class_id() == kTypedDataFloat32ArrayCid) { |
| 1144 // Need register <= Q7 for float operations. | 1148 // Need register <= Q7 for float operations. |
| 1145 // TODO(fschneider): Add a register policy to specify a subset of | 1149 // TODO(fschneider): Add a register policy to specify a subset of |
| 1146 // registers. | 1150 // registers. |
| 1147 locs->set_out(0, Location::FpuRegisterLocation(Q7)); | 1151 locs->set_out(0, Location::FpuRegisterLocation(Q7)); |
| 1148 } else { | 1152 } else { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1226 | 1230 |
| 1227 Register array = locs()->in(0).reg(); | 1231 Register array = locs()->in(0).reg(); |
| 1228 Location index = locs()->in(1); | 1232 Location index = locs()->in(1); |
| 1229 | 1233 |
| 1230 Address element_address(kNoRegister, 0); | 1234 Address element_address(kNoRegister, 0); |
| 1231 ASSERT(index.IsRegister()); // TODO(regis): Revisit. | 1235 ASSERT(index.IsRegister()); // TODO(regis): Revisit. |
| 1232 // Note that index is expected smi-tagged, (i.e, times 2) for all arrays | 1236 // Note that index is expected smi-tagged, (i.e, times 2) for all arrays |
| 1233 // with index scale factor > 1. E.g., for Uint8Array and OneByteString the | 1237 // with index scale factor > 1. E.g., for Uint8Array and OneByteString the |
| 1234 // index is expected to be untagged before accessing. | 1238 // index is expected to be untagged before accessing. |
| 1235 ASSERT(kSmiTagShift == 1); | 1239 ASSERT(kSmiTagShift == 1); |
| 1240 intptr_t offset = 0; | |
| 1236 switch (index_scale()) { | 1241 switch (index_scale()) { |
| 1237 case 1: { | 1242 case 1: { |
| 1238 __ SmiUntag(index.reg()); | 1243 __ add(index.reg(), array, ShifterOperand(index.reg(), ASR, kSmiTagSize)); |
| 1244 if (!IsExternal()) { | |
|
zra
2014/05/14 16:32:44
Looks like you can hoist these out of the switch s
Florian Schneider
2014/05/15 09:43:27
Done.
| |
| 1245 offset = FlowGraphCompiler::DataOffsetFor(class_id()) - kHeapObjectTag; | |
| 1246 } | |
| 1247 element_address = Address(index.reg(), offset); | |
|
zra
2014/05/14 16:32:44
Same comment as in the other CL for the range of o
Florian Schneider
2014/05/15 09:43:27
Done.
| |
| 1239 break; | 1248 break; |
| 1240 } | 1249 } |
| 1241 case 2: { | 1250 case 2: { |
| 1251 if (!IsExternal()) { | |
| 1252 __ AddImmediate(index.reg(), index.reg(), | |
| 1253 FlowGraphCompiler::DataOffsetFor(class_id()) - kHeapObjectTag); | |
| 1254 element_address = Address(array, index.reg(), LSL, 0); | |
| 1255 } else { | |
| 1256 element_address = Address(array, index.reg(), LSL, 0); | |
| 1257 } | |
| 1242 break; | 1258 break; |
| 1243 } | 1259 } |
| 1244 case 4: { | 1260 case 4: { |
| 1245 __ mov(index.reg(), ShifterOperand(index.reg(), LSL, 1)); | 1261 __ add(index.reg(), array, ShifterOperand(index.reg(), LSL, 1)); |
| 1262 if (!IsExternal()) { | |
| 1263 offset = FlowGraphCompiler::DataOffsetFor(class_id()) - kHeapObjectTag; | |
| 1264 } | |
| 1265 element_address = Address(index.reg(), offset); | |
| 1246 break; | 1266 break; |
| 1247 } | 1267 } |
| 1248 case 8: { | 1268 case 8: { |
| 1249 __ mov(index.reg(), ShifterOperand(index.reg(), LSL, 2)); | 1269 __ add(index.reg(), array, ShifterOperand(index.reg(), LSL, 2)); |
| 1270 if (!IsExternal()) { | |
| 1271 offset = FlowGraphCompiler::DataOffsetFor(class_id()) - kHeapObjectTag; | |
| 1272 } | |
| 1273 element_address = Address(index.reg(), offset); | |
| 1250 break; | 1274 break; |
| 1251 } | 1275 } |
| 1252 case 16: { | 1276 case 16: { |
| 1253 __ mov(index.reg(), ShifterOperand(index.reg(), LSL, 3)); | 1277 __ add(index.reg(), array, ShifterOperand(index.reg(), LSL, 3)); |
| 1278 if (!IsExternal()) { | |
| 1279 offset = FlowGraphCompiler::DataOffsetFor(class_id()) - kHeapObjectTag; | |
| 1280 } | |
| 1281 element_address = Address(index.reg(), offset); | |
| 1254 break; | 1282 break; |
| 1255 } | 1283 } |
| 1256 default: | 1284 default: |
| 1257 UNREACHABLE(); | 1285 UNREACHABLE(); |
| 1258 } | 1286 } |
| 1259 | 1287 |
| 1260 if (!IsExternal()) { | |
| 1261 ASSERT(this->array()->definition()->representation() == kTagged); | |
| 1262 __ AddImmediate(index.reg(), | |
| 1263 FlowGraphCompiler::DataOffsetFor(class_id()) - kHeapObjectTag); | |
| 1264 } | |
| 1265 element_address = Address(array, index.reg(), LSL, 0); | |
| 1266 Register result = locs()->out(0).reg(); | 1288 Register result = locs()->out(0).reg(); |
| 1267 switch (class_id()) { | 1289 switch (class_id()) { |
| 1268 case kTypedDataInt8ArrayCid: | 1290 case kTypedDataInt8ArrayCid: |
| 1269 ASSERT(index_scale() == 1); | 1291 ASSERT(index_scale() == 1); |
| 1270 __ ldrsb(result, element_address); | 1292 __ ldrsb(result, element_address); |
| 1271 __ SmiTag(result); | 1293 __ SmiTag(result); |
| 1272 break; | 1294 break; |
| 1273 case kTypedDataUint8ArrayCid: | 1295 case kTypedDataUint8ArrayCid: |
| 1274 case kTypedDataUint8ClampedArrayCid: | 1296 case kTypedDataUint8ClampedArrayCid: |
| 1275 case kExternalTypedDataUint8ArrayCid: | 1297 case kExternalTypedDataUint8ArrayCid: |
| (...skipping 4887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6163 compiler->GenerateCall(token_pos(), | 6185 compiler->GenerateCall(token_pos(), |
| 6164 &label, | 6186 &label, |
| 6165 PcDescriptors::kOther, | 6187 PcDescriptors::kOther, |
| 6166 locs()); | 6188 locs()); |
| 6167 __ Drop(ArgumentCount()); // Discard arguments. | 6189 __ Drop(ArgumentCount()); // Discard arguments. |
| 6168 } | 6190 } |
| 6169 | 6191 |
| 6170 } // namespace dart | 6192 } // namespace dart |
| 6171 | 6193 |
| 6172 #endif // defined TARGET_ARCH_ARM | 6194 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |