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

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

Issue 321943005: Fix bug with range of shift operations. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 | « no previous file | 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/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 return true; 1226 return true;
1227 } 1227 }
1228 switch (op_kind()) { 1228 switch (op_kind()) {
1229 case Token::kBIT_AND: 1229 case Token::kBIT_AND:
1230 case Token::kBIT_OR: 1230 case Token::kBIT_OR:
1231 case Token::kBIT_XOR: 1231 case Token::kBIT_XOR:
1232 return false; 1232 return false;
1233 case Token::kSHR: { 1233 case Token::kSHR: {
1234 // Can't deopt if shift-count is known positive. 1234 // Can't deopt if shift-count is known positive.
1235 Range* right_range = this->right()->definition()->range(); 1235 Range* right_range = this->right()->definition()->range();
1236 return (right_range == NULL) || right_range->IsNegative(); 1236 return (right_range == NULL) || !right_range->IsPositive();
1237 } 1237 }
1238 case Token::kSHL: { 1238 case Token::kSHL: {
1239 Range* right_range = this->right()->definition()->range(); 1239 Range* right_range = this->right()->definition()->range();
1240 if ((right_range != NULL) && is_truncating()) { 1240 if ((right_range != NULL) && is_truncating()) {
1241 // Can deoptimize if right can be negative. 1241 // Can deoptimize if right can be negative.
1242 return right_range->IsNegative(); 1242 return !right_range->IsPositive();
1243 } 1243 }
1244 return true; 1244 return true;
1245 } 1245 }
1246 case Token::kMOD: { 1246 case Token::kMOD: {
1247 Range* right_range = this->right()->definition()->range(); 1247 Range* right_range = this->right()->definition()->range();
1248 return (right_range == NULL) || right_range->Overlaps(0, 0); 1248 return (right_range == NULL) || right_range->Overlaps(0, 0);
1249 } 1249 }
1250 default: 1250 default:
1251 return overflow_; 1251 return overflow_;
1252 } 1252 }
(...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after
3560 case Token::kTRUNCDIV: return 0; 3560 case Token::kTRUNCDIV: return 0;
3561 case Token::kMOD: return 1; 3561 case Token::kMOD: return 1;
3562 default: UNIMPLEMENTED(); return -1; 3562 default: UNIMPLEMENTED(); return -1;
3563 } 3563 }
3564 } 3564 }
3565 3565
3566 3566
3567 #undef __ 3567 #undef __
3568 3568
3569 } // namespace dart 3569 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698