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 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 *range = Range(RangeBoundary::FromConstant(0), | 1978 *range = Range(RangeBoundary::FromConstant(0), |
1979 RangeBoundary::FromConstant(0xFFFF)); | 1979 RangeBoundary::FromConstant(0xFFFF)); |
1980 break; | 1980 break; |
1981 default: | 1981 default: |
1982 Definition::InferRange(analysis, range); | 1982 Definition::InferRange(analysis, range); |
1983 break; | 1983 break; |
1984 } | 1984 } |
1985 } | 1985 } |
1986 | 1986 |
1987 | 1987 |
| 1988 void LoadCodeUnitsInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
| 1989 ASSERT(class_id() == kOneByteStringCid || |
| 1990 class_id() == kTwoByteStringCid); |
| 1991 switch (class_id()) { |
| 1992 case kOneByteStringCid: |
| 1993 case kTwoByteStringCid: |
| 1994 *range = Range(RangeBoundary::FromConstant(0), |
| 1995 RangeBoundary::FromConstant(0xFFFFFFFF)); |
| 1996 break; |
| 1997 default: |
| 1998 UNREACHABLE(); |
| 1999 break; |
| 2000 } |
| 2001 } |
| 2002 |
| 2003 |
1988 void IfThenElseInstr::InferRange(RangeAnalysis* analysis, Range* range) { | 2004 void IfThenElseInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
1989 const intptr_t min = Utils::Minimum(if_true_, if_false_); | 2005 const intptr_t min = Utils::Minimum(if_true_, if_false_); |
1990 const intptr_t max = Utils::Maximum(if_true_, if_false_); | 2006 const intptr_t max = Utils::Maximum(if_true_, if_false_); |
1991 *range = Range(RangeBoundary::FromConstant(min), | 2007 *range = Range(RangeBoundary::FromConstant(min), |
1992 RangeBoundary::FromConstant(max)); | 2008 RangeBoundary::FromConstant(max)); |
1993 } | 2009 } |
1994 | 2010 |
1995 | 2011 |
1996 static RangeBoundary::RangeSize RepresentationToRangeSize(Representation r) { | 2012 static RangeBoundary::RangeSize RepresentationToRangeSize(Representation r) { |
1997 switch (r) { | 2013 switch (r) { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2189 } | 2205 } |
2190 } while (CanonicalizeMaxBoundary(&max) || | 2206 } while (CanonicalizeMaxBoundary(&max) || |
2191 CanonicalizeMinBoundary(&canonical_length)); | 2207 CanonicalizeMinBoundary(&canonical_length)); |
2192 | 2208 |
2193 // Failed to prove that maximum is bounded with array length. | 2209 // Failed to prove that maximum is bounded with array length. |
2194 return false; | 2210 return false; |
2195 } | 2211 } |
2196 | 2212 |
2197 | 2213 |
2198 } // namespace dart | 2214 } // namespace dart |
OLD | NEW |