| 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 3069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3080 max = | 3080 max = |
| 3081 RangeBoundary::Sub(Range::ConstantMax(left_range), | 3081 RangeBoundary::Sub(Range::ConstantMax(left_range), |
| 3082 Range::ConstantMin(right_range), | 3082 Range::ConstantMin(right_range), |
| 3083 RangeBoundary::PositiveInfinity()); | 3083 RangeBoundary::PositiveInfinity()); |
| 3084 } | 3084 } |
| 3085 break; | 3085 break; |
| 3086 | 3086 |
| 3087 case Token::kMUL: { | 3087 case Token::kMUL: { |
| 3088 const int64_t left_max = ConstantAbsMax(left_range); | 3088 const int64_t left_max = ConstantAbsMax(left_range); |
| 3089 const int64_t right_max = ConstantAbsMax(right_range); | 3089 const int64_t right_max = ConstantAbsMax(right_range); |
| 3090 if ((left_max < 0x7FFFFFFF) && (right_max < 0x7FFFFFFF)) { | 3090 ASSERT(left_max <= -kSmiMin); |
| 3091 ASSERT(right_max <= -kSmiMin); |
| 3092 if ((left_max == 0) || (right_max <= kMaxInt64 / left_max)) { |
| 3091 // Product of left and right max values stays in 64 bit range. | 3093 // Product of left and right max values stays in 64 bit range. |
| 3092 const int64_t result_max = left_max * right_max; | 3094 const int64_t result_max = left_max * right_max; |
| 3093 if (Smi::IsValid64(result_max) && Smi::IsValid64(-result_max)) { | 3095 if (Smi::IsValid64(result_max) && Smi::IsValid64(-result_max)) { |
| 3094 const intptr_t r_min = | 3096 const intptr_t r_min = |
| 3095 OnlyPositiveOrZero(left_range, right_range) ? 0 : -result_max; | 3097 OnlyPositiveOrZero(left_range, right_range) ? 0 : -result_max; |
| 3096 min = RangeBoundary::FromConstant(r_min); | 3098 min = RangeBoundary::FromConstant(r_min); |
| 3097 const intptr_t r_max = | 3099 const intptr_t r_max = |
| 3098 OnlyNegativeOrZero(left_range, right_range) ? 0 : result_max; | 3100 OnlyNegativeOrZero(left_range, right_range) ? 0 : result_max; |
| 3099 max = RangeBoundary::FromConstant(r_max); | 3101 max = RangeBoundary::FromConstant(r_max); |
| 3100 break; | 3102 break; |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3587 case Token::kTRUNCDIV: return 0; | 3589 case Token::kTRUNCDIV: return 0; |
| 3588 case Token::kMOD: return 1; | 3590 case Token::kMOD: return 1; |
| 3589 default: UNIMPLEMENTED(); return -1; | 3591 default: UNIMPLEMENTED(); return -1; |
| 3590 } | 3592 } |
| 3591 } | 3593 } |
| 3592 | 3594 |
| 3593 | 3595 |
| 3594 #undef __ | 3596 #undef __ |
| 3595 | 3597 |
| 3596 } // namespace dart | 3598 } // namespace dart |
| OLD | NEW |