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

Side by Side 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 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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 2408 matching lines...) Expand 10 before | Expand all | Expand 10 after
2419 XmmRegister temp = locs()->temp(0).fpu_reg(); 2419 XmmRegister temp = locs()->temp(0).fpu_reg();
2420 __ DoubleRound(result, value, temp); 2420 __ DoubleRound(result, value, temp);
2421 break; 2421 break;
2422 } 2422 }
2423 default: 2423 default:
2424 UNREACHABLE(); 2424 UNREACHABLE();
2425 } 2425 }
2426 } 2426 }
2427 2427
2428 2428
2429 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary() const {
2430 ASSERT((InputCount() == 1) || (InputCount() == 2));
2431 const intptr_t kNumTemps = 0;
2432 LocationSummary* result =
2433 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall);
2434 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
2435 if (InputCount() == 2) {
2436 result->set_in(1, Location::FpuRegisterLocation(XMM2, Location::kDouble));
2437 }
2438 result->set_out(Location::FpuRegisterLocation(XMM1, Location::kDouble));
2439 return result;
2440 }
2441
2442
2443 void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2444 __ enter(Immediate(0));
2445 __ ReserveAlignedFrameSpace(kDoubleSize * InputCount());
2446 for (intptr_t i = 0; i < InputCount(); i++) {
2447 __ movsd(Address(ESP, -kDoubleSize * i), locs()->in(i).fpu_reg());
2448 }
2449 __ CallRuntime(TargetFunction());
2450 __ fstpl(Address(ESP, 0));
2451 __ movsd(locs()->out().fpu_reg(), Address(ESP, 0));
2452 __ leave();
2453 }
2454
2455
2429 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const { 2456 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const {
2430 return MakeCallSummary(); 2457 return MakeCallSummary();
2431 } 2458 }
2432 2459
2433 2460
2434 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2461 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2435 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), 2462 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
2436 kDeoptPolymorphicInstanceCallTestFail); 2463 kDeoptPolymorphicInstanceCallTestFail);
2437 if (ic_data().NumberOfChecks() == 0) { 2464 if (ic_data().NumberOfChecks() == 0) {
2438 __ jmp(deopt); 2465 __ jmp(deopt);
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
3215 PcDescriptors::kOther, 3242 PcDescriptors::kOther,
3216 locs()); 3243 locs());
3217 __ Drop(2); // Discard type arguments and receiver. 3244 __ Drop(2); // Discard type arguments and receiver.
3218 } 3245 }
3219 3246
3220 } // namespace dart 3247 } // namespace dart
3221 3248
3222 #undef __ 3249 #undef __
3223 3250
3224 #endif // defined TARGET_ARCH_IA32 3251 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698