Chromium Code Reviews| 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 "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 3835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3846 break; | 3846 break; |
| 3847 case Token::kSUB: | 3847 case Token::kSUB: |
| 3848 __ subpl(left, right); | 3848 __ subpl(left, right); |
| 3849 break; | 3849 break; |
| 3850 default: UNREACHABLE(); | 3850 default: UNREACHABLE(); |
| 3851 } | 3851 } |
| 3852 } | 3852 } |
| 3853 | 3853 |
| 3854 | 3854 |
| 3855 LocationSummary* MathUnaryInstr::MakeLocationSummary() const { | 3855 LocationSummary* MathUnaryInstr::MakeLocationSummary() const { |
| 3856 if ((kind() == MethodRecognizer::kMathSin) || | |
| 3857 (kind() == MethodRecognizer::kMathCos)) { | |
| 3858 // Calling convention on x64 uses XMM0 and XMM1 to pass the first two | |
| 3859 // double arguments and XMM0 to return the result. Unfortunately | |
| 3860 // currently we can't specify these registers because ParallelMoveResolver | |
| 3861 // assumes that XMM0 is free at all times. | |
| 3862 // TODO(vegorov): allow XMM0 to be used. | |
|
regis
2013/09/06 18:45:08
For the same reason, we use Q7 instead of Q0 as TM
| |
| 3863 const intptr_t kNumTemps = 0; | |
| 3864 LocationSummary* summary = | |
| 3865 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall); | |
| 3866 summary->set_in(0, Location::FpuRegisterLocation(XMM1)); | |
| 3867 summary->set_out(Location::FpuRegisterLocation(XMM1)); | |
| 3868 return summary; | |
| 3869 } | |
| 3856 const intptr_t kNumInputs = 1; | 3870 const intptr_t kNumInputs = 1; |
| 3857 const intptr_t kNumTemps = 0; | 3871 const intptr_t kNumTemps = 0; |
| 3858 LocationSummary* summary = | 3872 LocationSummary* summary = |
| 3859 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 3873 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3860 summary->set_in(0, Location::RequiresFpuRegister()); | 3874 summary->set_in(0, Location::RequiresFpuRegister()); |
| 3861 summary->set_out(Location::RequiresFpuRegister()); | 3875 summary->set_out(Location::RequiresFpuRegister()); |
| 3862 return summary; | 3876 return summary; |
| 3863 } | 3877 } |
| 3864 | 3878 |
| 3865 | 3879 |
| 3866 void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3880 void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3867 if (kind() == MethodRecognizer::kMathSqrt) { | 3881 if (kind() == MethodRecognizer::kMathSqrt) { |
| 3868 __ sqrtsd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg()); | 3882 __ sqrtsd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg()); |
| 3869 } else if ((kind() == MethodRecognizer::kMathCos) || | |
| 3870 (kind() == MethodRecognizer::kMathSin)) { | |
| 3871 __ pushq(RAX); | |
| 3872 __ movsd(Address(RSP, 0), locs()->in(0).fpu_reg()); | |
| 3873 __ fldl(Address(RSP, 0)); | |
| 3874 if (kind() == MethodRecognizer::kMathSin) { | |
| 3875 __ fsin(); | |
| 3876 } else { | |
| 3877 ASSERT(kind() == MethodRecognizer::kMathCos); | |
| 3878 __ fcos(); | |
| 3879 } | |
| 3880 __ fstpl(Address(RSP, 0)); | |
| 3881 __ movsd(locs()->out().fpu_reg(), Address(RSP, 0)); | |
| 3882 __ addq(RSP, Immediate(kWordSize)); | |
| 3883 return; | |
| 3884 } else { | 3883 } else { |
| 3885 UNREACHABLE(); | 3884 __ EnterFrame(0); |
| 3885 __ ReserveAlignedFrameSpace(0); | |
| 3886 __ movaps(XMM0, locs()->in(0).fpu_reg()); | |
| 3887 __ CallRuntime(TargetFunction(), InputCount()); | |
| 3888 __ movaps(locs()->out().fpu_reg(), XMM0); | |
| 3889 __ leave(); | |
| 3886 } | 3890 } |
| 3887 } | 3891 } |
| 3888 | 3892 |
| 3889 | 3893 |
| 3890 LocationSummary* UnarySmiOpInstr::MakeLocationSummary() const { | 3894 LocationSummary* UnarySmiOpInstr::MakeLocationSummary() const { |
| 3891 const intptr_t kNumInputs = 1; | 3895 const intptr_t kNumInputs = 1; |
| 3892 return LocationSummary::Make(kNumInputs, | 3896 return LocationSummary::Make(kNumInputs, |
| 3893 Location::SameAsFirstInput(), | 3897 Location::SameAsFirstInput(), |
| 3894 LocationSummary::kNoCall); | 3898 LocationSummary::kNoCall); |
| 3895 } | 3899 } |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4806 PcDescriptors::kOther, | 4810 PcDescriptors::kOther, |
| 4807 locs()); | 4811 locs()); |
| 4808 __ Drop(2); // Discard type arguments and receiver. | 4812 __ Drop(2); // Discard type arguments and receiver. |
| 4809 } | 4813 } |
| 4810 | 4814 |
| 4811 } // namespace dart | 4815 } // namespace dart |
| 4812 | 4816 |
| 4813 #undef __ | 4817 #undef __ |
| 4814 | 4818 |
| 4815 #endif // defined TARGET_ARCH_X64 | 4819 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |