Chromium Code Reviews| 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 2807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2818 *range = Range(RangeBoundary::FromConstant(0), | 2818 *range = Range(RangeBoundary::FromConstant(0), |
| 2819 RangeBoundary::FromConstant(0xFFFF)); | 2819 RangeBoundary::FromConstant(0xFFFF)); |
| 2820 break; | 2820 break; |
| 2821 default: | 2821 default: |
| 2822 Definition::InferRange(analysis, range); | 2822 Definition::InferRange(analysis, range); |
| 2823 break; | 2823 break; |
| 2824 } | 2824 } |
| 2825 } | 2825 } |
| 2826 | 2826 |
| 2827 | 2827 |
| 2828 void LoadCodeUnitsInstr::InferRange(RangeAnalysis* analysis, Range* range) { | |
| 2829 ASSERT(class_id() == kOneByteStringCid || | |
| 2830 class_id() == kTwoByteStringCid); | |
| 2831 switch (class_id()) { | |
| 2832 case kOneByteStringCid: | |
| 2833 case kTwoByteStringCid: | |
| 2834 *range = Range(RangeBoundary::FromConstant(0), | |
| 2835 RangeBoundary::FromConstant(kMaxUint32)); | |
|
Ivan Posva
2014/11/10 08:16:23
Would we ever be loading 8 bytes at a time on 64-b
zerny-google
2014/11/10 09:10:42
No. The current LoadCodeUnitsInstr will pack at mo
| |
| 2836 break; | |
| 2837 default: | |
| 2838 UNREACHABLE(); | |
| 2839 break; | |
| 2840 } | |
| 2841 } | |
| 2842 | |
| 2843 | |
| 2828 void IfThenElseInstr::InferRange(RangeAnalysis* analysis, Range* range) { | 2844 void IfThenElseInstr::InferRange(RangeAnalysis* analysis, Range* range) { |
| 2829 const intptr_t min = Utils::Minimum(if_true_, if_false_); | 2845 const intptr_t min = Utils::Minimum(if_true_, if_false_); |
| 2830 const intptr_t max = Utils::Maximum(if_true_, if_false_); | 2846 const intptr_t max = Utils::Maximum(if_true_, if_false_); |
| 2831 *range = Range(RangeBoundary::FromConstant(min), | 2847 *range = Range(RangeBoundary::FromConstant(min), |
| 2832 RangeBoundary::FromConstant(max)); | 2848 RangeBoundary::FromConstant(max)); |
| 2833 } | 2849 } |
| 2834 | 2850 |
| 2835 | 2851 |
| 2836 static RangeBoundary::RangeSize RepresentationToRangeSize(Representation r) { | 2852 static RangeBoundary::RangeSize RepresentationToRangeSize(Representation r) { |
| 2837 switch (r) { | 2853 switch (r) { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3027 } | 3043 } |
| 3028 } while (CanonicalizeMaxBoundary(&max) || | 3044 } while (CanonicalizeMaxBoundary(&max) || |
| 3029 CanonicalizeMinBoundary(&canonical_length)); | 3045 CanonicalizeMinBoundary(&canonical_length)); |
| 3030 | 3046 |
| 3031 // Failed to prove that maximum is bounded with array length. | 3047 // Failed to prove that maximum is bounded with array length. |
| 3032 return false; | 3048 return false; |
| 3033 } | 3049 } |
| 3034 | 3050 |
| 3035 | 3051 |
| 3036 } // namespace dart | 3052 } // namespace dart |
| OLD | NEW |