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

Unified Diff: runtime/vm/flow_graph_optimizer.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
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 38317)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -2020,6 +2020,7 @@
switch (op_kind) {
case Token::kADD:
case Token::kSUB:
+ case Token::kMUL:
if (HasOnlyTwoOf(ic_data, kSmiCid)) {
// Don't generate smi code if the IC data is marked because
// of an overflow.
@@ -2037,28 +2038,28 @@
} else if (HasOnlyTwoOf(ic_data, kFloat32x4Cid)) {
operands_type = kFloat32x4Cid;
} else if (HasOnlyTwoOf(ic_data, kInt32x4Cid)) {
+ ASSERT(op_kind != Token::kMUL);
operands_type = kInt32x4Cid;
} else if (HasOnlyTwoOf(ic_data, kFloat64x2Cid)) {
operands_type = kFloat64x2Cid;
} else {
return false;
}
- break;
- case Token::kMUL:
- if (HasOnlyTwoOf(ic_data, kSmiCid)) {
- // Don't generate smi code if the IC data is marked because of an
- // overflow.
- // TODO(fschneider): Add unboxed mint multiplication.
- if (ic_data.HasDeoptReason(ICData::kDeoptBinarySmiOp)) return false;
- operands_type = kSmiCid;
- } else if (ShouldSpecializeForDouble(ic_data)) {
- operands_type = kDoubleCid;
- } else if (HasOnlyTwoOf(ic_data, kFloat32x4Cid)) {
- operands_type = kFloat32x4Cid;
- } else if (HasOnlyTwoOf(ic_data, kFloat64x2Cid)) {
- operands_type = kFloat64x2Cid;
- } else {
- return false;
+ // The binary mint multiplication only supports uint32 as inputs.
+ if ((operands_type == kMintCid) && (op_kind == Token::kMUL)) {
+ ASSERT(call->ArgumentCount() == 2);
+ Definition* left_input = call->ArgumentAt(0);
+ Definition* right_input = call->ArgumentAt(1);
+ ASSERT(left_input != NULL);
+ ASSERT(right_input != NULL);
+ Range* left_range = left_input->range();
+ Range* right_range = right_input->range();
+ if ((left_range == NULL) ||
Vyacheslav Egorov (Google) 2014/07/16 23:51:35 Unfortunately range information is not available a
regis 2014/07/18 02:44:57 You are right. I removed this range check.
+ !left_range->IsWithin(0, static_cast<int64_t>(kMaxUint32)) ||
+ (right_range == NULL) ||
+ !right_range->IsWithin(0, static_cast<int64_t>(kMaxUint32))) {
+ return false;
+ }
}
break;
case Token::kDIV:
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698