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

Side by Side Diff: runtime/vm/intermediate_language_x64.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 2298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2309 XmmRegister temp = locs()->temp(0).fpu_reg(); 2309 XmmRegister temp = locs()->temp(0).fpu_reg();
2310 __ DoubleRound(result, value, temp); 2310 __ DoubleRound(result, value, temp);
2311 break; 2311 break;
2312 } 2312 }
2313 default: 2313 default:
2314 UNREACHABLE(); 2314 UNREACHABLE();
2315 } 2315 }
2316 } 2316 }
2317 2317
2318 2318
2319 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary() const {
2320 // Calling convention on x64 uses XMM0 and XMM1 to pass the first two
2321 // double arguments and XMM0 to return the result. Unfortunately
2322 // currently we can't specify these registers because ParallelMoveResolver
2323 // assumes that XMM0 is free at all times.
2324 // TODO(vegorov): allow XMM0 to be used.
2325 ASSERT((InputCount() == 1) || (InputCount() == 2));
2326 const intptr_t kNumTemps = 0;
2327 LocationSummary* result =
2328 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall);
2329 result->set_in(0, Location::FpuRegisterLocation(XMM1, Location::kDouble));
2330 if (InputCount() == 2) {
2331 result->set_in(1, Location::FpuRegisterLocation(XMM2, Location::kDouble));
2332 }
2333 result->set_out(Location::FpuRegisterLocation(XMM1, Location::kDouble));
2334 return result;
2335 }
2336
2337
2338 void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2339 ASSERT(locs()->in(0).fpu_reg() == XMM1);
2340 __ enter(Immediate(0));
2341 __ ReserveAlignedFrameSpace(kDoubleSize * InputCount());
2342 __ movaps(XMM0, locs()->in(0).fpu_reg());
2343 if (InputCount() == 2) {
2344 ASSERT(locs()->in(1).fpu_reg() == XMM2);
2345 __ movaps(XMM1, locs()->in(1).fpu_reg());
2346 }
2347 __ CallRuntime(TargetFunction());
2348 __ movaps(locs()->out().fpu_reg(), XMM0);
2349 __ leave();
2350 }
2351
2352
2319 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const { 2353 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const {
2320 return MakeCallSummary(); 2354 return MakeCallSummary();
2321 } 2355 }
2322 2356
2323 2357
2324 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2358 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2325 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), 2359 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
2326 kDeoptPolymorphicInstanceCallTestFail); 2360 kDeoptPolymorphicInstanceCallTestFail);
2327 if (ic_data().NumberOfChecks() == 0) { 2361 if (ic_data().NumberOfChecks() == 0) {
2328 __ jmp(deopt); 2362 __ jmp(deopt);
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
2859 PcDescriptors::kOther, 2893 PcDescriptors::kOther,
2860 locs()); 2894 locs());
2861 __ Drop(2); // Discard type arguments and receiver. 2895 __ Drop(2); // Discard type arguments and receiver.
2862 } 2896 }
2863 2897
2864 } // namespace dart 2898 } // namespace dart
2865 2899
2866 #undef __ 2900 #undef __
2867 2901
2868 #endif // defined TARGET_ARCH_X64 2902 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698