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

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 22853009: For trigonometric functions call to C-libraries: they are faster than x87 operations (3% on Box2D). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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/intermediate_language_ia32.cc
===================================================================
--- runtime/vm/intermediate_language_ia32.cc (revision 27253)
+++ runtime/vm/intermediate_language_ia32.cc (working copy)
@@ -3827,6 +3827,16 @@
LocationSummary* MathUnaryInstr::MakeLocationSummary() const {
+ if ((kind() == MethodRecognizer::kMathSin) ||
+ (kind() == MethodRecognizer::kMathCos)) {
+ const intptr_t kNumInputs = 1;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* summary =
+ new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
+ summary->set_in(0, Location::FpuRegisterLocation(XMM1));
+ summary->set_out(Location::FpuRegisterLocation(XMM1));
+ return summary;
+ }
const intptr_t kNumInputs = 1;
const intptr_t kNumTemps = 0;
LocationSummary* summary =
@@ -3840,23 +3850,14 @@
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)) {
- __ pushl(EAX);
- __ pushl(EAX);
+ } else {
+ __ EnterFrame(0);
+ __ ReserveAlignedFrameSpace(kDoubleSize * InputCount());
__ movsd(Address(ESP, 0), locs()->in(0).fpu_reg());
- __ fldl(Address(ESP, 0));
- if (kind() == MethodRecognizer::kMathSin) {
- __ fsin();
- } else {
- ASSERT(kind() == MethodRecognizer::kMathCos);
- __ fcos();
- }
+ __ CallRuntime(TargetFunction(), InputCount());
__ fstpl(Address(ESP, 0));
__ movsd(locs()->out().fpu_reg(), Address(ESP, 0));
- __ addl(ESP, Immediate(2 * kWordSize));
- } else {
- UNREACHABLE();
+ __ leave();
}
}

Powered by Google App Engine
This is Rietveld 408576698