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/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 unboxed = kUnboxedInt32x4; | 743 unboxed = kUnboxedInt32x4; |
744 } | 744 } |
745 break; | 745 break; |
746 case kFloat64x2Cid: | 746 case kFloat64x2Cid: |
747 if (ShouldInlineSimd()) { | 747 if (ShouldInlineSimd()) { |
748 unboxed = kUnboxedFloat64x2; | 748 unboxed = kUnboxedFloat64x2; |
749 } | 749 } |
750 break; | 750 break; |
751 } | 751 } |
752 | 752 |
| 753 if ((unboxed == kTagged) && |
| 754 phi->Type()->IsInt() && |
| 755 RangeUtils::Fits(phi->range(), RangeBoundary::kRangeBoundaryInt32)) { |
| 756 bool should_unbox = false; |
| 757 for (intptr_t i = 0; i < phi->InputCount(); i++) { |
| 758 Definition* input = phi->InputAt(i)->definition(); |
| 759 if (input->IsBox() && |
| 760 RangeUtils::Fits(input->range(), |
| 761 RangeBoundary::kRangeBoundaryInt32)) { |
| 762 should_unbox = true; |
| 763 } else if (!input->IsConstant()) { |
| 764 should_unbox = false; |
| 765 break; |
| 766 } |
| 767 } |
| 768 |
| 769 if (should_unbox) { |
| 770 unboxed = kUnboxedInt32; |
| 771 } |
| 772 } |
| 773 |
753 phi->set_representation(unboxed); | 774 phi->set_representation(unboxed); |
754 } | 775 } |
755 | 776 |
756 | 777 |
757 void FlowGraphOptimizer::SelectRepresentations() { | 778 void FlowGraphOptimizer::SelectRepresentations() { |
758 // Conservatively unbox all phis that were proven to be of Double, | 779 // Conservatively unbox all phis that were proven to be of Double, |
759 // Float32x4, or Int32x4 type. | 780 // Float32x4, or Int32x4 type. |
760 for (intptr_t i = 0; i < block_order_.length(); ++i) { | 781 for (intptr_t i = 0; i < block_order_.length(); ++i) { |
761 JoinEntryInstr* join_entry = block_order_[i]->AsJoinEntry(); | 782 JoinEntryInstr* join_entry = block_order_[i]->AsJoinEntry(); |
762 if (join_entry != NULL) { | 783 if (join_entry != NULL) { |
(...skipping 9165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9928 | 9949 |
9929 // Insert materializations at environment uses. | 9950 // Insert materializations at environment uses. |
9930 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { | 9951 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { |
9931 CreateMaterializationAt( | 9952 CreateMaterializationAt( |
9932 exits_collector_.exits()[i], alloc, alloc->cls(), *slots); | 9953 exits_collector_.exits()[i], alloc, alloc->cls(), *slots); |
9933 } | 9954 } |
9934 } | 9955 } |
9935 | 9956 |
9936 | 9957 |
9937 } // namespace dart | 9958 } // namespace dart |
OLD | NEW |