| 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/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 switch (class_id) { | 596 switch (class_id) { |
| 597 case kArrayCid: | 597 case kArrayCid: |
| 598 case kGrowableObjectArrayCid: | 598 case kGrowableObjectArrayCid: |
| 599 if (ArgIsAlwaysSmi(*call->ic_data(), 2)) { | 599 if (ArgIsAlwaysSmi(*call->ic_data(), 2)) { |
| 600 value_check = call->ic_data()->AsUnaryClassChecksForArgNr(2); | 600 value_check = call->ic_data()->AsUnaryClassChecksForArgNr(2); |
| 601 } | 601 } |
| 602 break; | 602 break; |
| 603 case kInt8ArrayCid: | 603 case kInt8ArrayCid: |
| 604 case kUint8ArrayCid: | 604 case kUint8ArrayCid: |
| 605 case kUint8ClampedArrayCid: | 605 case kUint8ClampedArrayCid: |
| 606 case kExternalUint8ArrayCid: |
| 607 case kExternalUint8ClampedArrayCid: |
| 606 case kInt16ArrayCid: | 608 case kInt16ArrayCid: |
| 607 case kUint16ArrayCid: | 609 case kUint16ArrayCid: |
| 608 // Check that value is always smi. | 610 // Check that value is always smi. |
| 609 value_check = call->ic_data()->AsUnaryClassChecksForArgNr(2); | 611 value_check = call->ic_data()->AsUnaryClassChecksForArgNr(2); |
| 610 if ((value_check.NumberOfChecks() != 1) || | 612 if ((value_check.NumberOfChecks() != 1) || |
| 611 (value_check.GetReceiverClassIdAt(0) != kSmiCid)) { | 613 (value_check.GetReceiverClassIdAt(0) != kSmiCid)) { |
| 612 return false; | 614 return false; |
| 613 } | 615 } |
| 614 break; | 616 break; |
| 615 case kInt32ArrayCid: | 617 case kInt32ArrayCid: |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 type_arguments_field_offset, | 674 type_arguments_field_offset, |
| 673 Type::ZoneHandle()); // No type. | 675 Type::ZoneHandle()); // No type. |
| 674 InsertBefore(call, load_type_args, NULL, Definition::kValue); | 676 InsertBefore(call, load_type_args, NULL, Definition::kValue); |
| 675 instantiator = array->Copy(); | 677 instantiator = array->Copy(); |
| 676 type_args = new Value(load_type_args); | 678 type_args = new Value(load_type_args); |
| 677 break; | 679 break; |
| 678 } | 680 } |
| 679 case kInt8ArrayCid: | 681 case kInt8ArrayCid: |
| 680 case kUint8ArrayCid: | 682 case kUint8ArrayCid: |
| 681 case kUint8ClampedArrayCid: | 683 case kUint8ClampedArrayCid: |
| 684 case kExternalUint8ArrayCid: |
| 685 case kExternalUint8ClampedArrayCid: |
| 682 case kInt16ArrayCid: | 686 case kInt16ArrayCid: |
| 683 case kUint16ArrayCid: | 687 case kUint16ArrayCid: |
| 684 case kInt32ArrayCid: | 688 case kInt32ArrayCid: |
| 685 case kUint32ArrayCid: | 689 case kUint32ArrayCid: |
| 686 ASSERT(value_type.IsIntType()); | 690 ASSERT(value_type.IsIntType()); |
| 687 // Fall through. | 691 // Fall through. |
| 688 case kFloat32ArrayCid: | 692 case kFloat32ArrayCid: |
| 689 case kFloat64ArrayCid: { | 693 case kFloat64ArrayCid: { |
| 690 instantiator = new Value(flow_graph_->constant_null()); | 694 instantiator = new Value(flow_graph_->constant_null()); |
| 691 type_args = new Value(flow_graph_->constant_null()); | 695 type_args = new Value(flow_graph_->constant_null()); |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1360 call->ReplaceWith(invoke, current_iterator()); | 1364 call->ReplaceWith(invoke, current_iterator()); |
| 1361 RemovePushArguments(call); | 1365 RemovePushArguments(call); |
| 1362 } | 1366 } |
| 1363 | 1367 |
| 1364 | 1368 |
| 1365 static bool IsSupportedByteArrayCid(intptr_t cid) { | 1369 static bool IsSupportedByteArrayCid(intptr_t cid) { |
| 1366 switch (cid) { | 1370 switch (cid) { |
| 1367 case kInt8ArrayCid: | 1371 case kInt8ArrayCid: |
| 1368 case kUint8ArrayCid: | 1372 case kUint8ArrayCid: |
| 1369 case kUint8ClampedArrayCid: | 1373 case kUint8ClampedArrayCid: |
| 1374 case kExternalUint8ArrayCid: |
| 1375 case kExternalUint8ClampedArrayCid: |
| 1370 case kInt16ArrayCid: | 1376 case kInt16ArrayCid: |
| 1371 case kUint16ArrayCid: | 1377 case kUint16ArrayCid: |
| 1372 case kInt32ArrayCid: | 1378 case kInt32ArrayCid: |
| 1373 case kUint32ArrayCid: | 1379 case kUint32ArrayCid: |
| 1374 case kFloat32ArrayCid: | 1380 case kFloat32ArrayCid: |
| 1375 case kFloat64ArrayCid: | 1381 case kFloat64ArrayCid: |
| 1376 return true; | 1382 return true; |
| 1377 default: | 1383 default: |
| 1378 return false; | 1384 return false; |
| 1379 } | 1385 } |
| (...skipping 3306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4686 | 4692 |
| 4687 if (FLAG_trace_constant_propagation) { | 4693 if (FLAG_trace_constant_propagation) { |
| 4688 OS::Print("\n==== After constant propagation ====\n"); | 4694 OS::Print("\n==== After constant propagation ====\n"); |
| 4689 FlowGraphPrinter printer(*graph_); | 4695 FlowGraphPrinter printer(*graph_); |
| 4690 printer.PrintBlocks(); | 4696 printer.PrintBlocks(); |
| 4691 } | 4697 } |
| 4692 } | 4698 } |
| 4693 | 4699 |
| 4694 | 4700 |
| 4695 } // namespace dart | 4701 } // namespace dart |
| OLD | NEW |