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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 11573044: Inline Doubles truncate and round. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 | « runtime/vm/disassembler_ia32.cc ('k') | 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 16975)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -1225,22 +1225,38 @@
return true;
}
- if ((recognized_kind == MethodRecognizer::kDoubleToInteger) &&
- (class_ids[0] == kDoubleCid)) {
- AddCheckClass(call, call->ArgumentAt(0)->value()->Copy());
- ASSERT(call->HasICData());
- const ICData& ic_data = *call->ic_data();
- Definition* d2i_instr = NULL;
- if (ic_data.deopt_reason() == kDeoptDoubleToSmi) {
- // Do not repeatedly deoptimize because result didn't fit into Smi.
- d2i_instr = new DoubleToIntegerInstr(call->ArgumentAt(0)->value(), call);
- } else {
- // Optimistically assume result fits into Smi.
- d2i_instr = new DoubleToSmiInstr(call->ArgumentAt(0)->value(), call);
+ if (class_ids[0] == kDoubleCid) {
+ if (recognized_kind == MethodRecognizer::kDoubleToInteger) {
+ AddCheckClass(call, call->ArgumentAt(0)->value()->Copy());
+ ASSERT(call->HasICData());
+ const ICData& ic_data = *call->ic_data();
+ Definition* d2i_instr = NULL;
+ if (ic_data.deopt_reason() == kDeoptDoubleToSmi) {
+ // Do not repeatedly deoptimize because result didn't fit into Smi.
+ d2i_instr = new DoubleToIntegerInstr(call->ArgumentAt(0)->value(),
+ call);
+ } else {
+ // Optimistically assume result fits into Smi.
+ d2i_instr = new DoubleToSmiInstr(call->ArgumentAt(0)->value(), call);
+ }
+ call->ReplaceWith(d2i_instr, current_iterator());
+ RemovePushArguments(call);
+ return true;
}
- call->ReplaceWith(d2i_instr, current_iterator());
- RemovePushArguments(call);
- return true;
+ if ((recognized_kind == MethodRecognizer::kDoubleTruncate) ||
+ (recognized_kind == MethodRecognizer::kDoubleRound)) {
+ if (!CPUFeatures::sse4_1_supported()) {
+ return false;
+ }
+ AddCheckClass(call, call->ArgumentAt(0)->value()->Copy());
+ DoubleToDoubleInstr* d2d_instr =
+ new DoubleToDoubleInstr(call->ArgumentAt(0)->value(),
+ call,
+ recognized_kind);
+ call->ReplaceWith(d2d_instr, current_iterator());
+ RemovePushArguments(call);
+ return true;
+ }
}
return false;
@@ -4191,6 +4207,12 @@
}
+void ConstantPropagator::VisitDoubleToDouble(DoubleToDoubleInstr* instr) {
+ // TODO(kmillikin): Handle conversion.
+ SetValue(instr, non_constant_);
+}
+
+
void ConstantPropagator::VisitConstant(ConstantInstr* instr) {
SetValue(instr, instr->value());
}
« no previous file with comments | « runtime/vm/disassembler_ia32.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698