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

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
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_ia32.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/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 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 Range* right_range = this->right()->definition()->range(); 1370 Range* right_range = this->right()->definition()->range();
1371 return (right_range == NULL) 1371 return (right_range == NULL)
1372 || !right_range->IsWithin(0, RangeBoundary::kPlusInfinity); 1372 || !right_range->IsWithin(0, RangeBoundary::kPlusInfinity);
1373 } 1373 }
1374 default: 1374 default:
1375 return overflow_; 1375 return overflow_;
1376 } 1376 }
1377 } 1377 }
1378 1378
1379 1379
1380 bool BinarySmiOpInstr::RightIsPowerOfTwoConstant() const {
1381 if (!right()->definition()->IsConstant()) return false;
1382 const Object& constant = right()->definition()->AsConstant()->value();
1383 if (!constant.IsSmi()) return false;
1384 const intptr_t int_value = Smi::Cast(constant).Value();
1385 if (int_value == 0) return false;
1386 return Utils::IsPowerOfTwo(Utils::Abs(int_value));
1387 }
1388
1389
1380 RawAbstractType* BinaryMintOpInstr::CompileType() const { 1390 RawAbstractType* BinaryMintOpInstr::CompileType() const {
1381 return Type::IntType(); 1391 return Type::IntType();
1382 } 1392 }
1383 1393
1384 1394
1385 intptr_t BinaryMintOpInstr::ResultCid() const { 1395 intptr_t BinaryMintOpInstr::ResultCid() const {
1386 return kDynamicCid; 1396 return kDynamicCid;
1387 } 1397 }
1388 1398
1389 1399
(...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after
2840 default: 2850 default:
2841 UNREACHABLE(); 2851 UNREACHABLE();
2842 } 2852 }
2843 return kPowRuntimeEntry; 2853 return kPowRuntimeEntry;
2844 } 2854 }
2845 2855
2846 2856
2847 #undef __ 2857 #undef __
2848 2858
2849 } // namespace dart 2859 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698