Chromium Code Reviews| 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, 0); // Stack: instance, type args, type, cache | |
| 1858 RawInstance* instance = static_cast<RawInstance*>(SP[-3]); | |
|
zra
2016/06/28 19:30:35
If you use the RAW_CAST macro, we'll also get some
rmacnak
2016/06/28 21:21:50
RAW_CAST is too strict here. type_args may be null
| |
| 1859 RawTypeArguments* type_args = static_cast<RawTypeArguments*>(SP[-2]); | |
| 1860 RawAbstractType* raw_type = static_cast<RawAbstractType*>(SP[-1]); | |
| 1861 RawSubtypeTestCache* cache = static_cast<RawSubtypeTestCache*>(SP[0]); | |
| 1862 | |
| 1863 const AbstractType& type = AbstractType::Handle(raw_type); | |
| 1864 if (type.IsInstantiated()) { | |
| 1865 if (instance == null_value) { | |
| 1866 SP[-3] = type.IsNullType() ? true_value : false_value; | |
| 1867 goto InstanceOfOk; | |
| 1868 } | |
| 1869 } | |
| 1870 | |
| 1871 // TODO(rmacnak): Use the cache. | |
| 1872 | |
| 1873 { | |
| 1874 SP[1] = instance; | |
| 1875 SP[2] = raw_type; | |
| 1876 SP[3] = type_args; | |
| 1877 SP[4] = cache; | |
| 1878 Exit(thread, FP, SP + 5, pc); | |
| 1879 NativeArguments native_args(thread, 4, SP + 1, SP - 3); | |
| 1880 INVOKE_RUNTIME(DRT_Instanceof, native_args); | |
| 1881 } | |
| 1882 | |
| 1883 InstanceOfOk: | |
| 1884 SP -= 3; | |
| 1885 DISPATCH(); | |
| 1886 } | |
| 1887 | |
| 1888 { | |
| 1857 BYTECODE(AssertAssignable, A_D); // Stack: instance, type args, type, name | 1889 BYTECODE(AssertAssignable, A_D); // Stack: instance, type args, type, name |
| 1858 RawObject** args = SP - 3; | 1890 RawObject** args = SP - 3; |
| 1859 if (args[0] != null_value) { | 1891 if (args[0] != null_value) { |
| 1860 const AbstractType& dst_type = | 1892 const AbstractType& dst_type = |
| 1861 AbstractType::Handle(static_cast<RawAbstractType*>(args[2])); | 1893 AbstractType::Handle(static_cast<RawAbstractType*>(args[2])); |
| 1862 if (dst_type.IsMalformedOrMalbounded()) { | 1894 if (dst_type.IsMalformedOrMalbounded()) { |
| 1863 SP[1] = args[0]; // instance. | 1895 SP[1] = args[0]; // instance. |
| 1864 SP[2] = args[3]; // name. | 1896 SP[2] = args[3]; // name. |
| 1865 SP[3] = args[2]; // type. | 1897 SP[3] = args[2]; // type. |
| 1866 Exit(thread, FP, SP + 4, pc); | 1898 Exit(thread, FP, SP + 4, pc); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1971 const RawSmi* actual_cid = | 2003 const RawSmi* actual_cid = |
| 1972 SimulatorHelpers::GetClassIdAsSmi(static_cast<RawObject*>(FP[rA])); | 2004 SimulatorHelpers::GetClassIdAsSmi(static_cast<RawObject*>(FP[rA])); |
| 1973 const RawSmi* desired_cid = RAW_CAST(Smi, LOAD_CONSTANT(rD)); | 2005 const RawSmi* desired_cid = RAW_CAST(Smi, LOAD_CONSTANT(rD)); |
| 1974 if (actual_cid == desired_cid) { | 2006 if (actual_cid == desired_cid) { |
| 1975 pc++; | 2007 pc++; |
| 1976 } | 2008 } |
| 1977 DISPATCH(); | 2009 DISPATCH(); |
| 1978 } | 2010 } |
| 1979 | 2011 |
| 1980 { | 2012 { |
| 2013 BYTECODE(LogicalNot, 0); | |
| 2014 SP[0] = (SP[0] == true_value) ? false_value : true_value; | |
| 2015 DISPATCH(); | |
| 2016 } | |
| 2017 | |
| 2018 { | |
| 1981 BYTECODE(IfEqStrictTOS, 0); | 2019 BYTECODE(IfEqStrictTOS, 0); |
| 1982 SP -= 2; | 2020 SP -= 2; |
| 1983 if (SP[1] != SP[2]) { | 2021 if (SP[1] != SP[2]) { |
| 1984 pc++; | 2022 pc++; |
| 1985 } | 2023 } |
| 1986 DISPATCH(); | 2024 DISPATCH(); |
| 1987 } | 2025 } |
| 1988 | 2026 |
| 1989 { | 2027 { |
| 1990 BYTECODE(IfNeStrictTOS, 0); | 2028 BYTECODE(IfNeStrictTOS, 0); |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2290 special_[kExceptionSpecialIndex] = raw_exception; | 2328 special_[kExceptionSpecialIndex] = raw_exception; |
| 2291 special_[kStacktraceSpecialIndex] = raw_stacktrace; | 2329 special_[kStacktraceSpecialIndex] = raw_stacktrace; |
| 2292 buf->Longjmp(); | 2330 buf->Longjmp(); |
| 2293 UNREACHABLE(); | 2331 UNREACHABLE(); |
| 2294 } | 2332 } |
| 2295 | 2333 |
| 2296 } // namespace dart | 2334 } // namespace dart |
| 2297 | 2335 |
| 2298 | 2336 |
| 2299 #endif // defined TARGET_ARCH_DBC | 2337 #endif // defined TARGET_ARCH_DBC |
| OLD | NEW |