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

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

Powered by Google App Engine
This is Rietveld 408576698