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 2906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2917 SP[1] = SP[-0]; // Length. | 2917 SP[1] = SP[-0]; // Length. |
2918 SP[2] = SP[-1]; // Type. | 2918 SP[2] = SP[-1]; // Type. |
2919 Exit(thread, FP, SP + 3, pc); | 2919 Exit(thread, FP, SP + 3, pc); |
2920 NativeArguments args(thread, 2, SP + 1, SP - 1); | 2920 NativeArguments args(thread, 2, SP + 1, SP - 1); |
2921 INVOKE_RUNTIME(DRT_AllocateArray, args); | 2921 INVOKE_RUNTIME(DRT_AllocateArray, args); |
2922 SP -= 1; | 2922 SP -= 1; |
2923 DISPATCH(); | 2923 DISPATCH(); |
2924 } | 2924 } |
2925 | 2925 |
2926 { | 2926 { |
2927 BYTECODE(InstanceOf, 0); // Stack: instance, type args, type, cache | 2927 BYTECODE(InstanceOf, A); // Stack: instance, type args, type, cache |
2928 RawInstance* instance = static_cast<RawInstance*>(SP[-3]); | 2928 RawInstance* instance = static_cast<RawInstance*>(SP[-3]); |
2929 RawTypeArguments* instantiator_type_arguments = | 2929 RawTypeArguments* instantiator_type_arguments = |
2930 static_cast<RawTypeArguments*>(SP[-2]); | 2930 static_cast<RawTypeArguments*>(SP[-2]); |
2931 RawAbstractType* type = static_cast<RawAbstractType*>(SP[-1]); | 2931 RawAbstractType* type = static_cast<RawAbstractType*>(SP[-1]); |
2932 RawSubtypeTestCache* cache = static_cast<RawSubtypeTestCache*>(SP[0]); | 2932 RawSubtypeTestCache* cache = static_cast<RawSubtypeTestCache*>(SP[0]); |
2933 | 2933 |
2934 if (cache != null_value) { | 2934 if (cache != null_value) { |
2935 const intptr_t cid = SimulatorHelpers::GetClassId(instance); | 2935 const intptr_t cid = SimulatorHelpers::GetClassId(instance); |
2936 | 2936 |
2937 RawTypeArguments* instance_type_arguments = | 2937 RawTypeArguments* instance_type_arguments = |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2977 SP[3] = instantiator_type_arguments; | 2977 SP[3] = instantiator_type_arguments; |
2978 SP[4] = cache; | 2978 SP[4] = cache; |
2979 Exit(thread, FP, SP + 5, pc); | 2979 Exit(thread, FP, SP + 5, pc); |
2980 NativeArguments native_args(thread, 4, SP + 1, SP - 3); | 2980 NativeArguments native_args(thread, 4, SP + 1, SP - 3); |
2981 INVOKE_RUNTIME(DRT_Instanceof, native_args); | 2981 INVOKE_RUNTIME(DRT_Instanceof, native_args); |
2982 } | 2982 } |
2983 // clang-format on | 2983 // clang-format on |
2984 | 2984 |
2985 InstanceOfOk: | 2985 InstanceOfOk: |
2986 SP -= 3; | 2986 SP -= 3; |
| 2987 if (rA) { // Negate result. |
| 2988 SP[0] = (SP[0] == true_value) ? false_value : true_value; |
| 2989 } |
2987 DISPATCH(); | 2990 DISPATCH(); |
2988 } | 2991 } |
2989 | 2992 |
2990 { | 2993 { |
2991 BYTECODE(BadTypeError, 0); // Stack: instance, type args, type, name | 2994 BYTECODE(BadTypeError, 0); // Stack: instance, type args, type, name |
2992 RawObject** args = SP - 3; | 2995 RawObject** args = SP - 3; |
2993 if (args[0] != null_value) { | 2996 if (args[0] != null_value) { |
2994 SP[1] = args[0]; // instance. | 2997 SP[1] = args[0]; // instance. |
2995 SP[2] = args[3]; // name. | 2998 SP[2] = args[3]; // name. |
2996 SP[3] = args[2]; // type. | 2999 SP[3] = args[2]; // type. |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3762 pc_ = pc; | 3765 pc_ = pc; |
3763 } | 3766 } |
3764 | 3767 |
3765 buf->Longjmp(); | 3768 buf->Longjmp(); |
3766 UNREACHABLE(); | 3769 UNREACHABLE(); |
3767 } | 3770 } |
3768 | 3771 |
3769 } // namespace dart | 3772 } // namespace dart |
3770 | 3773 |
3771 #endif // defined TARGET_ARCH_DBC | 3774 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |