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 2330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2341 void Range::BitwiseOp(const Range* left_range, | 2341 void Range::BitwiseOp(const Range* left_range, |
2342 const Range* right_range, | 2342 const Range* right_range, |
2343 RangeBoundary* result_min, | 2343 RangeBoundary* result_min, |
2344 RangeBoundary* result_max) { | 2344 RangeBoundary* result_max) { |
2345 const int bitsize = Utils::Maximum(BitSize(left_range), BitSize(right_range)); | 2345 const int bitsize = Utils::Maximum(BitSize(left_range), BitSize(right_range)); |
2346 | 2346 |
2347 if (left_range->IsPositive() && right_range->IsPositive()) { | 2347 if (left_range->IsPositive() && right_range->IsPositive()) { |
2348 *result_min = RangeBoundary::FromConstant(0); | 2348 *result_min = RangeBoundary::FromConstant(0); |
2349 } else { | 2349 } else { |
2350 *result_min = | 2350 *result_min = |
2351 RangeBoundary::FromConstant(static_cast<int64_t>(-1) << bitsize); | 2351 RangeBoundary::FromConstant(-(static_cast<int64_t>(1) << bitsize)); |
2352 } | 2352 } |
2353 | 2353 |
2354 *result_max = | 2354 *result_max = |
2355 RangeBoundary::FromConstant((static_cast<uint64_t>(1) << bitsize) - 1); | 2355 RangeBoundary::FromConstant((static_cast<uint64_t>(1) << bitsize) - 1); |
2356 } | 2356 } |
2357 | 2357 |
2358 | 2358 |
2359 static bool IsArrayLength(Definition* defn) { | 2359 static bool IsArrayLength(Definition* defn) { |
2360 if (defn == NULL) { | 2360 if (defn == NULL) { |
2361 return false; | 2361 return false; |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3046 } | 3046 } |
3047 } while (CanonicalizeMaxBoundary(&max) || | 3047 } while (CanonicalizeMaxBoundary(&max) || |
3048 CanonicalizeMinBoundary(&canonical_length)); | 3048 CanonicalizeMinBoundary(&canonical_length)); |
3049 | 3049 |
3050 // Failed to prove that maximum is bounded with array length. | 3050 // Failed to prove that maximum is bounded with array length. |
3051 return false; | 3051 return false; |
3052 } | 3052 } |
3053 | 3053 |
3054 | 3054 |
3055 } // namespace dart | 3055 } // namespace dart |
OLD | NEW |