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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 11363141: Improve smi shift operations and avoid repeated deoptimizations. (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/deopt_instructions.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('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 14704)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -681,9 +681,16 @@
case Token::kADD:
case Token::kSUB:
if (HasOnlyTwoSmis(ic_data)) {
- operands_type = kSmiCid;
+ // Don't generate smi code if the IC data is marked because
+ // of an overflow.
+ operands_type = (ic_data.deopt_reason() == kDeoptBinarySmiOp)
+ ? kMintCid
+ : kSmiCid;
} else if (HasTwoMintOrSmi(ic_data) &&
FlowGraphCompiler::SupportsUnboxedMints()) {
+ // Don't generate mint code if the IC data is marked because of an
+ // overflow.
+ if (ic_data.deopt_reason() == kDeoptBinaryMintOp) return false;
operands_type = kMintCid;
} else if (ShouldSpecializeForDouble(ic_data)) {
operands_type = kDoubleCid;
@@ -693,6 +700,10 @@
break;
case Token::kMUL:
if (HasOnlyTwoSmis(ic_data)) {
+ // Don't generate smi code if the IC data is marked because of an
+ // overflow.
+ // TODO(fschneider): Add unboxed mint multiplication.
+ if (ic_data.deopt_reason() == kDeoptBinarySmiOp) return false;
operands_type = kSmiCid;
} else if (ShouldSpecializeForDouble(ic_data)) {
operands_type = kDoubleCid;
@@ -719,8 +730,7 @@
case Token::kBIT_XOR:
if (HasOnlyTwoSmis(ic_data)) {
operands_type = kSmiCid;
- } else if (HasTwoMintOrSmi(ic_data) &&
- FlowGraphCompiler::SupportsUnboxedMints()) {
+ } else if (HasTwoMintOrSmi(ic_data)) {
operands_type = kMintCid;
} else {
return false;
@@ -729,11 +739,19 @@
case Token::kSHR:
case Token::kSHL:
if (HasOnlyTwoSmis(ic_data)) {
- operands_type = kSmiCid;
- } else if (FlowGraphCompiler::SupportsUnboxedMints() &&
- HasTwoMintOrSmi(ic_data) &&
+ // Left shift may overflow from smi into mint or big ints.
+ // Don't generate smi code if the IC data is marked because
+ // of an overflow.
+ if (ic_data.deopt_reason() == kDeoptShiftMintOp) return false;
+ operands_type = (ic_data.deopt_reason() == kDeoptBinarySmiOp)
+ ? kMintCid
+ : kSmiCid;
+ } else if (HasTwoMintOrSmi(ic_data) &&
HasOnlyOneSmi(ICData::Handle(
ic_data.AsUnaryClassChecksForArgNr(1)))) {
+ // Don't generate mint code if the IC data is marked because of an
+ // overflow.
+ if (ic_data.deopt_reason() == kDeoptShiftMintOp) return false;
// Check for smi/mint << smi or smi/mint >> smi.
operands_type = kMintCid;
} else {
@@ -742,6 +760,7 @@
break;
case Token::kTRUNCDIV:
if (HasOnlyTwoSmis(ic_data)) {
+ if (ic_data.deopt_reason() == kDeoptBinarySmiOp) return false;
operands_type = kSmiCid;
} else {
return false;
@@ -770,6 +789,7 @@
call->ReplaceWith(double_bin_op, current_iterator());
RemovePushArguments(call);
} else if (operands_type == kMintCid) {
+ if (!FlowGraphCompiler::SupportsUnboxedMints()) return false;
Value* left = call->ArgumentAt(0)->value();
Value* right = call->ArgumentAt(1)->value();
if ((op_kind == Token::kSHR) || (op_kind == Token::kSHL)) {
« no previous file with comments | « runtime/vm/deopt_instructions.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698