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