| OLD | NEW |
| 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 2384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2395 XmmRegister temp = locs()->temp(0).fpu_reg(); | 2395 XmmRegister temp = locs()->temp(0).fpu_reg(); |
| 2396 __ DoubleRound(result, value, temp); | 2396 __ DoubleRound(result, value, temp); |
| 2397 break; | 2397 break; |
| 2398 } | 2398 } |
| 2399 default: | 2399 default: |
| 2400 UNREACHABLE(); | 2400 UNREACHABLE(); |
| 2401 } | 2401 } |
| 2402 } | 2402 } |
| 2403 | 2403 |
| 2404 | 2404 |
| 2405 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary() const { | |
| 2406 // Calling convention on x64 uses XMM0 and XMM1 to pass the first two | |
| 2407 // double arguments and XMM0 to return the result. Unfortunately | |
| 2408 // currently we can't specify these registers because ParallelMoveResolver | |
| 2409 // assumes that XMM0 is free at all times. | |
| 2410 // TODO(vegorov): allow XMM0 to be used. | |
| 2411 ASSERT((InputCount() == 1) || (InputCount() == 2)); | |
| 2412 const intptr_t kNumTemps = 0; | |
| 2413 LocationSummary* result = | |
| 2414 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall); | |
| 2415 result->set_in(0, Location::FpuRegisterLocation(XMM1, Location::kDouble)); | |
| 2416 if (InputCount() == 2) { | |
| 2417 result->set_in(1, Location::FpuRegisterLocation(XMM2, Location::kDouble)); | |
| 2418 } | |
| 2419 result->set_out(Location::FpuRegisterLocation(XMM1, Location::kDouble)); | |
| 2420 return result; | |
| 2421 } | |
| 2422 | |
| 2423 | |
| 2424 void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 2425 ASSERT(locs()->in(0).fpu_reg() == XMM1); | |
| 2426 __ enter(Immediate(0)); | |
| 2427 __ ReserveAlignedFrameSpace(kDoubleSize * InputCount()); | |
| 2428 __ movaps(XMM0, locs()->in(0).fpu_reg()); | |
| 2429 if (InputCount() == 2) { | |
| 2430 ASSERT(locs()->in(1).fpu_reg() == XMM2); | |
| 2431 __ movaps(XMM1, locs()->in(1).fpu_reg()); | |
| 2432 } | |
| 2433 __ CallRuntime(TargetFunction()); | |
| 2434 __ movaps(locs()->out().fpu_reg(), XMM0); | |
| 2435 __ leave(); | |
| 2436 } | |
| 2437 | |
| 2438 | |
| 2439 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const { | 2405 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const { |
| 2440 return MakeCallSummary(); | 2406 return MakeCallSummary(); |
| 2441 } | 2407 } |
| 2442 | 2408 |
| 2443 | 2409 |
| 2444 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2410 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2445 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), | 2411 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), |
| 2446 kDeoptPolymorphicInstanceCallTestFail); | 2412 kDeoptPolymorphicInstanceCallTestFail); |
| 2447 if (ic_data().NumberOfChecks() == 0) { | 2413 if (ic_data().NumberOfChecks() == 0) { |
| 2448 __ jmp(deopt); | 2414 __ jmp(deopt); |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2979 PcDescriptors::kOther, | 2945 PcDescriptors::kOther, |
| 2980 locs()); | 2946 locs()); |
| 2981 __ Drop(2); // Discard type arguments and receiver. | 2947 __ Drop(2); // Discard type arguments and receiver. |
| 2982 } | 2948 } |
| 2983 | 2949 |
| 2984 } // namespace dart | 2950 } // namespace dart |
| 2985 | 2951 |
| 2986 #undef __ | 2952 #undef __ |
| 2987 | 2953 |
| 2988 #endif // defined TARGET_ARCH_X64 | 2954 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |