| 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 2885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2896 *range = Range(RangeBoundary::FromConstant(0), | 2896 *range = Range(RangeBoundary::FromConstant(0), |
| 2897 RangeBoundary::FromConstant(0xFFFF)); | 2897 RangeBoundary::FromConstant(0xFFFF)); |
| 2898 break; | 2898 break; |
| 2899 default: | 2899 default: |
| 2900 Definition::InferRange(analysis, range); | 2900 Definition::InferRange(analysis, range); |
| 2901 break; | 2901 break; |
| 2902 } | 2902 } |
| 2903 } | 2903 } |
| 2904 | 2904 |
| 2905 | 2905 |
| 2906 void LoadCodeUnitsInstr::InferRange(RangeAnalysis* analysis, Range* range) { | |
| 2907 ASSERT(class_id() == kOneByteStringCid || | |
| 2908 class_id() == kTwoByteStringCid); | |
| 2909 switch (class_id()) { | |
| 2910 case kOneByteStringCid: | |
| 2911 case kTwoByteStringCid: | |
| 2912 *range = Range(RangeBoundary::FromConstant(0), | |
| 2913 RangeBoundary::FromConstant(kMaxUint32)); | |
| 2914 break; | |
| 2915 default: | |
| 2916 UNREACHABLE(); | |
| 2917 break; | |
| 2918 } | |
| 2919 } | |
| 2920 | |
| 2921 | |
| 2922 void IfThenElseInstr::InferRange(RangeAnalysis* analysis, Range* range) { | 2906 void IfThenElseInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
| 2923 const intptr_t min = Utils::Minimum(if_true_, if_false_); | 2907 const intptr_t min = Utils::Minimum(if_true_, if_false_); |
| 2924 const intptr_t max = Utils::Maximum(if_true_, if_false_); | 2908 const intptr_t max = Utils::Maximum(if_true_, if_false_); |
| 2925 *range = Range(RangeBoundary::FromConstant(min), | 2909 *range = Range(RangeBoundary::FromConstant(min), |
| 2926 RangeBoundary::FromConstant(max)); | 2910 RangeBoundary::FromConstant(max)); |
| 2927 } | 2911 } |
| 2928 | 2912 |
| 2929 | 2913 |
| 2930 static RangeBoundary::RangeSize RepresentationToRangeSize(Representation r) { | 2914 static RangeBoundary::RangeSize RepresentationToRangeSize(Representation r) { |
| 2931 switch (r) { | 2915 switch (r) { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3144 } | 3128 } |
| 3145 } while (CanonicalizeMaxBoundary(&max) || | 3129 } while (CanonicalizeMaxBoundary(&max) || |
| 3146 CanonicalizeMinBoundary(&canonical_length)); | 3130 CanonicalizeMinBoundary(&canonical_length)); |
| 3147 | 3131 |
| 3148 // Failed to prove that maximum is bounded with array length. | 3132 // Failed to prove that maximum is bounded with array length. |
| 3149 return false; | 3133 return false; |
| 3150 } | 3134 } |
| 3151 | 3135 |
| 3152 | 3136 |
| 3153 } // namespace dart | 3137 } // namespace dart |
| OLD | NEW |