| 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/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 converted = new UnboxFloat32x4Instr(use->CopyWithType(), deopt_id); | 615 converted = new UnboxFloat32x4Instr(use->CopyWithType(), deopt_id); |
| 616 } else if ((from == kUnboxedFloat32x4) && (to == kTagged)) { | 616 } else if ((from == kUnboxedFloat32x4) && (to == kTagged)) { |
| 617 converted = new BoxFloat32x4Instr(use->CopyWithType()); | 617 converted = new BoxFloat32x4Instr(use->CopyWithType()); |
| 618 } else if ((from == kTagged) && (to == kUnboxedInt32x4)) { | 618 } else if ((from == kTagged) && (to == kUnboxedInt32x4)) { |
| 619 ASSERT((deopt_target != NULL) || (use->Type()->ToCid() == kInt32x4Cid)); | 619 ASSERT((deopt_target != NULL) || (use->Type()->ToCid() == kInt32x4Cid)); |
| 620 const intptr_t deopt_id = (deopt_target != NULL) ? | 620 const intptr_t deopt_id = (deopt_target != NULL) ? |
| 621 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId; | 621 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId; |
| 622 converted = new UnboxInt32x4Instr(use->CopyWithType(), deopt_id); | 622 converted = new UnboxInt32x4Instr(use->CopyWithType(), deopt_id); |
| 623 } else if ((from == kUnboxedInt32x4) && (to == kTagged)) { | 623 } else if ((from == kUnboxedInt32x4) && (to == kTagged)) { |
| 624 converted = new BoxInt32x4Instr(use->CopyWithType()); | 624 converted = new BoxInt32x4Instr(use->CopyWithType()); |
| 625 } else if ((from == kTagged) && (to == kUnboxedFloat64x2)) { |
| 626 ASSERT((deopt_target != NULL) || (use->Type()->ToCid() == kFloat64x2Cid)); |
| 627 const intptr_t deopt_id = (deopt_target != NULL) ? |
| 628 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId; |
| 629 converted = new UnboxFloat64x2Instr(use->CopyWithType(), deopt_id); |
| 630 } else if ((from == kUnboxedFloat64x2) && (to == kTagged)) { |
| 631 converted = new BoxFloat64x2Instr(use->CopyWithType()); |
| 625 } else { | 632 } else { |
| 626 // We have failed to find a suitable conversion instruction. | 633 // We have failed to find a suitable conversion instruction. |
| 627 // Insert two "dummy" conversion instructions with the correct | 634 // Insert two "dummy" conversion instructions with the correct |
| 628 // "from" and "to" representation. The inserted instructions will | 635 // "from" and "to" representation. The inserted instructions will |
| 629 // trigger a deoptimization if executed. See #12417 for a discussion. | 636 // trigger a deoptimization if executed. See #12417 for a discussion. |
| 630 const intptr_t deopt_id = (deopt_target != NULL) ? | 637 const intptr_t deopt_id = (deopt_target != NULL) ? |
| 631 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId; | 638 deopt_target->DeoptimizationTarget() : Isolate::kNoDeoptId; |
| 632 ASSERT(from != kTagged); | 639 ASSERT(from != kTagged); |
| 633 ASSERT(to != kTagged); | 640 ASSERT(to != kTagged); |
| 634 Definition* boxed = NULL; | 641 Definition* boxed = NULL; |
| 635 if (from == kUnboxedDouble) { | 642 if (from == kUnboxedDouble) { |
| 636 boxed = new BoxDoubleInstr(use->CopyWithType()); | 643 boxed = new BoxDoubleInstr(use->CopyWithType()); |
| 637 } else if (from == kUnboxedInt32x4) { | 644 } else if (from == kUnboxedInt32x4) { |
| 638 boxed = new BoxInt32x4Instr(use->CopyWithType()); | 645 boxed = new BoxInt32x4Instr(use->CopyWithType()); |
| 639 } else if (from == kUnboxedFloat32x4) { | 646 } else if (from == kUnboxedFloat32x4) { |
| 640 boxed = new BoxFloat32x4Instr(use->CopyWithType()); | 647 boxed = new BoxFloat32x4Instr(use->CopyWithType()); |
| 641 } else if (from == kUnboxedMint) { | 648 } else if (from == kUnboxedMint) { |
| 642 boxed = new BoxIntegerInstr(use->CopyWithType()); | 649 boxed = new BoxIntegerInstr(use->CopyWithType()); |
| 650 } else if (from == kUnboxedFloat64x2) { |
| 651 boxed = new BoxFloat64x2Instr(use->CopyWithType()); |
| 643 } else { | 652 } else { |
| 644 UNIMPLEMENTED(); | 653 UNIMPLEMENTED(); |
| 645 } | 654 } |
| 646 use->BindTo(boxed); | 655 use->BindTo(boxed); |
| 647 InsertBefore(insert_before, boxed, NULL, Definition::kValue); | 656 InsertBefore(insert_before, boxed, NULL, Definition::kValue); |
| 648 Value* to_value = new Value(boxed); | 657 Value* to_value = new Value(boxed); |
| 649 if (to == kUnboxedDouble) { | 658 if (to == kUnboxedDouble) { |
| 650 converted = new UnboxDoubleInstr(to_value, deopt_id); | 659 converted = new UnboxDoubleInstr(to_value, deopt_id); |
| 651 } else if (to == kUnboxedInt32x4) { | 660 } else if (to == kUnboxedInt32x4) { |
| 652 converted = new UnboxInt32x4Instr(to_value, deopt_id); | 661 converted = new UnboxInt32x4Instr(to_value, deopt_id); |
| 653 } else if (to == kUnboxedFloat32x4) { | 662 } else if (to == kUnboxedFloat32x4) { |
| 654 converted = new UnboxFloat32x4Instr(to_value, deopt_id); | 663 converted = new UnboxFloat32x4Instr(to_value, deopt_id); |
| 655 } else if (to == kUnboxedMint) { | 664 } else if (to == kUnboxedMint) { |
| 656 converted = new UnboxIntegerInstr(to_value, deopt_id); | 665 converted = new UnboxIntegerInstr(to_value, deopt_id); |
| 666 } else if (to == kUnboxedFloat64x2) { |
| 667 converted = new UnboxFloat64x2Instr(to_value, deopt_id); |
| 657 } else { | 668 } else { |
| 658 UNIMPLEMENTED(); | 669 UNIMPLEMENTED(); |
| 659 } | 670 } |
| 660 } | 671 } |
| 661 ASSERT(converted != NULL); | 672 ASSERT(converted != NULL); |
| 662 InsertBefore(insert_before, converted, use->instruction()->env(), | 673 InsertBefore(insert_before, converted, use->instruction()->env(), |
| 663 Definition::kValue); | 674 Definition::kValue); |
| 664 if (is_environment_use) { | 675 if (is_environment_use) { |
| 665 use->BindToEnvironment(converted); | 676 use->BindToEnvironment(converted); |
| 666 } else { | 677 } else { |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 return kTypedDataUint32ArrayCid; | 1054 return kTypedDataUint32ArrayCid; |
| 1044 | 1055 |
| 1045 case MethodRecognizer::kFloat32x4ArrayGetIndexed: | 1056 case MethodRecognizer::kFloat32x4ArrayGetIndexed: |
| 1046 case MethodRecognizer::kFloat32x4ArraySetIndexed: | 1057 case MethodRecognizer::kFloat32x4ArraySetIndexed: |
| 1047 return kTypedDataFloat32x4ArrayCid; | 1058 return kTypedDataFloat32x4ArrayCid; |
| 1048 | 1059 |
| 1049 case MethodRecognizer::kInt32x4ArrayGetIndexed: | 1060 case MethodRecognizer::kInt32x4ArrayGetIndexed: |
| 1050 case MethodRecognizer::kInt32x4ArraySetIndexed: | 1061 case MethodRecognizer::kInt32x4ArraySetIndexed: |
| 1051 return kTypedDataInt32x4ArrayCid; | 1062 return kTypedDataInt32x4ArrayCid; |
| 1052 | 1063 |
| 1064 case MethodRecognizer::kFloat64x2ArrayGetIndexed: |
| 1065 case MethodRecognizer::kFloat64x2ArraySetIndexed: |
| 1066 return kTypedDataFloat64x2ArrayCid; |
| 1067 |
| 1053 default: | 1068 default: |
| 1054 break; | 1069 break; |
| 1055 } | 1070 } |
| 1056 return kIllegalCid; | 1071 return kIllegalCid; |
| 1057 } | 1072 } |
| 1058 | 1073 |
| 1059 | 1074 |
| 1060 bool FlowGraphOptimizer::TryReplaceWithStoreIndexed(InstanceCallInstr* call) { | 1075 bool FlowGraphOptimizer::TryReplaceWithStoreIndexed(InstanceCallInstr* call) { |
| 1061 // Check for monomorphic IC data. | 1076 // Check for monomorphic IC data. |
| 1062 if (!call->HasICData()) return false; | 1077 if (!call->HasICData()) return false; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 ASSERT(value_type.IsInstantiated()); | 1183 ASSERT(value_type.IsInstantiated()); |
| 1169 break; | 1184 break; |
| 1170 } | 1185 } |
| 1171 case kTypedDataFloat32x4ArrayCid: { | 1186 case kTypedDataFloat32x4ArrayCid: { |
| 1172 type_args = instantiator = flow_graph_->constant_null(); | 1187 type_args = instantiator = flow_graph_->constant_null(); |
| 1173 ASSERT((array_cid != kTypedDataFloat32x4ArrayCid) || | 1188 ASSERT((array_cid != kTypedDataFloat32x4ArrayCid) || |
| 1174 value_type.IsFloat32x4Type()); | 1189 value_type.IsFloat32x4Type()); |
| 1175 ASSERT(value_type.IsInstantiated()); | 1190 ASSERT(value_type.IsInstantiated()); |
| 1176 break; | 1191 break; |
| 1177 } | 1192 } |
| 1193 case kTypedDataFloat64x2ArrayCid: { |
| 1194 type_args = instantiator = flow_graph_->constant_null(); |
| 1195 ASSERT((array_cid != kTypedDataFloat64x2ArrayCid) || |
| 1196 value_type.IsFloat64x2Type()); |
| 1197 ASSERT(value_type.IsInstantiated()); |
| 1198 break; |
| 1199 } |
| 1178 default: | 1200 default: |
| 1179 // TODO(fschneider): Add support for other array types. | 1201 // TODO(fschneider): Add support for other array types. |
| 1180 UNREACHABLE(); | 1202 UNREACHABLE(); |
| 1181 } | 1203 } |
| 1182 AssertAssignableInstr* assert_value = | 1204 AssertAssignableInstr* assert_value = |
| 1183 new AssertAssignableInstr(token_pos, | 1205 new AssertAssignableInstr(token_pos, |
| 1184 new Value(stored_value), | 1206 new Value(stored_value), |
| 1185 new Value(instantiator), | 1207 new Value(instantiator), |
| 1186 new Value(type_args), | 1208 new Value(type_args), |
| 1187 value_type, | 1209 value_type, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 case MethodRecognizer::kFloat64ArrayGetIndexed: | 1277 case MethodRecognizer::kFloat64ArrayGetIndexed: |
| 1256 case MethodRecognizer::kInt8ArrayGetIndexed: | 1278 case MethodRecognizer::kInt8ArrayGetIndexed: |
| 1257 case MethodRecognizer::kUint8ArrayGetIndexed: | 1279 case MethodRecognizer::kUint8ArrayGetIndexed: |
| 1258 case MethodRecognizer::kUint8ClampedArrayGetIndexed: | 1280 case MethodRecognizer::kUint8ClampedArrayGetIndexed: |
| 1259 case MethodRecognizer::kExternalUint8ArrayGetIndexed: | 1281 case MethodRecognizer::kExternalUint8ArrayGetIndexed: |
| 1260 case MethodRecognizer::kExternalUint8ClampedArrayGetIndexed: | 1282 case MethodRecognizer::kExternalUint8ClampedArrayGetIndexed: |
| 1261 case MethodRecognizer::kInt16ArrayGetIndexed: | 1283 case MethodRecognizer::kInt16ArrayGetIndexed: |
| 1262 case MethodRecognizer::kUint16ArrayGetIndexed: | 1284 case MethodRecognizer::kUint16ArrayGetIndexed: |
| 1263 return InlineGetIndexed(kind, call, receiver, ic_data, entry, last); | 1285 return InlineGetIndexed(kind, call, receiver, ic_data, entry, last); |
| 1264 case MethodRecognizer::kFloat32x4ArrayGetIndexed: | 1286 case MethodRecognizer::kFloat32x4ArrayGetIndexed: |
| 1265 if (!ShouldInlineSimd()) return false; | 1287 case MethodRecognizer::kFloat64x2ArrayGetIndexed: |
| 1288 if (!ShouldInlineSimd()) { |
| 1289 return false; |
| 1290 } |
| 1266 return InlineGetIndexed(kind, call, receiver, ic_data, entry, last); | 1291 return InlineGetIndexed(kind, call, receiver, ic_data, entry, last); |
| 1267 case MethodRecognizer::kInt32ArrayGetIndexed: | 1292 case MethodRecognizer::kInt32ArrayGetIndexed: |
| 1268 case MethodRecognizer::kUint32ArrayGetIndexed: | 1293 case MethodRecognizer::kUint32ArrayGetIndexed: |
| 1269 if (!CanUnboxInt32()) return false; | 1294 if (!CanUnboxInt32()) return false; |
| 1270 return InlineGetIndexed(kind, call, receiver, ic_data, entry, last); | 1295 return InlineGetIndexed(kind, call, receiver, ic_data, entry, last); |
| 1271 | 1296 |
| 1272 // Recognized []= operators. | 1297 // Recognized []= operators. |
| 1273 case MethodRecognizer::kObjectArraySetIndexed: | 1298 case MethodRecognizer::kObjectArraySetIndexed: |
| 1274 case MethodRecognizer::kGrowableArraySetIndexed: | 1299 case MethodRecognizer::kGrowableArraySetIndexed: |
| 1275 if (ArgIsAlways(kSmiCid, ic_data, 2)) { | 1300 if (ArgIsAlways(kSmiCid, ic_data, 2)) { |
| 1276 value_check = ic_data.AsUnaryClassChecksForArgNr(2); | 1301 value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
| 1277 } | 1302 } |
| 1278 return InlineSetIndexed(kind, target, call, receiver, token_pos, | 1303 return InlineSetIndexed(kind, target, call, receiver, token_pos, |
| 1279 &ic_data, value_check, entry, last); | 1304 &ic_data, value_check, entry, last); |
| 1280 case MethodRecognizer::kInt8ArraySetIndexed: | 1305 case MethodRecognizer::kInt8ArraySetIndexed: |
| 1281 case MethodRecognizer::kUint8ArraySetIndexed: | 1306 case MethodRecognizer::kUint8ArraySetIndexed: |
| 1282 case MethodRecognizer::kUint8ClampedArraySetIndexed: | 1307 case MethodRecognizer::kUint8ClampedArraySetIndexed: |
| 1283 case MethodRecognizer::kExternalUint8ArraySetIndexed: | 1308 case MethodRecognizer::kExternalUint8ArraySetIndexed: |
| 1284 case MethodRecognizer::kExternalUint8ClampedArraySetIndexed: | 1309 case MethodRecognizer::kExternalUint8ClampedArraySetIndexed: |
| 1285 case MethodRecognizer::kInt16ArraySetIndexed: | 1310 case MethodRecognizer::kInt16ArraySetIndexed: |
| 1286 case MethodRecognizer::kUint16ArraySetIndexed: | 1311 case MethodRecognizer::kUint16ArraySetIndexed: |
| 1287 if (!ArgIsAlways(kSmiCid, ic_data, 2)) return false; | 1312 if (!ArgIsAlways(kSmiCid, ic_data, 2)) { |
| 1313 return false; |
| 1314 } |
| 1288 value_check = ic_data.AsUnaryClassChecksForArgNr(2); | 1315 value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
| 1289 return InlineSetIndexed(kind, target, call, receiver, token_pos, | 1316 return InlineSetIndexed(kind, target, call, receiver, token_pos, |
| 1290 &ic_data, value_check, entry, last); | 1317 &ic_data, value_check, entry, last); |
| 1291 case MethodRecognizer::kInt32ArraySetIndexed: | 1318 case MethodRecognizer::kInt32ArraySetIndexed: |
| 1292 case MethodRecognizer::kUint32ArraySetIndexed: | 1319 case MethodRecognizer::kUint32ArraySetIndexed: |
| 1293 if (!CanUnboxInt32()) return false; | 1320 if (!CanUnboxInt32()) { |
| 1321 return false; |
| 1322 } |
| 1294 // Check that value is always smi or mint, if the platform has unboxed | 1323 // Check that value is always smi or mint, if the platform has unboxed |
| 1295 // mints (ia32 with at least SSE 4.1). | 1324 // mints (ia32 with at least SSE 4.1). |
| 1296 value_check = ic_data.AsUnaryClassChecksForArgNr(2); | 1325 value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
| 1297 if (FlowGraphCompiler::SupportsUnboxedMints()) { | 1326 if (FlowGraphCompiler::SupportsUnboxedMints()) { |
| 1298 if (!HasOnlySmiOrMint(value_check)) { | 1327 if (!HasOnlySmiOrMint(value_check)) { |
| 1299 return false; | 1328 return false; |
| 1300 } | 1329 } |
| 1301 } else if (!HasOnlyOneSmi(value_check)) { | 1330 } else if (!HasOnlyOneSmi(value_check)) { |
| 1302 return false; | 1331 return false; |
| 1303 } | 1332 } |
| 1304 return InlineSetIndexed(kind, target, call, receiver, token_pos, | 1333 return InlineSetIndexed(kind, target, call, receiver, token_pos, |
| 1305 &ic_data, value_check, entry, last); | 1334 &ic_data, value_check, entry, last); |
| 1306 case MethodRecognizer::kFloat32ArraySetIndexed: | 1335 case MethodRecognizer::kFloat32ArraySetIndexed: |
| 1307 case MethodRecognizer::kFloat64ArraySetIndexed: | 1336 case MethodRecognizer::kFloat64ArraySetIndexed: |
| 1308 // Check that value is always double. | 1337 // Check that value is always double. |
| 1309 if (!ArgIsAlways(kDoubleCid, ic_data, 2)) return false; | 1338 if (!ArgIsAlways(kDoubleCid, ic_data, 2)) { |
| 1339 return false; |
| 1340 } |
| 1310 value_check = ic_data.AsUnaryClassChecksForArgNr(2); | 1341 value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
| 1311 return InlineSetIndexed(kind, target, call, receiver, token_pos, | 1342 return InlineSetIndexed(kind, target, call, receiver, token_pos, |
| 1312 &ic_data, value_check, entry, last); | 1343 &ic_data, value_check, entry, last); |
| 1313 case MethodRecognizer::kFloat32x4ArraySetIndexed: | 1344 case MethodRecognizer::kFloat32x4ArraySetIndexed: |
| 1314 if (!ShouldInlineSimd()) return false; | 1345 if (!ShouldInlineSimd()) { |
| 1346 return false; |
| 1347 } |
| 1315 // Check that value is always a Float32x4. | 1348 // Check that value is always a Float32x4. |
| 1316 if (!ArgIsAlways(kFloat32x4Cid, ic_data, 2)) return false; | 1349 if (!ArgIsAlways(kFloat32x4Cid, ic_data, 2)) { |
| 1350 return false; |
| 1351 } |
| 1317 value_check = ic_data.AsUnaryClassChecksForArgNr(2); | 1352 value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
| 1318 return InlineSetIndexed(kind, target, call, receiver, token_pos, | 1353 return InlineSetIndexed(kind, target, call, receiver, token_pos, |
| 1319 &ic_data, value_check, entry, last); | 1354 &ic_data, value_check, entry, last); |
| 1355 case MethodRecognizer::kFloat64x2ArraySetIndexed: |
| 1356 if (!ShouldInlineSimd()) { |
| 1357 return false; |
| 1358 } |
| 1359 // Check that value is always a Float32x4. |
| 1360 if (!ArgIsAlways(kFloat64x2Cid, ic_data, 2)) { |
| 1361 return false; |
| 1362 } |
| 1363 value_check = ic_data.AsUnaryClassChecksForArgNr(2); |
| 1364 return InlineSetIndexed(kind, target, call, receiver, token_pos, |
| 1365 &ic_data, value_check, entry, last); |
| 1320 case MethodRecognizer::kByteArrayBaseGetInt8: | 1366 case MethodRecognizer::kByteArrayBaseGetInt8: |
| 1321 return InlineByteArrayViewLoad(call, receiver, receiver_cid, | 1367 return InlineByteArrayViewLoad(call, receiver, receiver_cid, |
| 1322 kTypedDataInt8ArrayCid, | 1368 kTypedDataInt8ArrayCid, |
| 1323 ic_data, entry, last); | 1369 ic_data, entry, last); |
| 1324 case MethodRecognizer::kByteArrayBaseGetUint8: | 1370 case MethodRecognizer::kByteArrayBaseGetUint8: |
| 1325 return InlineByteArrayViewLoad(call, receiver, receiver_cid, | 1371 return InlineByteArrayViewLoad(call, receiver, receiver_cid, |
| 1326 kTypedDataUint8ArrayCid, | 1372 kTypedDataUint8ArrayCid, |
| 1327 ic_data, entry, last); | 1373 ic_data, entry, last); |
| 1328 case MethodRecognizer::kByteArrayBaseGetInt16: | 1374 case MethodRecognizer::kByteArrayBaseGetInt16: |
| 1329 return InlineByteArrayViewLoad(call, receiver, receiver_cid, | 1375 return InlineByteArrayViewLoad(call, receiver, receiver_cid, |
| 1330 kTypedDataInt16ArrayCid, | 1376 kTypedDataInt16ArrayCid, |
| 1331 ic_data, entry, last); | 1377 ic_data, entry, last); |
| 1332 case MethodRecognizer::kByteArrayBaseGetUint16: | 1378 case MethodRecognizer::kByteArrayBaseGetUint16: |
| 1333 return InlineByteArrayViewLoad(call, receiver, receiver_cid, | 1379 return InlineByteArrayViewLoad(call, receiver, receiver_cid, |
| 1334 kTypedDataUint16ArrayCid, | 1380 kTypedDataUint16ArrayCid, |
| 1335 ic_data, entry, last); | 1381 ic_data, entry, last); |
| 1336 case MethodRecognizer::kByteArrayBaseGetInt32: | 1382 case MethodRecognizer::kByteArrayBaseGetInt32: |
| 1337 if (!CanUnboxInt32()) return false; | 1383 if (!CanUnboxInt32()) { |
| 1384 return false; |
| 1385 } |
| 1338 return InlineByteArrayViewLoad(call, receiver, receiver_cid, | 1386 return InlineByteArrayViewLoad(call, receiver, receiver_cid, |
| 1339 kTypedDataInt32ArrayCid, | 1387 kTypedDataInt32ArrayCid, |
| 1340 ic_data, entry, last); | 1388 ic_data, entry, last); |
| 1341 case MethodRecognizer::kByteArrayBaseGetUint32: | 1389 case MethodRecognizer::kByteArrayBaseGetUint32: |
| 1342 if (!CanUnboxInt32()) return false; | 1390 if (!CanUnboxInt32()) { |
| 1391 return false; |
| 1392 } |
| 1343 return InlineByteArrayViewLoad(call, receiver, receiver_cid, | 1393 return InlineByteArrayViewLoad(call, receiver, receiver_cid, |
| 1344 kTypedDataUint32ArrayCid, | 1394 kTypedDataUint32ArrayCid, |
| 1345 ic_data, entry, last); | 1395 ic_data, entry, last); |
| 1346 case MethodRecognizer::kByteArrayBaseGetFloat32: | 1396 case MethodRecognizer::kByteArrayBaseGetFloat32: |
| 1347 return InlineByteArrayViewLoad(call, receiver, receiver_cid, | 1397 return InlineByteArrayViewLoad(call, receiver, receiver_cid, |
| 1348 kTypedDataFloat32ArrayCid, | 1398 kTypedDataFloat32ArrayCid, |
| 1349 ic_data, entry, last); | 1399 ic_data, entry, last); |
| 1350 case MethodRecognizer::kByteArrayBaseGetFloat64: | 1400 case MethodRecognizer::kByteArrayBaseGetFloat64: |
| 1351 return InlineByteArrayViewLoad(call, receiver, receiver_cid, | 1401 return InlineByteArrayViewLoad(call, receiver, receiver_cid, |
| 1352 kTypedDataFloat64ArrayCid, | 1402 kTypedDataFloat64ArrayCid, |
| 1353 ic_data, entry, last); | 1403 ic_data, entry, last); |
| 1354 case MethodRecognizer::kByteArrayBaseGetFloat32x4: | 1404 case MethodRecognizer::kByteArrayBaseGetFloat32x4: |
| 1355 if (!ShouldInlineSimd()) return false; | 1405 if (!ShouldInlineSimd()) { |
| 1406 return false; |
| 1407 } |
| 1356 return InlineByteArrayViewLoad(call, receiver, receiver_cid, | 1408 return InlineByteArrayViewLoad(call, receiver, receiver_cid, |
| 1357 kTypedDataFloat32x4ArrayCid, | 1409 kTypedDataFloat32x4ArrayCid, |
| 1358 ic_data, entry, last); | 1410 ic_data, entry, last); |
| 1359 case MethodRecognizer::kByteArrayBaseGetInt32x4: | 1411 case MethodRecognizer::kByteArrayBaseGetInt32x4: |
| 1360 if (!ShouldInlineSimd()) return false; | 1412 if (!ShouldInlineSimd()) { |
| 1413 return false; |
| 1414 } |
| 1361 return InlineByteArrayViewLoad(call, receiver, receiver_cid, | 1415 return InlineByteArrayViewLoad(call, receiver, receiver_cid, |
| 1362 kTypedDataInt32x4ArrayCid, | 1416 kTypedDataInt32x4ArrayCid, |
| 1363 ic_data, entry, last); | 1417 ic_data, entry, last); |
| 1364 case MethodRecognizer::kByteArrayBaseSetInt8: | 1418 case MethodRecognizer::kByteArrayBaseSetInt8: |
| 1365 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, | 1419 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, |
| 1366 kTypedDataInt8ArrayCid, | 1420 kTypedDataInt8ArrayCid, |
| 1367 ic_data, entry, last); | 1421 ic_data, entry, last); |
| 1368 case MethodRecognizer::kByteArrayBaseSetUint8: | 1422 case MethodRecognizer::kByteArrayBaseSetUint8: |
| 1369 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, | 1423 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, |
| 1370 kTypedDataUint8ArrayCid, | 1424 kTypedDataUint8ArrayCid, |
| 1371 ic_data, entry, last); | 1425 ic_data, entry, last); |
| 1372 case MethodRecognizer::kByteArrayBaseSetInt16: | 1426 case MethodRecognizer::kByteArrayBaseSetInt16: |
| 1373 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, | 1427 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, |
| 1374 kTypedDataInt16ArrayCid, | 1428 kTypedDataInt16ArrayCid, |
| 1375 ic_data, entry, last); | 1429 ic_data, entry, last); |
| 1376 case MethodRecognizer::kByteArrayBaseSetUint16: | 1430 case MethodRecognizer::kByteArrayBaseSetUint16: |
| 1377 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, | 1431 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, |
| 1378 kTypedDataUint16ArrayCid, | 1432 kTypedDataUint16ArrayCid, |
| 1379 ic_data, entry, last); | 1433 ic_data, entry, last); |
| 1380 case MethodRecognizer::kByteArrayBaseSetInt32: | 1434 case MethodRecognizer::kByteArrayBaseSetInt32: |
| 1381 if (!CanUnboxInt32()) return false; | 1435 if (!CanUnboxInt32()) { |
| 1436 return false; |
| 1437 } |
| 1382 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, | 1438 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, |
| 1383 kTypedDataInt32ArrayCid, | 1439 kTypedDataInt32ArrayCid, |
| 1384 ic_data, entry, last); | 1440 ic_data, entry, last); |
| 1385 case MethodRecognizer::kByteArrayBaseSetUint32: | 1441 case MethodRecognizer::kByteArrayBaseSetUint32: |
| 1386 if (!CanUnboxInt32()) return false; | 1442 if (!CanUnboxInt32()) { |
| 1443 return false; |
| 1444 } |
| 1387 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, | 1445 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, |
| 1388 kTypedDataUint32ArrayCid, | 1446 kTypedDataUint32ArrayCid, |
| 1389 ic_data, entry, last); | 1447 ic_data, entry, last); |
| 1390 case MethodRecognizer::kByteArrayBaseSetFloat32: | 1448 case MethodRecognizer::kByteArrayBaseSetFloat32: |
| 1391 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, | 1449 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, |
| 1392 kTypedDataFloat32ArrayCid, | 1450 kTypedDataFloat32ArrayCid, |
| 1393 ic_data, entry, last); | 1451 ic_data, entry, last); |
| 1394 case MethodRecognizer::kByteArrayBaseSetFloat64: | 1452 case MethodRecognizer::kByteArrayBaseSetFloat64: |
| 1395 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, | 1453 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, |
| 1396 kTypedDataFloat64ArrayCid, | 1454 kTypedDataFloat64ArrayCid, |
| 1397 ic_data, entry, last); | 1455 ic_data, entry, last); |
| 1398 case MethodRecognizer::kByteArrayBaseSetFloat32x4: | 1456 case MethodRecognizer::kByteArrayBaseSetFloat32x4: |
| 1399 if (!ShouldInlineSimd()) return false; | 1457 if (!ShouldInlineSimd()) { |
| 1458 return false; |
| 1459 } |
| 1400 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, | 1460 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, |
| 1401 kTypedDataFloat32x4ArrayCid, | 1461 kTypedDataFloat32x4ArrayCid, |
| 1402 ic_data, entry, last); | 1462 ic_data, entry, last); |
| 1403 case MethodRecognizer::kByteArrayBaseSetInt32x4: | 1463 case MethodRecognizer::kByteArrayBaseSetInt32x4: |
| 1404 if (!ShouldInlineSimd()) return false; | 1464 if (!ShouldInlineSimd()) { |
| 1465 return false; |
| 1466 } |
| 1405 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, | 1467 return InlineByteArrayViewStore(target, call, receiver, receiver_cid, |
| 1406 kTypedDataInt32x4ArrayCid, | 1468 kTypedDataInt32x4ArrayCid, |
| 1407 ic_data, entry, last); | 1469 ic_data, entry, last); |
| 1408 case MethodRecognizer::kStringBaseCodeUnitAt: | 1470 case MethodRecognizer::kStringBaseCodeUnitAt: |
| 1409 return InlineStringCodeUnitAt(call, receiver_cid, entry, last); | 1471 return InlineStringCodeUnitAt(call, receiver_cid, entry, last); |
| 1410 case MethodRecognizer::kStringBaseCharAt: | 1472 case MethodRecognizer::kStringBaseCharAt: |
| 1411 return InlineStringBaseCharAt(call, receiver_cid, entry, last); | 1473 return InlineStringBaseCharAt(call, receiver_cid, entry, last); |
| 1412 default: | 1474 default: |
| 1413 return false; | 1475 return false; |
| 1414 } | 1476 } |
| (...skipping 6248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7663 const Object& value = instr->value()->definition()->constant_value(); | 7725 const Object& value = instr->value()->definition()->constant_value(); |
| 7664 if (IsNonConstant(value)) { | 7726 if (IsNonConstant(value)) { |
| 7665 SetValue(instr, non_constant_); | 7727 SetValue(instr, non_constant_); |
| 7666 } else if (IsConstant(value)) { | 7728 } else if (IsConstant(value)) { |
| 7667 // TODO(kmillikin): Handle conversion. | 7729 // TODO(kmillikin): Handle conversion. |
| 7668 SetValue(instr, non_constant_); | 7730 SetValue(instr, non_constant_); |
| 7669 } | 7731 } |
| 7670 } | 7732 } |
| 7671 | 7733 |
| 7672 | 7734 |
| 7735 void ConstantPropagator::VisitUnboxFloat64x2(UnboxFloat64x2Instr* instr) { |
| 7736 const Object& value = instr->value()->definition()->constant_value(); |
| 7737 if (IsNonConstant(value)) { |
| 7738 SetValue(instr, non_constant_); |
| 7739 } else if (IsConstant(value)) { |
| 7740 // TODO(kmillikin): Handle conversion. |
| 7741 SetValue(instr, non_constant_); |
| 7742 } |
| 7743 } |
| 7744 |
| 7745 |
| 7746 void ConstantPropagator::VisitBoxFloat64x2(BoxFloat64x2Instr* instr) { |
| 7747 const Object& value = instr->value()->definition()->constant_value(); |
| 7748 if (IsNonConstant(value)) { |
| 7749 SetValue(instr, non_constant_); |
| 7750 } else if (IsConstant(value)) { |
| 7751 // TODO(kmillikin): Handle conversion. |
| 7752 SetValue(instr, non_constant_); |
| 7753 } |
| 7754 } |
| 7755 |
| 7756 |
| 7673 void ConstantPropagator::VisitUnboxInt32x4(UnboxInt32x4Instr* instr) { | 7757 void ConstantPropagator::VisitUnboxInt32x4(UnboxInt32x4Instr* instr) { |
| 7674 const Object& value = instr->value()->definition()->constant_value(); | 7758 const Object& value = instr->value()->definition()->constant_value(); |
| 7675 if (IsNonConstant(value)) { | 7759 if (IsNonConstant(value)) { |
| 7676 SetValue(instr, non_constant_); | 7760 SetValue(instr, non_constant_); |
| 7677 } else if (IsConstant(value)) { | 7761 } else if (IsConstant(value)) { |
| 7678 // TODO(kmillikin): Handle conversion. | 7762 // TODO(kmillikin): Handle conversion. |
| 7679 SetValue(instr, non_constant_); | 7763 SetValue(instr, non_constant_); |
| 7680 } | 7764 } |
| 7681 } | 7765 } |
| 7682 | 7766 |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8510 } | 8594 } |
| 8511 | 8595 |
| 8512 // Insert materializations at environment uses. | 8596 // Insert materializations at environment uses. |
| 8513 for (intptr_t i = 0; i < exits.length(); i++) { | 8597 for (intptr_t i = 0; i < exits.length(); i++) { |
| 8514 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); | 8598 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); |
| 8515 } | 8599 } |
| 8516 } | 8600 } |
| 8517 | 8601 |
| 8518 | 8602 |
| 8519 } // namespace dart | 8603 } // namespace dart |
| OLD | NEW |