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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 22266005: Inline fsin/fcos. Huge speedup on Box2D. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 25800)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -2627,14 +2627,20 @@
}
}
-
void FlowGraphOptimizer::VisitStaticCall(StaticCallInstr* call) {
MethodRecognizer::Kind recognized_kind =
MethodRecognizer::RecognizeKind(call->function());
- if (recognized_kind == MethodRecognizer::kMathSqrt) {
- MathSqrtInstr* sqrt =
- new MathSqrtInstr(new Value(call->ArgumentAt(0)), call->deopt_id());
- ReplaceCall(call, sqrt);
+ if ((recognized_kind == MethodRecognizer::kMathSqrt) ||
+ (recognized_kind == MethodRecognizer::kMathSin) ||
+ (recognized_kind == MethodRecognizer::kMathCos)) {
+ if ((recognized_kind == MethodRecognizer::kMathSqrt) ||
+ FlowGraphCompiler::SupportsInlinedTrigonometrics()) {
+ MathUnaryInstr* math_unary =
+ new MathUnaryInstr(recognized_kind,
+ new Value(call->ArgumentAt(0)),
+ call->deopt_id());
+ ReplaceCall(call, math_unary);
+ }
} else if ((recognized_kind == MethodRecognizer::kFloat32x4Zero) ||
(recognized_kind == MethodRecognizer::kFloat32x4Splat) ||
(recognized_kind == MethodRecognizer::kFloat32x4Constructor)) {
@@ -6469,12 +6475,12 @@
}
-void ConstantPropagator::VisitMathSqrt(MathSqrtInstr* instr) {
+void ConstantPropagator::VisitMathUnary(MathUnaryInstr* instr) {
const Object& value = instr->value()->definition()->constant_value();
if (IsNonConstant(value)) {
SetValue(instr, non_constant_);
} else if (IsConstant(value)) {
- // TODO(kmillikin): Handle sqrt.
+ // TODO(kmillikin): Handle Math's unary operations (sqrt, cos, sin).
SetValue(instr, non_constant_);
}
}

Powered by Google App Engine
This is Rietveld 408576698