| 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 2809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2820 *range = Range(RangeBoundary::FromConstant(0), | 2820 *range = Range(RangeBoundary::FromConstant(0), |
| 2821 RangeBoundary::FromConstant(0xFFFF)); | 2821 RangeBoundary::FromConstant(0xFFFF)); |
| 2822 break; | 2822 break; |
| 2823 default: | 2823 default: |
| 2824 Definition::InferRange(analysis, range); | 2824 Definition::InferRange(analysis, range); |
| 2825 break; | 2825 break; |
| 2826 } | 2826 } |
| 2827 } | 2827 } |
| 2828 | 2828 |
| 2829 | 2829 |
| 2830 void LoadCodeUnitsInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
| 2831 ASSERT(class_id() == kOneByteStringCid || |
| 2832 class_id() == kTwoByteStringCid); |
| 2833 switch (class_id()) { |
| 2834 case kOneByteStringCid: |
| 2835 case kTwoByteStringCid: |
| 2836 *range = Range(RangeBoundary::FromConstant(0), |
| 2837 RangeBoundary::FromConstant(kMaxUint32)); |
| 2838 break; |
| 2839 default: |
| 2840 UNREACHABLE(); |
| 2841 break; |
| 2842 } |
| 2843 } |
| 2844 |
| 2845 |
| 2830 void IfThenElseInstr::InferRange(RangeAnalysis* analysis, Range* range) { | 2846 void IfThenElseInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
| 2831 const intptr_t min = Utils::Minimum(if_true_, if_false_); | 2847 const intptr_t min = Utils::Minimum(if_true_, if_false_); |
| 2832 const intptr_t max = Utils::Maximum(if_true_, if_false_); | 2848 const intptr_t max = Utils::Maximum(if_true_, if_false_); |
| 2833 *range = Range(RangeBoundary::FromConstant(min), | 2849 *range = Range(RangeBoundary::FromConstant(min), |
| 2834 RangeBoundary::FromConstant(max)); | 2850 RangeBoundary::FromConstant(max)); |
| 2835 } | 2851 } |
| 2836 | 2852 |
| 2837 | 2853 |
| 2838 static RangeBoundary::RangeSize RepresentationToRangeSize(Representation r) { | 2854 static RangeBoundary::RangeSize RepresentationToRangeSize(Representation r) { |
| 2839 switch (r) { | 2855 switch (r) { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3040 } | 3056 } |
| 3041 } while (CanonicalizeMaxBoundary(&max) || | 3057 } while (CanonicalizeMaxBoundary(&max) || |
| 3042 CanonicalizeMinBoundary(&canonical_length)); | 3058 CanonicalizeMinBoundary(&canonical_length)); |
| 3043 | 3059 |
| 3044 // Failed to prove that maximum is bounded with array length. | 3060 // Failed to prove that maximum is bounded with array length. |
| 3045 return false; | 3061 return false; |
| 3046 } | 3062 } |
| 3047 | 3063 |
| 3048 | 3064 |
| 3049 } // namespace dart | 3065 } // namespace dart |
| OLD | NEW |