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

Unified Diff: runtime/vm/intermediate_language_x64.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
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_x64.cc
===================================================================
--- runtime/vm/intermediate_language_x64.cc (revision 25815)
+++ runtime/vm/intermediate_language_x64.cc (working copy)
@@ -3724,7 +3724,7 @@
}
-LocationSummary* MathSqrtInstr::MakeLocationSummary() const {
+LocationSummary* MathUnaryInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 1;
const intptr_t kNumTemps = 0;
LocationSummary* summary =
@@ -3735,8 +3735,27 @@
}
-void MathSqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- __ sqrtsd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg());
+void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ if (kind() == MethodRecognizer::kMathSqrt) {
+ __ sqrtsd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg());
+ } else if ((kind() == MethodRecognizer::kMathCos) ||
+ (kind() == MethodRecognizer::kMathSin)) {
+ __ pushq(RAX);
+ __ movsd(Address(RSP, 0), locs()->in(0).fpu_reg());
+ __ fldl(Address(RSP, 0));
+ if (kind() == MethodRecognizer::kMathSin) {
+ __ fsin();
+ } else {
+ ASSERT(kind() == MethodRecognizer::kMathCos);
+ __ fcos();
+ }
+ __ fstpl(Address(RSP, 0));
+ __ movsd(locs()->out().fpu_reg(), Address(RSP, 0));
+ __ addq(RSP, Immediate(kWordSize));
+ return;
+ } else {
+ UNREACHABLE();
+ }
}
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698