OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_range_analysis.h" | 5 #include "vm/flow_graph_range_analysis.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/il_printer.h" | 8 #include "vm/il_printer.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 while (def->IsConstraint()) { | 680 while (def->IsConstraint()) { |
681 def = def->AsConstraint()->value()->definition(); | 681 def = def->AsConstraint()->value()->definition(); |
682 } | 682 } |
683 constraints_[i]->ReplaceUsesWith(def); | 683 constraints_[i]->ReplaceUsesWith(def); |
684 constraints_[i]->RemoveFromGraph(); | 684 constraints_[i]->RemoveFromGraph(); |
685 } | 685 } |
686 } | 686 } |
687 | 687 |
688 | 688 |
689 static void NarrowBinaryMintOp(BinaryMintOpInstr* mint_op) { | 689 static void NarrowBinaryMintOp(BinaryMintOpInstr* mint_op) { |
690 if (Range::Fits(mint_op->range(), RangeBoundary::kRangeBoundaryInt32) && | 690 if (RangeUtils::Fits(mint_op->range(), RangeBoundary::kRangeBoundaryInt32) && |
691 Range::Fits(mint_op->left()->definition()->range(), | 691 RangeUtils::Fits(mint_op->left()->definition()->range(), |
692 RangeBoundary::kRangeBoundaryInt32) && | 692 RangeBoundary::kRangeBoundaryInt32) && |
693 Range::Fits(mint_op->right()->definition()->range(), | 693 RangeUtils::Fits(mint_op->right()->definition()->range(), |
694 RangeBoundary::kRangeBoundaryInt32) && | 694 RangeBoundary::kRangeBoundaryInt32) && |
695 BinaryInt32OpInstr::IsSupported(mint_op->op_kind(), | 695 BinaryInt32OpInstr::IsSupported(mint_op->op_kind(), |
696 mint_op->left(), | 696 mint_op->left(), |
697 mint_op->right())) { | 697 mint_op->right())) { |
698 BinaryInt32OpInstr* int32_op = | 698 BinaryInt32OpInstr* int32_op = |
699 new BinaryInt32OpInstr(mint_op->op_kind(), | 699 new BinaryInt32OpInstr(mint_op->op_kind(), |
700 mint_op->left()->CopyWithType(), | 700 mint_op->left()->CopyWithType(), |
701 mint_op->right()->CopyWithType(), | 701 mint_op->right()->CopyWithType(), |
702 mint_op->DeoptimizationTarget()); | 702 mint_op->DeoptimizationTarget()); |
703 int32_op->set_range(*mint_op->range()); | 703 int32_op->set_range(*mint_op->range()); |
704 int32_op->set_overflow(false); | 704 int32_op->set_overflow(false); |
705 mint_op->ReplaceWith(int32_op, NULL); | 705 mint_op->ReplaceWith(int32_op, NULL); |
706 } | 706 } |
707 } | 707 } |
708 | 708 |
709 | 709 |
710 static void NarrowShiftMintOp(ShiftMintOpInstr* mint_op) { | 710 static void NarrowShiftMintOp(ShiftMintOpInstr* mint_op) { |
711 if (Range::Fits(mint_op->range(), RangeBoundary::kRangeBoundaryInt32) && | 711 if (RangeUtils::Fits(mint_op->range(), RangeBoundary::kRangeBoundaryInt32) && |
712 Range::Fits(mint_op->left()->definition()->range(), | 712 RangeUtils::Fits(mint_op->left()->definition()->range(), |
713 RangeBoundary::kRangeBoundaryInt32) && | 713 RangeBoundary::kRangeBoundaryInt32) && |
714 Range::Fits(mint_op->right()->definition()->range(), | 714 RangeUtils::Fits(mint_op->right()->definition()->range(), |
715 RangeBoundary::kRangeBoundaryInt32) && | 715 RangeBoundary::kRangeBoundaryInt32) && |
716 BinaryInt32OpInstr::IsSupported(mint_op->op_kind(), | 716 BinaryInt32OpInstr::IsSupported(mint_op->op_kind(), |
717 mint_op->left(), | 717 mint_op->left(), |
718 mint_op->right())) { | 718 mint_op->right())) { |
719 BinaryInt32OpInstr* int32_op = | 719 BinaryInt32OpInstr* int32_op = |
720 new BinaryInt32OpInstr(mint_op->op_kind(), | 720 new BinaryInt32OpInstr(mint_op->op_kind(), |
721 mint_op->left()->CopyWithType(), | 721 mint_op->left()->CopyWithType(), |
722 mint_op->right()->CopyWithType(), | 722 mint_op->right()->CopyWithType(), |
723 mint_op->DeoptimizationTarget()); | 723 mint_op->DeoptimizationTarget()); |
724 int32_op->set_range(*mint_op->range()); | 724 int32_op->set_range(*mint_op->range()); |
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2218 } | 2218 } |
2219 } while (CanonicalizeMaxBoundary(&max) || | 2219 } while (CanonicalizeMaxBoundary(&max) || |
2220 CanonicalizeMinBoundary(&canonical_length)); | 2220 CanonicalizeMinBoundary(&canonical_length)); |
2221 | 2221 |
2222 // Failed to prove that maximum is bounded with array length. | 2222 // Failed to prove that maximum is bounded with array length. |
2223 return false; | 2223 return false; |
2224 } | 2224 } |
2225 | 2225 |
2226 | 2226 |
2227 } // namespace dart | 2227 } // namespace dart |
OLD | NEW |