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/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/flow_graph_allocator.h" | 10 #include "vm/flow_graph_allocator.h" |
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 return overflow_; | 1119 return overflow_; |
1120 } | 1120 } |
1121 } | 1121 } |
1122 | 1122 |
1123 | 1123 |
1124 bool BinarySmiOpInstr::RightIsPowerOfTwoConstant() const { | 1124 bool BinarySmiOpInstr::RightIsPowerOfTwoConstant() const { |
1125 if (!right()->definition()->IsConstant()) return false; | 1125 if (!right()->definition()->IsConstant()) return false; |
1126 const Object& constant = right()->definition()->AsConstant()->value(); | 1126 const Object& constant = right()->definition()->AsConstant()->value(); |
1127 if (!constant.IsSmi()) return false; | 1127 if (!constant.IsSmi()) return false; |
1128 const intptr_t int_value = Smi::Cast(constant).Value(); | 1128 const intptr_t int_value = Smi::Cast(constant).Value(); |
1129 if (int_value == 0) return false; | |
1130 return Utils::IsPowerOfTwo(Utils::Abs(int_value)); | 1129 return Utils::IsPowerOfTwo(Utils::Abs(int_value)); |
1131 } | 1130 } |
1132 | 1131 |
1133 | 1132 |
1134 static bool ToIntegerConstant(Value* value, intptr_t* result) { | 1133 static bool ToIntegerConstant(Value* value, intptr_t* result) { |
1135 if (!value->BindsToConstant()) { | 1134 if (!value->BindsToConstant()) { |
1136 if (value->definition()->IsUnboxDouble()) { | 1135 if (value->definition()->IsUnboxDouble()) { |
1137 return ToIntegerConstant(value->definition()->AsUnboxDouble()->value(), | 1136 return ToIntegerConstant(value->definition()->AsUnboxDouble()->value(), |
1138 result); | 1137 result); |
1139 } | 1138 } |
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2641 default: | 2640 default: |
2642 UNREACHABLE(); | 2641 UNREACHABLE(); |
2643 } | 2642 } |
2644 return kPowRuntimeEntry; | 2643 return kPowRuntimeEntry; |
2645 } | 2644 } |
2646 | 2645 |
2647 | 2646 |
2648 #undef __ | 2647 #undef __ |
2649 | 2648 |
2650 } // namespace dart | 2649 } // namespace dart |
OLD | NEW |