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/flow_graph_optimizer.cc

Issue 20198002: Optimize division for two Smi-s as well. Gives ~ 15% speedup on NavierStokes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | no next file » | 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 25470)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -1035,7 +1035,7 @@
}
break;
case Token::kDIV:
- if (ShouldSpecializeForDouble(ic_data)) {
+ if (ShouldSpecializeForDouble(ic_data) || HasOnlyTwoSmis(ic_data)) {
operands_type = kDoubleCid;
} else if (HasOnlyTwoFloat32x4s(ic_data)) {
operands_type = kFloat32x4Cid;
@@ -1102,13 +1102,16 @@
Definition* right = call->ArgumentAt(1);
if (operands_type == kDoubleCid) {
// Check that either left or right are not a smi. Result of a
- // binary operation with two smis is a smi not a double.
- InsertBefore(call,
- new CheckEitherNonSmiInstr(new Value(left),
- new Value(right),
- call->deopt_id()),
- call->env(),
- Definition::kEffect);
+ // binary operation with two smis is a smi not a double, except '/' which
+ // returns a double for two smis.
+ if (op_kind != Token::kDIV) {
+ InsertBefore(call,
+ new CheckEitherNonSmiInstr(new Value(left),
+ new Value(right),
+ call->deopt_id()),
+ call->env(),
+ Definition::kEffect);
+ }
BinaryDoubleOpInstr* double_bin_op =
new BinaryDoubleOpInstr(op_kind, new Value(left), new Value(right),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698