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

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 12703011: Optimize smi multiply by 2 using shl by 1. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | 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 20202)
+++ runtime/vm/intermediate_language_ia32.cc (working copy)
@@ -2209,7 +2209,11 @@
case Token::kMUL: {
// Keep left value tagged and untag right value.
const intptr_t value = Smi::Cast(constant).Value();
- __ imull(left, Immediate(value));
+ if (value == 2) {
bakster 2013/03/19 13:22:44 What about 4, 8, 16 etc?
Florian Schneider 2013/03/19 13:24:33 shl does not set the overflow flag for other than
bakster 2013/03/19 13:31:25 I guess you than can unroll into repeated shl(1) :
ahe 2013/03/19 14:13:11 What about a compare?
+ __ shll(left, Immediate(1));
+ } else {
+ __ imull(left, Immediate(value));
+ }
if (deopt != NULL) __ j(OVERFLOW, deopt);
break;
}
« no previous file with comments | « no previous file | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698