Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(683)

Side by Side Diff: runtime/vm/intermediate_language.cc

Issue 23604024: Fix a compiler bug caused by Utils::IsPowerOfTwo treating zero as a power of two. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698