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

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 12050002: Introduce InvokeMathCFunction that can be used to directly invoke mathematical function provided by… (Closed) Base URL: https://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
Index: runtime/vm/intermediate_language_ia32.cc
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index c336720b8ce7e18fce225630dd80b9c7cd768641..6dda843b95d67e83cc8cda104b11aede9395171e 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -2426,6 +2426,33 @@ void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
+LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary() const {
+ ASSERT((InputCount() == 1) || (InputCount() == 2));
+ const intptr_t kNumTemps = 0;
+ LocationSummary* result =
+ new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall);
+ result->set_in(0, Location::FpuRegisterLocation(XMM1, Location::kDouble));
Florian Schneider 2013/01/21 16:31:26 Do you really need fixed locations here? You could
Vyacheslav Egorov (Google) 2013/01/21 16:50:08 Instruction is marked as a call to ensure that reg
+ if (InputCount() == 2) {
+ result->set_in(1, Location::FpuRegisterLocation(XMM2, Location::kDouble));
+ }
+ result->set_out(Location::FpuRegisterLocation(XMM1, Location::kDouble));
+ return result;
+}
+
+
+void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ __ enter(Immediate(0));
+ __ ReserveAlignedFrameSpace(kDoubleSize * InputCount());
+ for (intptr_t i = 0; i < InputCount(); i++) {
+ __ movsd(Address(ESP, -kDoubleSize * i), locs()->in(i).fpu_reg());
+ }
+ __ CallRuntime(TargetFunction());
+ __ fstpl(Address(ESP, 0));
+ __ movsd(locs()->out().fpu_reg(), Address(ESP, 0));
+ __ leave();
+}
+
+
LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const {
return MakeCallSummary();
}

Powered by Google App Engine
This is Rietveld 408576698