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

Unified Diff: runtime/vm/intermediate_language_arm.cc

Issue 396733006: Optimize the multiplication of two 32-bit unsigned integers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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
Index: runtime/vm/intermediate_language_arm.cc
===================================================================
--- runtime/vm/intermediate_language_arm.cc (revision 38266)
+++ runtime/vm/intermediate_language_arm.cc (working copy)
@@ -6130,9 +6130,26 @@
}
break;
}
- default:
- UNREACHABLE();
- break;
+ case Token::kMUL: {
+ // We only support the multiplication of two positive 32-bit integers
+ // resulting in a positive 64-bit integer fitting in a mint.
+ // We deopt in all other cases.
+ // This guarantees that the multiplication of 16-bit unsigned integers,
+ // as used in bignum arithmetic, will always succeed.
+ if (TargetCPUFeatures::arm_version() == ARMv7) {
+ __ orrs(out_hi, left_hi, Operand(right_hi));
+ __ b(deopt, NE);
+ __ smull(out_lo, out_hi, left_lo, right_lo);
+ if (can_overflow()) {
+ __ TestImmediate(out_hi, 0xC0000000);
+ __ b(deopt, NE);
+ }
+ } else {
+ __ b(deopt);
+ }
+ break;
+ }
+ default: UNREACHABLE();
}
if (FLAG_throw_on_javascript_int_overflow) {
EmitJavascriptIntOverflowCheck(compiler, deopt, out_lo, out_hi);

Powered by Google App Engine
This is Rietveld 408576698