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

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

Issue 11364222: Improve SHR by using range information for the shift count. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 | « no previous file | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 return (op_kind() == Token::kSHL) ? kDynamicCid : kSmiCid; 1320 return (op_kind() == Token::kSHL) ? kDynamicCid : kSmiCid;
1321 } 1321 }
1322 1322
1323 1323
1324 bool BinarySmiOpInstr::CanDeoptimize() const { 1324 bool BinarySmiOpInstr::CanDeoptimize() const {
1325 switch (op_kind()) { 1325 switch (op_kind()) {
1326 case Token::kBIT_AND: 1326 case Token::kBIT_AND:
1327 case Token::kBIT_OR: 1327 case Token::kBIT_OR:
1328 case Token::kBIT_XOR: 1328 case Token::kBIT_XOR:
1329 return false; 1329 return false;
1330 case Token::kSHR: {
1331 // Can't deopt if shift-count is known positive.
1332 Range* right_range = this->right()->definition()->range();
1333 return (right_range == NULL)
1334 || !right_range->IsWithin(0, RangeBoundary::kPlusInfinity);
1335 }
1330 default: 1336 default:
1331 return overflow_; 1337 return overflow_;
1332 } 1338 }
1333 } 1339 }
1334 1340
1335 1341
1336 RawAbstractType* BinaryMintOpInstr::CompileType() const { 1342 RawAbstractType* BinaryMintOpInstr::CompileType() const {
1337 return Type::IntType(); 1343 return Type::IntType();
1338 } 1344 }
1339 1345
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2496 Definition* left_defn = left()->definition(); 2502 Definition* left_defn = left()->definition();
2497 2503
2498 Range* left_range = left_defn->range(); 2504 Range* left_range = left_defn->range();
2499 Range* right_range = right()->definition()->range(); 2505 Range* right_range = right()->definition()->range();
2500 2506
2501 if ((left_range == NULL) || (right_range == NULL)) { 2507 if ((left_range == NULL) || (right_range == NULL)) {
2502 range_ = new Range(RangeBoundary::MinSmi(), RangeBoundary::MaxSmi()); 2508 range_ = new Range(RangeBoundary::MinSmi(), RangeBoundary::MaxSmi());
2503 return; 2509 return;
2504 } 2510 }
2505 2511
2506
2507 // If left is a l
2508 RangeBoundary left_min = 2512 RangeBoundary left_min =
2509 IsArrayLength(left_defn) ? 2513 IsArrayLength(left_defn) ?
2510 RangeBoundary::FromDefinition(left_defn) : left_range->min(); 2514 RangeBoundary::FromDefinition(left_defn) : left_range->min();
2511 2515
2512 RangeBoundary left_max = 2516 RangeBoundary left_max =
2513 IsArrayLength(left_defn) ? 2517 IsArrayLength(left_defn) ?
2514 RangeBoundary::FromDefinition(left_defn) : left_range->max(); 2518 RangeBoundary::FromDefinition(left_defn) : left_range->max();
2515 2519
2516 RangeBoundary min; 2520 RangeBoundary min;
2517 RangeBoundary max; 2521 RangeBoundary max;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2643 return Array::length_offset(); 2647 return Array::length_offset();
2644 default: 2648 default:
2645 UNREACHABLE(); 2649 UNREACHABLE();
2646 return -1; 2650 return -1;
2647 } 2651 }
2648 } 2652 }
2649 2653
2650 #undef __ 2654 #undef __
2651 2655
2652 } // namespace dart 2656 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698