OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 <setjmp.h> // NOLINT | 5 #include <setjmp.h> // NOLINT |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #if defined(TARGET_ARCH_DBC) | 9 #if defined(TARGET_ARCH_DBC) |
10 | 10 |
(...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1821 } | 1821 } |
1822 | 1822 |
1823 { | 1823 { |
1824 BYTECODE(DSqrt, A_D); | 1824 BYTECODE(DSqrt, A_D); |
1825 const double value = bit_cast<double, RawObject*>(FP[rD]); | 1825 const double value = bit_cast<double, RawObject*>(FP[rD]); |
1826 FP[rA] = bit_cast<RawObject*, double>(sqrt(value)); | 1826 FP[rA] = bit_cast<RawObject*, double>(sqrt(value)); |
1827 DISPATCH(); | 1827 DISPATCH(); |
1828 } | 1828 } |
1829 | 1829 |
1830 { | 1830 { |
| 1831 BYTECODE(DSin, A_D); |
| 1832 const double value = bit_cast<double, RawObject*>(FP[rD]); |
| 1833 FP[rA] = bit_cast<RawObject*, double>(sin(value)); |
| 1834 DISPATCH(); |
| 1835 } |
| 1836 |
| 1837 { |
| 1838 BYTECODE(DCos, A_D); |
| 1839 const double value = bit_cast<double, RawObject*>(FP[rD]); |
| 1840 FP[rA] = bit_cast<RawObject*, double>(cos(value)); |
| 1841 DISPATCH(); |
| 1842 } |
| 1843 |
| 1844 { |
| 1845 BYTECODE(DPow, A_B_C); |
| 1846 const double lhs = bit_cast<double, RawObject*>(FP[rB]); |
| 1847 const double rhs = bit_cast<double, RawObject*>(FP[rC]); |
| 1848 const double result = pow(lhs, rhs); |
| 1849 FP[rA] = bit_cast<RawObject*, double>(result); |
| 1850 DISPATCH(); |
| 1851 } |
| 1852 |
| 1853 { |
| 1854 BYTECODE(DMod, A_B_C); |
| 1855 const double lhs = bit_cast<double, RawObject*>(FP[rB]); |
| 1856 const double rhs = bit_cast<double, RawObject*>(FP[rC]); |
| 1857 const double result = DartModulo(lhs, rhs); |
| 1858 FP[rA] = bit_cast<RawObject*, double>(result); |
| 1859 DISPATCH(); |
| 1860 } |
| 1861 |
| 1862 { |
1831 BYTECODE(DMin, A_B_C); | 1863 BYTECODE(DMin, A_B_C); |
1832 const double lhs = bit_cast<double, RawObject*>(FP[rB]); | 1864 const double lhs = bit_cast<double, RawObject*>(FP[rB]); |
1833 const double rhs = bit_cast<double, RawObject*>(FP[rC]); | 1865 const double rhs = bit_cast<double, RawObject*>(FP[rC]); |
1834 FP[rA] = bit_cast<RawObject*, double>(fmin(lhs, rhs)); | 1866 FP[rA] = bit_cast<RawObject*, double>(fmin(lhs, rhs)); |
1835 DISPATCH(); | 1867 DISPATCH(); |
1836 } | 1868 } |
1837 | 1869 |
1838 { | 1870 { |
1839 BYTECODE(DMax, A_B_C); | 1871 BYTECODE(DMax, A_B_C); |
1840 const double lhs = bit_cast<double, RawObject*>(FP[rB]); | 1872 const double lhs = bit_cast<double, RawObject*>(FP[rB]); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1903 DISPATCH(); | 1935 DISPATCH(); |
1904 } | 1936 } |
1905 | 1937 |
1906 { | 1938 { |
1907 BYTECODE(DSqrt, A_D); | 1939 BYTECODE(DSqrt, A_D); |
1908 UNREACHABLE(); | 1940 UNREACHABLE(); |
1909 DISPATCH(); | 1941 DISPATCH(); |
1910 } | 1942 } |
1911 | 1943 |
1912 { | 1944 { |
| 1945 BYTECODE(DSin, A_D); |
| 1946 UNREACHABLE(); |
| 1947 DISPATCH(); |
| 1948 } |
| 1949 |
| 1950 { |
| 1951 BYTECODE(DCos, A_D); |
| 1952 UNREACHABLE(); |
| 1953 DISPATCH(); |
| 1954 } |
| 1955 |
| 1956 { |
| 1957 BYTECODE(DPow, A_B_C); |
| 1958 UNREACHABLE(); |
| 1959 DISPATCH(); |
| 1960 } |
| 1961 |
| 1962 { |
| 1963 BYTECODE(DMod, A_B_C); |
| 1964 UNREACHABLE(); |
| 1965 DISPATCH(); |
| 1966 } |
| 1967 |
| 1968 { |
1913 BYTECODE(DMin, A_B_C); | 1969 BYTECODE(DMin, A_B_C); |
1914 UNREACHABLE(); | 1970 UNREACHABLE(); |
1915 DISPATCH(); | 1971 DISPATCH(); |
1916 } | 1972 } |
1917 | 1973 |
1918 { | 1974 { |
1919 BYTECODE(DMax, A_B_C); | 1975 BYTECODE(DMax, A_B_C); |
1920 UNREACHABLE(); | 1976 UNREACHABLE(); |
1921 DISPATCH(); | 1977 DISPATCH(); |
1922 } | 1978 } |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2693 BYTECODE(StoreIndexed, A_B_C); | 2749 BYTECODE(StoreIndexed, A_B_C); |
2694 RawArray* array = RAW_CAST(Array, FP[rA]); | 2750 RawArray* array = RAW_CAST(Array, FP[rA]); |
2695 RawSmi* index = RAW_CAST(Smi, FP[rB]); | 2751 RawSmi* index = RAW_CAST(Smi, FP[rB]); |
2696 RawObject* value = FP[rC]; | 2752 RawObject* value = FP[rC]; |
2697 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); | 2753 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
2698 array->StorePointer(array->ptr()->data() + Smi::Value(index), value); | 2754 array->StorePointer(array->ptr()->data() + Smi::Value(index), value); |
2699 DISPATCH(); | 2755 DISPATCH(); |
2700 } | 2756 } |
2701 | 2757 |
2702 { | 2758 { |
| 2759 BYTECODE(StoreFloat64Indexed, A_B_C); |
| 2760 ASSERT(RawObject::IsTypedDataClassId(FP[rA]->GetClassId())); |
| 2761 RawTypedData* array = reinterpret_cast<RawTypedData*>(FP[rA]); |
| 2762 RawSmi* index = RAW_CAST(Smi, FP[rB]); |
| 2763 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 2764 double* data = reinterpret_cast<double*>(array->ptr()->data()); |
| 2765 data[Smi::Value(index)] = bit_cast<double, RawObject*>(FP[rC]); |
| 2766 DISPATCH(); |
| 2767 } |
| 2768 |
| 2769 { |
2703 BYTECODE(LoadIndexed, A_B_C); | 2770 BYTECODE(LoadIndexed, A_B_C); |
2704 RawArray* array = RAW_CAST(Array, FP[rB]); | 2771 RawArray* array = RAW_CAST(Array, FP[rB]); |
2705 RawSmi* index = RAW_CAST(Smi, FP[rC]); | 2772 RawSmi* index = RAW_CAST(Smi, FP[rC]); |
2706 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); | 2773 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
2707 FP[rA] = array->ptr()->data()[Smi::Value(index)]; | 2774 FP[rA] = array->ptr()->data()[Smi::Value(index)]; |
2708 DISPATCH(); | 2775 DISPATCH(); |
2709 } | 2776 } |
2710 | 2777 |
2711 { | 2778 { |
| 2779 BYTECODE(LoadFloat64Indexed, A_B_C); |
| 2780 ASSERT(RawObject::IsTypedDataClassId(FP[rB]->GetClassId())); |
| 2781 RawTypedData* array = reinterpret_cast<RawTypedData*>(FP[rB]); |
| 2782 RawSmi* index = RAW_CAST(Smi, FP[rC]); |
| 2783 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 2784 double* data = reinterpret_cast<double*>(array->ptr()->data()); |
| 2785 FP[rA] = bit_cast<RawObject*, double>(data[Smi::Value(index)]); |
| 2786 DISPATCH(); |
| 2787 } |
| 2788 |
| 2789 { |
| 2790 BYTECODE(LoadOneByteStringIndexed, A_B_C); |
| 2791 RawOneByteString* array = RAW_CAST(OneByteString, FP[rB]); |
| 2792 RawSmi* index = RAW_CAST(Smi, FP[rC]); |
| 2793 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 2794 FP[rA] = Smi::New(array->ptr()->data()[Smi::Value(index)]); |
| 2795 DISPATCH(); |
| 2796 } |
| 2797 |
| 2798 { |
| 2799 BYTECODE(LoadTwoByteStringIndexed, A_B_C); |
| 2800 RawTwoByteString* array = RAW_CAST(TwoByteString, FP[rB]); |
| 2801 RawSmi* index = RAW_CAST(Smi, FP[rC]); |
| 2802 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 2803 FP[rA] = Smi::New(array->ptr()->data()[Smi::Value(index)]); |
| 2804 DISPATCH(); |
| 2805 } |
| 2806 |
| 2807 { |
2712 BYTECODE(Deopt, A_D); | 2808 BYTECODE(Deopt, A_D); |
2713 const bool is_lazy = rD == 0; | 2809 const bool is_lazy = rD == 0; |
2714 | 2810 |
2715 // Preserve result of the previous call. | 2811 // Preserve result of the previous call. |
2716 // TODO(vegorov) we could have actually included result into the | 2812 // TODO(vegorov) we could have actually included result into the |
2717 // deoptimization environment because it is passed through the stack. | 2813 // deoptimization environment because it is passed through the stack. |
2718 // If we do then we could remove special result handling from this code. | 2814 // If we do then we could remove special result handling from this code. |
2719 RawObject* result = SP[0]; | 2815 RawObject* result = SP[0]; |
2720 | 2816 |
2721 // When not preserving the result, we still need to preserve SP[0] as it | 2817 // When not preserving the result, we still need to preserve SP[0] as it |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2886 pc_ = pc; | 2982 pc_ = pc; |
2887 special_[kExceptionSpecialIndex] = raw_exception; | 2983 special_[kExceptionSpecialIndex] = raw_exception; |
2888 special_[kStacktraceSpecialIndex] = raw_stacktrace; | 2984 special_[kStacktraceSpecialIndex] = raw_stacktrace; |
2889 buf->Longjmp(); | 2985 buf->Longjmp(); |
2890 UNREACHABLE(); | 2986 UNREACHABLE(); |
2891 } | 2987 } |
2892 | 2988 |
2893 } // namespace dart | 2989 } // namespace dart |
2894 | 2990 |
2895 #endif // defined TARGET_ARCH_DBC | 2991 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |