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

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 180243013: Stop creating dummy call frames when calling out to C functions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 8536335243e75e43124693dfa6fb3bbc6aaba84b..7830fa1cf98d3fad57c1ecb9f330c9569eefdf2a 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -3981,13 +3981,15 @@ LocationSummary* MathUnaryInstr::MakeLocationSummary(bool opt) const {
if ((kind() == MethodRecognizer::kMathSin) ||
(kind() == MethodRecognizer::kMathCos)) {
const intptr_t kNumInputs = 1;
- const intptr_t kNumTemps = 0;
+ const intptr_t kNumTemps = 1;
LocationSummary* summary =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
summary->set_in(0, Location::FpuRegisterLocation(XMM1));
+ summary->set_temp(0, Location::RegisterLocation(CALLEE_SAVED));
regis 2014/02/26 23:53:12 CALLEE_SAVED -> EDI)); // Callee saved.
Cutch 2014/02/27 15:52:37 Done.
summary->set_out(Location::FpuRegisterLocation(XMM1));
return summary;
}
+ ASSERT(kind() == MethodRecognizer::kMathSqrt);
const intptr_t kNumInputs = 1;
const intptr_t kNumTemps = 0;
LocationSummary* summary =
@@ -4002,13 +4004,17 @@ void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
if (kind() == MethodRecognizer::kMathSqrt) {
__ sqrtsd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg());
} else {
- __ EnterFrame(0);
+ ASSERT((kind() == MethodRecognizer::kMathSin) ||
+ (kind() == MethodRecognizer::kMathCos));
+ // Save ESP.
+ __ movl(locs()->temp(0).reg(), ESP);
__ ReserveAlignedFrameSpace(kDoubleSize * InputCount());
__ movsd(Address(ESP, 0), locs()->in(0).fpu_reg());
__ CallRuntime(TargetFunction(), InputCount());
__ fstpl(Address(ESP, 0));
__ movsd(locs()->out().fpu_reg(), Address(ESP, 0));
- __ leave();
+ // Restore ESP.
+ __ movl(ESP, locs()->temp(0).reg());
}
}
@@ -4298,9 +4304,10 @@ void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(bool opt) const {
ASSERT((InputCount() == 1) || (InputCount() == 2));
- const intptr_t kNumTemps = 0;
+ const intptr_t kNumTemps = 1;
LocationSummary* result =
new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall);
+ result->set_temp(0, Location::RegisterLocation(CALLEE_SAVED));
result->set_in(0, Location::FpuRegisterLocation(XMM1));
if (InputCount() == 2) {
result->set_in(1, Location::FpuRegisterLocation(XMM2));
@@ -4315,7 +4322,8 @@ LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(bool opt) const {
void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- __ EnterFrame(0);
+ // Save ESP.
+ __ movl(locs()->temp(0).reg(), ESP);
__ ReserveAlignedFrameSpace(kDoubleSize * InputCount());
for (intptr_t i = 0; i < InputCount(); i++) {
__ movsd(Address(ESP, kDoubleSize * i), locs()->in(i).fpu_reg());
@@ -4363,7 +4371,8 @@ void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ fstpl(Address(ESP, 0));
__ movsd(locs()->out().fpu_reg(), Address(ESP, 0));
__ Bind(&skip_call);
- __ leave();
+ // Restore ESP.
+ __ movl(ESP, locs()->temp(0).reg());
}

Powered by Google App Engine
This is Rietveld 408576698