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

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

Issue 12091100: Use SAR for positive divident by a power-of two constant divisor. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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
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/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/flow_graph_allocator.h" 9 #include "vm/flow_graph_allocator.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 Range* right_range = this->right()->definition()->range(); 1355 Range* right_range = this->right()->definition()->range();
1356 return (right_range == NULL) 1356 return (right_range == NULL)
1357 || !right_range->IsWithin(0, RangeBoundary::kPlusInfinity); 1357 || !right_range->IsWithin(0, RangeBoundary::kPlusInfinity);
1358 } 1358 }
1359 default: 1359 default:
1360 return overflow_; 1360 return overflow_;
1361 } 1361 }
1362 } 1362 }
1363 1363
1364 1364
1365 bool BinarySmiOpInstr::RightIsPowerOfTwoConstant() const {
1366 if (!right()->definition()->IsConstant()) return false;
1367 const Object& constant = right()->definition()->AsConstant()->value();
1368 if (!constant.IsSmi()) return false;
1369 const intptr_t int_value = Smi::Cast(constant).Value();
1370 return (int_value > 0) && Utils::IsPowerOfTwo(int_value);
1371 }
1372
1373
1365 RawAbstractType* BinaryMintOpInstr::CompileType() const { 1374 RawAbstractType* BinaryMintOpInstr::CompileType() const {
1366 return Type::IntType(); 1375 return Type::IntType();
1367 } 1376 }
1368 1377
1369 1378
1370 intptr_t BinaryMintOpInstr::ResultCid() const { 1379 intptr_t BinaryMintOpInstr::ResultCid() const {
1371 return kDynamicCid; 1380 return kDynamicCid;
1372 } 1381 }
1373 1382
1374 1383
(...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after
2769 default: 2778 default:
2770 UNREACHABLE(); 2779 UNREACHABLE();
2771 } 2780 }
2772 return kPowRuntimeEntry; 2781 return kPowRuntimeEntry;
2773 } 2782 }
2774 2783
2775 2784
2776 #undef __ 2785 #undef __
2777 2786
2778 } // namespace dart 2787 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698