| 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 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1847 SP[1] = SP[-0]; // Length. | 1847 SP[1] = SP[-0]; // Length. |
| 1848 SP[2] = SP[-1]; // Type. | 1848 SP[2] = SP[-1]; // Type. |
| 1849 Exit(thread, FP, SP + 3, pc); | 1849 Exit(thread, FP, SP + 3, pc); |
| 1850 NativeArguments args(thread, 2, SP + 1, SP - 1); | 1850 NativeArguments args(thread, 2, SP + 1, SP - 1); |
| 1851 INVOKE_RUNTIME(DRT_AllocateArray, args); | 1851 INVOKE_RUNTIME(DRT_AllocateArray, args); |
| 1852 SP -= 1; | 1852 SP -= 1; |
| 1853 DISPATCH(); | 1853 DISPATCH(); |
| 1854 } | 1854 } |
| 1855 | 1855 |
| 1856 { | 1856 { |
| 1857 BYTECODE(InstanceOf, A); // Stack: instance, type args, type, cache |
| 1858 RawInstance* instance = static_cast<RawInstance*>(SP[-3]); |
| 1859 RawTypeArguments* instantiator_type_arguments = |
| 1860 static_cast<RawTypeArguments*>(SP[-2]); |
| 1861 RawAbstractType* type = static_cast<RawAbstractType*>(SP[-1]); |
| 1862 RawSubtypeTestCache* cache = static_cast<RawSubtypeTestCache*>(SP[0]); |
| 1863 |
| 1864 if (cache != null_value) { |
| 1865 const intptr_t cid = SimulatorHelpers::GetClassId(instance); |
| 1866 |
| 1867 RawTypeArguments* instance_type_arguments = |
| 1868 static_cast<RawTypeArguments*>(null_value); |
| 1869 RawObject* instance_cid_or_function; |
| 1870 if (cid == kClosureCid) { |
| 1871 RawClosure* closure = static_cast<RawClosure*>(instance); |
| 1872 instance_type_arguments = closure->ptr()->type_arguments_; |
| 1873 instance_cid_or_function = closure->ptr()->function_; |
| 1874 } else { |
| 1875 instance_cid_or_function = Smi::New(cid); |
| 1876 |
| 1877 RawClass* instance_class = |
| 1878 thread->isolate()->class_table()->At(cid); |
| 1879 if (instance_class->ptr()->num_type_arguments_ < 0) { |
| 1880 goto InstanceOfCallRuntime; |
| 1881 } else if (instance_class->ptr()->num_type_arguments_ > 0) { |
| 1882 instance_type_arguments = reinterpret_cast<RawTypeArguments**>( |
| 1883 instance |
| 1884 ->ptr())[instance_class->ptr() |
| 1885 ->type_arguments_field_offset_in_words_]; |
| 1886 } |
| 1887 } |
| 1888 |
| 1889 for (RawObject** entries = cache->ptr()->cache_->ptr()->data(); |
| 1890 entries[0] != null_value; |
| 1891 entries += SubtypeTestCache::kTestEntryLength) { |
| 1892 if ((entries[SubtypeTestCache::kInstanceClassIdOrFunction] == |
| 1893 instance_cid_or_function) && |
| 1894 (entries[SubtypeTestCache::kInstanceTypeArguments] == |
| 1895 instance_type_arguments) && |
| 1896 (entries[SubtypeTestCache::kInstantiatorTypeArguments] == |
| 1897 instantiator_type_arguments)) { |
| 1898 SP[-3] = entries[SubtypeTestCache::kTestResult]; |
| 1899 goto InstanceOfOk; |
| 1900 } |
| 1901 } |
| 1902 } |
| 1903 |
| 1904 InstanceOfCallRuntime: |
| 1905 { |
| 1906 SP[1] = instance; |
| 1907 SP[2] = type; |
| 1908 SP[3] = instantiator_type_arguments; |
| 1909 SP[4] = cache; |
| 1910 Exit(thread, FP, SP + 5, pc); |
| 1911 NativeArguments native_args(thread, 4, SP + 1, SP - 3); |
| 1912 INVOKE_RUNTIME(DRT_Instanceof, native_args); |
| 1913 } |
| 1914 |
| 1915 InstanceOfOk: |
| 1916 SP -= 3; |
| 1917 if (rA) { // Negate result. |
| 1918 SP[0] = (SP[0] == true_value) ? false_value : true_value; |
| 1919 } |
| 1920 DISPATCH(); |
| 1921 } |
| 1922 |
| 1923 { |
| 1857 BYTECODE(AssertAssignable, A_D); // Stack: instance, type args, type, name | 1924 BYTECODE(AssertAssignable, A_D); // Stack: instance, type args, type, name |
| 1858 RawObject** args = SP - 3; | 1925 RawObject** args = SP - 3; |
| 1859 if (args[0] != null_value) { | 1926 if (args[0] != null_value) { |
| 1860 const AbstractType& dst_type = | 1927 const AbstractType& dst_type = |
| 1861 AbstractType::Handle(static_cast<RawAbstractType*>(args[2])); | 1928 AbstractType::Handle(static_cast<RawAbstractType*>(args[2])); |
| 1862 if (dst_type.IsMalformedOrMalbounded()) { | 1929 if (dst_type.IsMalformedOrMalbounded()) { |
| 1863 SP[1] = args[0]; // instance. | 1930 SP[1] = args[0]; // instance. |
| 1864 SP[2] = args[3]; // name. | 1931 SP[2] = args[3]; // name. |
| 1865 SP[3] = args[2]; // type. | 1932 SP[3] = args[2]; // type. |
| 1866 Exit(thread, FP, SP + 4, pc); | 1933 Exit(thread, FP, SP + 4, pc); |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2290 special_[kExceptionSpecialIndex] = raw_exception; | 2357 special_[kExceptionSpecialIndex] = raw_exception; |
| 2291 special_[kStacktraceSpecialIndex] = raw_stacktrace; | 2358 special_[kStacktraceSpecialIndex] = raw_stacktrace; |
| 2292 buf->Longjmp(); | 2359 buf->Longjmp(); |
| 2293 UNREACHABLE(); | 2360 UNREACHABLE(); |
| 2294 } | 2361 } |
| 2295 | 2362 |
| 2296 } // namespace dart | 2363 } // namespace dart |
| 2297 | 2364 |
| 2298 | 2365 |
| 2299 #endif // defined TARGET_ARCH_DBC | 2366 #endif // defined TARGET_ARCH_DBC |
| OLD | NEW |