| 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_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 "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 4886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4897 case Token::kSUB: | 4897 case Token::kSUB: |
| 4898 __ subpl(left, right); | 4898 __ subpl(left, right); |
| 4899 break; | 4899 break; |
| 4900 default: UNREACHABLE(); | 4900 default: UNREACHABLE(); |
| 4901 } | 4901 } |
| 4902 } | 4902 } |
| 4903 | 4903 |
| 4904 | 4904 |
| 4905 LocationSummary* MathUnaryInstr::MakeLocationSummary(Zone* zone, | 4905 LocationSummary* MathUnaryInstr::MakeLocationSummary(Zone* zone, |
| 4906 bool opt) const { | 4906 bool opt) const { |
| 4907 if ((kind() == MathUnaryInstr::kSin) || (kind() == MathUnaryInstr::kCos)) { | |
| 4908 const intptr_t kNumInputs = 1; | |
| 4909 const intptr_t kNumTemps = 1; | |
| 4910 LocationSummary* summary = new(zone) LocationSummary( | |
| 4911 zone, kNumInputs, kNumTemps, LocationSummary::kCall); | |
| 4912 summary->set_in(0, Location::FpuRegisterLocation(XMM1)); | |
| 4913 // EDI is chosen because it is callee saved so we do not need to back it | |
| 4914 // up before calling into the runtime. | |
| 4915 summary->set_temp(0, Location::RegisterLocation(EDI)); | |
| 4916 summary->set_out(0, Location::FpuRegisterLocation(XMM1)); | |
| 4917 return summary; | |
| 4918 } | |
| 4919 ASSERT((kind() == MathUnaryInstr::kSqrt) || | 4907 ASSERT((kind() == MathUnaryInstr::kSqrt) || |
| 4920 (kind() == MathUnaryInstr::kDoubleSquare)); | 4908 (kind() == MathUnaryInstr::kDoubleSquare)); |
| 4921 const intptr_t kNumInputs = 1; | 4909 const intptr_t kNumInputs = 1; |
| 4922 const intptr_t kNumTemps = 0; | 4910 const intptr_t kNumTemps = 0; |
| 4923 LocationSummary* summary = new(zone) LocationSummary( | 4911 LocationSummary* summary = new(zone) LocationSummary( |
| 4924 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4912 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4925 summary->set_in(0, Location::RequiresFpuRegister()); | 4913 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4926 if (kind() == MathUnaryInstr::kDoubleSquare) { | 4914 if (kind() == MathUnaryInstr::kDoubleSquare) { |
| 4927 summary->set_out(0, Location::SameAsFirstInput()); | 4915 summary->set_out(0, Location::SameAsFirstInput()); |
| 4928 } else { | 4916 } else { |
| 4929 summary->set_out(0, Location::RequiresFpuRegister()); | 4917 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4930 } | 4918 } |
| 4931 return summary; | 4919 return summary; |
| 4932 } | 4920 } |
| 4933 | 4921 |
| 4934 | 4922 |
| 4935 void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4923 void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4936 if (kind() == MathUnaryInstr::kSqrt) { | 4924 if (kind() == MathUnaryInstr::kSqrt) { |
| 4937 __ sqrtsd(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg()); | 4925 __ sqrtsd(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg()); |
| 4938 } else if (kind() == MathUnaryInstr::kDoubleSquare) { | 4926 } else if (kind() == MathUnaryInstr::kDoubleSquare) { |
| 4939 XmmRegister value_reg = locs()->in(0).fpu_reg(); | 4927 XmmRegister value_reg = locs()->in(0).fpu_reg(); |
| 4940 __ mulsd(value_reg, value_reg); | 4928 __ mulsd(value_reg, value_reg); |
| 4941 ASSERT(value_reg == locs()->out(0).fpu_reg()); | 4929 ASSERT(value_reg == locs()->out(0).fpu_reg()); |
| 4942 } else { | 4930 } else { |
| 4943 ASSERT((kind() == MathUnaryInstr::kSin) || | 4931 UNREACHABLE(); |
| 4944 (kind() == MathUnaryInstr::kCos)); | |
| 4945 // Save ESP. | |
| 4946 __ movl(locs()->temp(0).reg(), ESP); | |
| 4947 __ ReserveAlignedFrameSpace(kDoubleSize * InputCount()); | |
| 4948 __ movsd(Address(ESP, 0), locs()->in(0).fpu_reg()); | |
| 4949 __ CallRuntime(TargetFunction(), InputCount()); | |
| 4950 __ fstpl(Address(ESP, 0)); | |
| 4951 __ movsd(locs()->out(0).fpu_reg(), Address(ESP, 0)); | |
| 4952 // Restore ESP. | |
| 4953 __ movl(ESP, locs()->temp(0).reg()); | |
| 4954 } | 4932 } |
| 4955 } | 4933 } |
| 4956 | 4934 |
| 4957 | 4935 |
| 4958 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( | 4936 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( |
| 4959 Zone* zone, bool opt) const { | 4937 Zone* zone, bool opt) const { |
| 4960 const intptr_t kNumTemps = 0; | 4938 const intptr_t kNumTemps = 0; |
| 4961 LocationSummary* summary = new(zone) LocationSummary( | 4939 LocationSummary* summary = new(zone) LocationSummary( |
| 4962 zone, InputCount(), kNumTemps, LocationSummary::kCall); | 4940 zone, InputCount(), kNumTemps, LocationSummary::kCall); |
| 4963 summary->set_in(0, Location::RegisterLocation(EAX)); | 4941 summary->set_in(0, Location::RegisterLocation(EAX)); |
| (...skipping 1929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6893 __ Drop(1); | 6871 __ Drop(1); |
| 6894 __ popl(result); | 6872 __ popl(result); |
| 6895 } | 6873 } |
| 6896 | 6874 |
| 6897 | 6875 |
| 6898 } // namespace dart | 6876 } // namespace dart |
| 6899 | 6877 |
| 6900 #undef __ | 6878 #undef __ |
| 6901 | 6879 |
| 6902 #endif // defined TARGET_ARCH_IA32 | 6880 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |