| 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 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1923 | 1923 |
| 1924 { | 1924 { |
| 1925 BYTECODE(DMax, A_B_C); | 1925 BYTECODE(DMax, A_B_C); |
| 1926 const double lhs = bit_cast<double, RawObject*>(FP[rB]); | 1926 const double lhs = bit_cast<double, RawObject*>(FP[rB]); |
| 1927 const double rhs = bit_cast<double, RawObject*>(FP[rC]); | 1927 const double rhs = bit_cast<double, RawObject*>(FP[rC]); |
| 1928 FP[rA] = bit_cast<RawObject*, double>(fmax(lhs, rhs)); | 1928 FP[rA] = bit_cast<RawObject*, double>(fmax(lhs, rhs)); |
| 1929 DISPATCH(); | 1929 DISPATCH(); |
| 1930 } | 1930 } |
| 1931 | 1931 |
| 1932 { | 1932 { |
| 1933 BYTECODE(LoadFloat64Indexed, A_B_C); | 1933 BYTECODE(LoadIndexedFloat64, A_B_C); |
| 1934 ASSERT(RawObject::IsTypedDataClassId(FP[rB]->GetClassId())); | 1934 ASSERT(RawObject::IsTypedDataClassId(FP[rB]->GetClassId())); |
| 1935 RawTypedData* array = reinterpret_cast<RawTypedData*>(FP[rB]); | 1935 RawTypedData* array = reinterpret_cast<RawTypedData*>(FP[rB]); |
| 1936 RawSmi* index = RAW_CAST(Smi, FP[rC]); | 1936 RawSmi* index = RAW_CAST(Smi, FP[rC]); |
| 1937 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); | 1937 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 1938 double* data = reinterpret_cast<double*>(array->ptr()->data()); | 1938 double* data = reinterpret_cast<double*>(array->ptr()->data()); |
| 1939 FP[rA] = bit_cast<RawObject*, double>(data[Smi::Value(index)]); | 1939 FP[rA] = bit_cast<RawObject*, double>(data[Smi::Value(index)]); |
| 1940 DISPATCH(); | 1940 DISPATCH(); |
| 1941 } | 1941 } |
| 1942 | 1942 |
| 1943 { | 1943 { |
| 1944 BYTECODE(StoreFloat64Indexed, A_B_C); | 1944 BYTECODE(StoreIndexedFloat64, A_B_C); |
| 1945 ASSERT(RawObject::IsTypedDataClassId(FP[rA]->GetClassId())); | 1945 ASSERT(RawObject::IsTypedDataClassId(FP[rA]->GetClassId())); |
| 1946 RawTypedData* array = reinterpret_cast<RawTypedData*>(FP[rA]); | 1946 RawTypedData* array = reinterpret_cast<RawTypedData*>(FP[rA]); |
| 1947 RawSmi* index = RAW_CAST(Smi, FP[rB]); | 1947 RawSmi* index = RAW_CAST(Smi, FP[rB]); |
| 1948 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); | 1948 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 1949 double* data = reinterpret_cast<double*>(array->ptr()->data()); | 1949 double* data = reinterpret_cast<double*>(array->ptr()->data()); |
| 1950 data[Smi::Value(index)] = bit_cast<double, RawObject*>(FP[rC]); | 1950 data[Smi::Value(index)] = bit_cast<double, RawObject*>(FP[rC]); |
| 1951 DISPATCH(); | 1951 DISPATCH(); |
| 1952 } | 1952 } |
| 1953 #else // defined(ARCH_IS_64_BIT) | 1953 #else // defined(ARCH_IS_64_BIT) |
| 1954 { | 1954 { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2047 DISPATCH(); | 2047 DISPATCH(); |
| 2048 } | 2048 } |
| 2049 | 2049 |
| 2050 { | 2050 { |
| 2051 BYTECODE(DMax, A_B_C); | 2051 BYTECODE(DMax, A_B_C); |
| 2052 UNREACHABLE(); | 2052 UNREACHABLE(); |
| 2053 DISPATCH(); | 2053 DISPATCH(); |
| 2054 } | 2054 } |
| 2055 | 2055 |
| 2056 { | 2056 { |
| 2057 BYTECODE(LoadFloat64Indexed, A_B_C); | 2057 BYTECODE(LoadIndexedFloat64, A_B_C); |
| 2058 UNREACHABLE(); | 2058 UNREACHABLE(); |
| 2059 DISPATCH(); | 2059 DISPATCH(); |
| 2060 } | 2060 } |
| 2061 | 2061 |
| 2062 { | 2062 { |
| 2063 BYTECODE(StoreFloat64Indexed, A_B_C); | 2063 BYTECODE(StoreIndexedFloat64, A_B_C); |
| 2064 UNREACHABLE(); | 2064 UNREACHABLE(); |
| 2065 DISPATCH(); | 2065 DISPATCH(); |
| 2066 } | 2066 } |
| 2067 #endif // defined(ARCH_IS_64_BIT) | 2067 #endif // defined(ARCH_IS_64_BIT) |
| 2068 | 2068 |
| 2069 // Return and return like instructions (Instrinsic). | 2069 // Return and return like instructions (Instrinsic). |
| 2070 { | 2070 { |
| 2071 RawObject* result; // result to return to the caller. | 2071 RawObject* result; // result to return to the caller. |
| 2072 | 2072 |
| 2073 BYTECODE(Intrinsic, A); | 2073 BYTECODE(Intrinsic, A); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2159 { | 2159 { |
| 2160 BYTECODE(LoadField, A_B_C); | 2160 BYTECODE(LoadField, A_B_C); |
| 2161 const uint16_t instance_reg = rB; | 2161 const uint16_t instance_reg = rB; |
| 2162 const uint16_t offset_in_words = rC; | 2162 const uint16_t offset_in_words = rC; |
| 2163 RawInstance* instance = reinterpret_cast<RawInstance*>(FP[instance_reg]); | 2163 RawInstance* instance = reinterpret_cast<RawInstance*>(FP[instance_reg]); |
| 2164 FP[rA] = reinterpret_cast<RawObject**>(instance->ptr())[offset_in_words]; | 2164 FP[rA] = reinterpret_cast<RawObject**>(instance->ptr())[offset_in_words]; |
| 2165 DISPATCH(); | 2165 DISPATCH(); |
| 2166 } | 2166 } |
| 2167 | 2167 |
| 2168 { | 2168 { |
| 2169 BYTECODE(LoadUntagged, A_B_C); |
| 2170 const uint16_t instance_reg = rB; |
| 2171 const uint16_t offset_in_words = rC; |
| 2172 RawInstance* instance = reinterpret_cast<RawInstance*>(FP[instance_reg]); |
| 2173 FP[rA] = reinterpret_cast<RawObject**>(instance)[offset_in_words]; |
| 2174 DISPATCH(); |
| 2175 } |
| 2176 |
| 2177 { |
| 2169 BYTECODE(LoadFieldTOS, A_D); | 2178 BYTECODE(LoadFieldTOS, A_D); |
| 2170 const uint16_t offset_in_words = rD; | 2179 const uint16_t offset_in_words = rD; |
| 2171 RawInstance* instance = static_cast<RawInstance*>(SP[0]); | 2180 RawInstance* instance = static_cast<RawInstance*>(SP[0]); |
| 2172 SP[0] = reinterpret_cast<RawObject**>(instance->ptr())[offset_in_words]; | 2181 SP[0] = reinterpret_cast<RawObject**>(instance->ptr())[offset_in_words]; |
| 2173 DISPATCH(); | 2182 DISPATCH(); |
| 2174 } | 2183 } |
| 2175 | 2184 |
| 2176 { | 2185 { |
| 2177 BYTECODE(InitStaticTOS, A); | 2186 BYTECODE(InitStaticTOS, A); |
| 2178 RawField* field = static_cast<RawField*>(*SP--); | 2187 RawField* field = static_cast<RawField*>(*SP--); |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2837 BYTECODE(StoreIndexed, A_B_C); | 2846 BYTECODE(StoreIndexed, A_B_C); |
| 2838 RawArray* array = RAW_CAST(Array, FP[rA]); | 2847 RawArray* array = RAW_CAST(Array, FP[rA]); |
| 2839 RawSmi* index = RAW_CAST(Smi, FP[rB]); | 2848 RawSmi* index = RAW_CAST(Smi, FP[rB]); |
| 2840 RawObject* value = FP[rC]; | 2849 RawObject* value = FP[rC]; |
| 2841 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); | 2850 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 2842 array->StorePointer(array->ptr()->data() + Smi::Value(index), value); | 2851 array->StorePointer(array->ptr()->data() + Smi::Value(index), value); |
| 2843 DISPATCH(); | 2852 DISPATCH(); |
| 2844 } | 2853 } |
| 2845 | 2854 |
| 2846 { | 2855 { |
| 2856 BYTECODE(StoreIndexedUint8, A_B_C); |
| 2857 ASSERT(RawObject::IsTypedDataClassId(FP[rA]->GetClassId())); |
| 2858 RawTypedData* array = reinterpret_cast<RawTypedData*>(FP[rA]); |
| 2859 RawSmi* index = RAW_CAST(Smi, FP[rB]); |
| 2860 RawSmi* value = RAW_CAST(Smi, FP[rC]); |
| 2861 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 2862 uint8_t* data = reinterpret_cast<uint8_t*>(array->ptr()->data()); |
| 2863 data[Smi::Value(index)] = static_cast<uint8_t>(Smi::Value(value)); |
| 2864 DISPATCH(); |
| 2865 } |
| 2866 |
| 2867 { |
| 2868 BYTECODE(StoreIndexedExternalUint8, A_B_C); |
| 2869 uint8_t* array = reinterpret_cast<uint8_t*>(FP[rA]); |
| 2870 RawSmi* index = RAW_CAST(Smi, FP[rB]); |
| 2871 RawSmi* value = RAW_CAST(Smi, FP[rC]); |
| 2872 array[Smi::Value(index)] = static_cast<uint8_t>(Smi::Value(value)); |
| 2873 DISPATCH(); |
| 2874 } |
| 2875 |
| 2876 { |
| 2847 BYTECODE(LoadIndexed, A_B_C); | 2877 BYTECODE(LoadIndexed, A_B_C); |
| 2848 RawArray* array = RAW_CAST(Array, FP[rB]); | 2878 RawArray* array = RAW_CAST(Array, FP[rB]); |
| 2849 RawSmi* index = RAW_CAST(Smi, FP[rC]); | 2879 RawSmi* index = RAW_CAST(Smi, FP[rC]); |
| 2850 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); | 2880 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 2851 FP[rA] = array->ptr()->data()[Smi::Value(index)]; | 2881 FP[rA] = array->ptr()->data()[Smi::Value(index)]; |
| 2852 DISPATCH(); | 2882 DISPATCH(); |
| 2853 } | 2883 } |
| 2854 | 2884 |
| 2855 { | 2885 { |
| 2856 BYTECODE(LoadOneByteStringIndexed, A_B_C); | 2886 BYTECODE(LoadIndexedUint8, A_B_C); |
| 2887 ASSERT(RawObject::IsTypedDataClassId(FP[rB]->GetClassId())); |
| 2888 RawTypedData* array = reinterpret_cast<RawTypedData*>(FP[rB]); |
| 2889 RawSmi* index = RAW_CAST(Smi, FP[rC]); |
| 2890 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 2891 uint8_t* data = reinterpret_cast<uint8_t*>(array->ptr()->data()); |
| 2892 FP[rA] = Smi::New(data[Smi::Value(index)]); |
| 2893 DISPATCH(); |
| 2894 } |
| 2895 |
| 2896 { |
| 2897 BYTECODE(LoadIndexedInt8, A_B_C); |
| 2898 ASSERT(RawObject::IsTypedDataClassId(FP[rB]->GetClassId())); |
| 2899 RawTypedData* array = reinterpret_cast<RawTypedData*>(FP[rB]); |
| 2900 RawSmi* index = RAW_CAST(Smi, FP[rC]); |
| 2901 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 2902 int8_t* data = reinterpret_cast<int8_t*>(array->ptr()->data()); |
| 2903 FP[rA] = Smi::New(data[Smi::Value(index)]); |
| 2904 DISPATCH(); |
| 2905 } |
| 2906 |
| 2907 { |
| 2908 BYTECODE(LoadIndexedExternalUint8, A_B_C); |
| 2909 uint8_t* data = reinterpret_cast<uint8_t*>(FP[rB]); |
| 2910 RawSmi* index = RAW_CAST(Smi, FP[rC]); |
| 2911 FP[rA] = Smi::New(data[Smi::Value(index)]); |
| 2912 DISPATCH(); |
| 2913 } |
| 2914 |
| 2915 { |
| 2916 BYTECODE(LoadIndexedExternalInt8, A_B_C); |
| 2917 int8_t* data = reinterpret_cast<int8_t*>(FP[rB]); |
| 2918 RawSmi* index = RAW_CAST(Smi, FP[rC]); |
| 2919 FP[rA] = Smi::New(data[Smi::Value(index)]); |
| 2920 DISPATCH(); |
| 2921 } |
| 2922 |
| 2923 { |
| 2924 BYTECODE(LoadIndexedOneByteString, A_B_C); |
| 2857 RawOneByteString* array = RAW_CAST(OneByteString, FP[rB]); | 2925 RawOneByteString* array = RAW_CAST(OneByteString, FP[rB]); |
| 2858 RawSmi* index = RAW_CAST(Smi, FP[rC]); | 2926 RawSmi* index = RAW_CAST(Smi, FP[rC]); |
| 2859 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); | 2927 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 2860 FP[rA] = Smi::New(array->ptr()->data()[Smi::Value(index)]); | 2928 FP[rA] = Smi::New(array->ptr()->data()[Smi::Value(index)]); |
| 2861 DISPATCH(); | 2929 DISPATCH(); |
| 2862 } | 2930 } |
| 2863 | 2931 |
| 2864 { | 2932 { |
| 2865 BYTECODE(LoadTwoByteStringIndexed, A_B_C); | 2933 BYTECODE(LoadIndexedTwoByteString, A_B_C); |
| 2866 RawTwoByteString* array = RAW_CAST(TwoByteString, FP[rB]); | 2934 RawTwoByteString* array = RAW_CAST(TwoByteString, FP[rB]); |
| 2867 RawSmi* index = RAW_CAST(Smi, FP[rC]); | 2935 RawSmi* index = RAW_CAST(Smi, FP[rC]); |
| 2868 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); | 2936 ASSERT(SimulatorHelpers::CheckIndex(index, array->ptr()->length_)); |
| 2869 FP[rA] = Smi::New(array->ptr()->data()[Smi::Value(index)]); | 2937 FP[rA] = Smi::New(array->ptr()->data()[Smi::Value(index)]); |
| 2870 DISPATCH(); | 2938 DISPATCH(); |
| 2871 } | 2939 } |
| 2872 | 2940 |
| 2873 { | 2941 { |
| 2874 BYTECODE(Deopt, A_D); | 2942 BYTECODE(Deopt, A_D); |
| 2875 const bool is_lazy = rD == 0; | 2943 const bool is_lazy = rD == 0; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3048 pc_ = pc; | 3116 pc_ = pc; |
| 3049 special_[kExceptionSpecialIndex] = raw_exception; | 3117 special_[kExceptionSpecialIndex] = raw_exception; |
| 3050 special_[kStacktraceSpecialIndex] = raw_stacktrace; | 3118 special_[kStacktraceSpecialIndex] = raw_stacktrace; |
| 3051 buf->Longjmp(); | 3119 buf->Longjmp(); |
| 3052 UNREACHABLE(); | 3120 UNREACHABLE(); |
| 3053 } | 3121 } |
| 3054 | 3122 |
| 3055 } // namespace dart | 3123 } // namespace dart |
| 3056 | 3124 |
| 3057 #endif // defined TARGET_ARCH_DBC | 3125 #endif // defined TARGET_ARCH_DBC |
| OLD | NEW |