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

Unified Diff: runtime/vm/intermediate_language_x64.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_x64.cc
===================================================================
--- runtime/vm/intermediate_language_x64.cc (revision 14856)
+++ runtime/vm/intermediate_language_x64.cc (working copy)
@@ -1760,16 +1760,22 @@
break;
}
case Token::kSHR: {
+ if (CanDeoptimize()) {
+ __ cmpq(right, Immediate(0));
+ __ j(LESS, deopt);
+ }
+ __ SmiUntag(right);
// sarq operation masks the count to 6 bits.
- const Immediate kCountLimit = Immediate(0x3F);
- __ cmpq(right, Immediate(0));
- __ j(LESS, deopt);
- __ SmiUntag(right);
- __ cmpq(right, kCountLimit);
- Label count_ok;
- __ j(LESS, &count_ok, Assembler::kNearJump);
- __ movq(right, kCountLimit);
- __ Bind(&count_ok);
+ const intptr_t kCountLimit = 0x3F;
+ Range* right_range = this->right()->definition()->range();
+ if ((right_range == NULL) ||
+ !right_range->IsWithin(RangeBoundary::kMinusInfinity, kCountLimit)) {
+ __ cmpq(right, Immediate(kCountLimit));
+ Label count_ok;
+ __ j(LESS, &count_ok, Assembler::kNearJump);
+ __ movq(right, Immediate(kCountLimit));
+ __ Bind(&count_ok);
+ }
ASSERT(right == RCX); // Count must be in RCX
__ SmiUntag(left);
__ sarq(left, right);
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698