| 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/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 4837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4848 | 4848 |
| 4849 | 4849 |
| 4850 void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4850 void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4851 Register value = locs()->in(0).reg(); | 4851 Register value = locs()->in(0).reg(); |
| 4852 FpuRegister result = locs()->out(0).fpu_reg(); | 4852 FpuRegister result = locs()->out(0).fpu_reg(); |
| 4853 __ SmiUntag(value); | 4853 __ SmiUntag(value); |
| 4854 __ cvtsi2sd(result, value); | 4854 __ cvtsi2sd(result, value); |
| 4855 } | 4855 } |
| 4856 | 4856 |
| 4857 | 4857 |
| 4858 LocationSummary* MintToDoubleInstr::MakeLocationSummary(Isolate* isolate, |
| 4859 bool opt) const { |
| 4860 const intptr_t kNumInputs = 1; |
| 4861 const intptr_t kNumTemps = 0; |
| 4862 LocationSummary* result = new(isolate) LocationSummary( |
| 4863 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4864 result->set_in(0, Location::Pair(Location::RequiresRegister(), |
| 4865 Location::RequiresRegister())); |
| 4866 result->set_out(0, Location::RequiresFpuRegister()); |
| 4867 return result; |
| 4868 } |
| 4869 |
| 4870 |
| 4871 void MintToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4872 PairLocation* pair = locs()->in(0).AsPairLocation(); |
| 4873 Register in_lo = pair->At(0).reg(); |
| 4874 Register in_hi = pair->At(1).reg(); |
| 4875 |
| 4876 FpuRegister result = locs()->out(0).fpu_reg(); |
| 4877 |
| 4878 // Push hi. |
| 4879 __ pushl(in_hi); |
| 4880 // Push lo. |
| 4881 __ pushl(in_lo); |
| 4882 // Perform conversion from Mint to double. |
| 4883 __ fildl(Address(ESP, 0)); |
| 4884 // Pop FPU stack onto regular stack. |
| 4885 __ fstpl(Address(ESP, 0)); |
| 4886 // Copy into result. |
| 4887 __ movsd(result, Address(ESP, 0)); |
| 4888 // Pop args. |
| 4889 __ addl(ESP, Immediate(2 * kWordSize)); |
| 4890 } |
| 4891 |
| 4892 |
| 4858 LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Isolate* isolate, | 4893 LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Isolate* isolate, |
| 4859 bool opt) const { | 4894 bool opt) const { |
| 4860 const intptr_t kNumInputs = 1; | 4895 const intptr_t kNumInputs = 1; |
| 4861 const intptr_t kNumTemps = 0; | 4896 const intptr_t kNumTemps = 0; |
| 4862 LocationSummary* result = new(isolate) LocationSummary( | 4897 LocationSummary* result = new(isolate) LocationSummary( |
| 4863 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); | 4898 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 4864 result->set_in(0, Location::RegisterLocation(ECX)); | 4899 result->set_in(0, Location::RegisterLocation(ECX)); |
| 4865 result->set_out(0, Location::RegisterLocation(EAX)); | 4900 result->set_out(0, Location::RegisterLocation(EAX)); |
| 4866 return result; | 4901 return result; |
| 4867 } | 4902 } |
| (...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6745 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 6780 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
| 6746 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 6781 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
| 6747 #endif | 6782 #endif |
| 6748 } | 6783 } |
| 6749 | 6784 |
| 6750 } // namespace dart | 6785 } // namespace dart |
| 6751 | 6786 |
| 6752 #undef __ | 6787 #undef __ |
| 6753 | 6788 |
| 6754 #endif // defined TARGET_ARCH_IA32 | 6789 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |