OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
6 | 6 |
7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
8 #include "vm/bit_vector.h" | 8 #include "vm/bit_vector.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 2714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2725 ASSERT(value_boundary.IsConstant()); | 2725 ASSERT(value_boundary.IsConstant()); |
2726 ASSERT(shift_count >= 0); | 2726 ASSERT(shift_count >= 0); |
2727 int64_t limit = 64 - shift_count; | 2727 int64_t limit = 64 - shift_count; |
2728 int64_t value = static_cast<int64_t>(value_boundary.ConstantValue()); | 2728 int64_t value = static_cast<int64_t>(value_boundary.ConstantValue()); |
2729 | 2729 |
2730 if ((value == 0) || | 2730 if ((value == 0) || |
2731 (shift_count == 0) || | 2731 (shift_count == 0) || |
2732 ((limit > 0) && (Utils::IsInt(limit, value)))) { | 2732 ((limit > 0) && (Utils::IsInt(limit, value)))) { |
2733 // Result stays in 64 bit range. | 2733 // Result stays in 64 bit range. |
2734 int64_t result = value << shift_count; | 2734 int64_t result = value << shift_count; |
2735 return Smi::IsValid(result) ? RangeBoundary(result) : overflow; | 2735 return RangeBoundary(result); |
2736 } | 2736 } |
2737 | 2737 |
2738 return overflow; | 2738 return overflow; |
2739 } | 2739 } |
2740 | 2740 |
2741 | 2741 |
2742 static RangeBoundary CanonicalizeBoundary(const RangeBoundary& a, | 2742 static RangeBoundary CanonicalizeBoundary(const RangeBoundary& a, |
2743 const RangeBoundary& overflow) { | 2743 const RangeBoundary& overflow) { |
2744 if (a.IsConstant() || a.IsInfinity()) { | 2744 if (a.IsConstant() || a.IsInfinity()) { |
2745 return a; | 2745 return a; |
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4105 case Token::kTRUNCDIV: return 0; | 4105 case Token::kTRUNCDIV: return 0; |
4106 case Token::kMOD: return 1; | 4106 case Token::kMOD: return 1; |
4107 default: UNIMPLEMENTED(); return -1; | 4107 default: UNIMPLEMENTED(); return -1; |
4108 } | 4108 } |
4109 } | 4109 } |
4110 | 4110 |
4111 | 4111 |
4112 #undef __ | 4112 #undef __ |
4113 | 4113 |
4114 } // namespace dart | 4114 } // namespace dart |
OLD | NEW |