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 2997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3008 RawSubtypeTestCache* cache = static_cast<RawSubtypeTestCache*>(SP[0]); | 3008 RawSubtypeTestCache* cache = static_cast<RawSubtypeTestCache*>(SP[0]); |
3009 | 3009 |
3010 if (cache != null_value) { | 3010 if (cache != null_value) { |
3011 const intptr_t cid = SimulatorHelpers::GetClassId(instance); | 3011 const intptr_t cid = SimulatorHelpers::GetClassId(instance); |
3012 | 3012 |
3013 RawTypeArguments* instance_type_arguments = | 3013 RawTypeArguments* instance_type_arguments = |
3014 static_cast<RawTypeArguments*>(null_value); | 3014 static_cast<RawTypeArguments*>(null_value); |
3015 RawObject* instance_cid_or_function; | 3015 RawObject* instance_cid_or_function; |
3016 if (cid == kClosureCid) { | 3016 if (cid == kClosureCid) { |
3017 RawClosure* closure = static_cast<RawClosure*>(instance); | 3017 RawClosure* closure = static_cast<RawClosure*>(instance); |
3018 instance_type_arguments = closure->ptr()->instantiator_; | 3018 if (closure->ptr()->function_type_arguments_ != TypeArguments::null()) { |
| 3019 // Cache cannot be used for generic closures. |
| 3020 goto InstanceOfCallRuntime; |
| 3021 } |
| 3022 instance_type_arguments = closure->ptr()->instantiator_type_arguments_; |
3019 instance_cid_or_function = closure->ptr()->function_; | 3023 instance_cid_or_function = closure->ptr()->function_; |
3020 } else { | 3024 } else { |
3021 instance_cid_or_function = Smi::New(cid); | 3025 instance_cid_or_function = Smi::New(cid); |
3022 | 3026 |
3023 RawClass* instance_class = thread->isolate()->class_table()->At(cid); | 3027 RawClass* instance_class = thread->isolate()->class_table()->At(cid); |
3024 if (instance_class->ptr()->num_type_arguments_ < 0) { | 3028 if (instance_class->ptr()->num_type_arguments_ < 0) { |
3025 goto InstanceOfCallRuntime; | 3029 goto InstanceOfCallRuntime; |
3026 } else if (instance_class->ptr()->num_type_arguments_ > 0) { | 3030 } else if (instance_class->ptr()->num_type_arguments_ > 0) { |
3027 instance_type_arguments = reinterpret_cast<RawTypeArguments**>( | 3031 instance_type_arguments = reinterpret_cast<RawTypeArguments**>( |
3028 instance->ptr())[instance_class->ptr() | 3032 instance->ptr())[instance_class->ptr() |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3101 RawTypeArguments* function_type_arguments = | 3105 RawTypeArguments* function_type_arguments = |
3102 static_cast<RawTypeArguments*>(args[2]); | 3106 static_cast<RawTypeArguments*>(args[2]); |
3103 | 3107 |
3104 const intptr_t cid = SimulatorHelpers::GetClassId(instance); | 3108 const intptr_t cid = SimulatorHelpers::GetClassId(instance); |
3105 | 3109 |
3106 RawTypeArguments* instance_type_arguments = | 3110 RawTypeArguments* instance_type_arguments = |
3107 static_cast<RawTypeArguments*>(null_value); | 3111 static_cast<RawTypeArguments*>(null_value); |
3108 RawObject* instance_cid_or_function; | 3112 RawObject* instance_cid_or_function; |
3109 if (cid == kClosureCid) { | 3113 if (cid == kClosureCid) { |
3110 RawClosure* closure = static_cast<RawClosure*>(instance); | 3114 RawClosure* closure = static_cast<RawClosure*>(instance); |
3111 instance_type_arguments = closure->ptr()->instantiator_; | 3115 if (closure->ptr()->function_type_arguments_ != |
| 3116 TypeArguments::null()) { |
| 3117 // Cache cannot be used for generic closures. |
| 3118 goto AssertAssignableCallRuntime; |
| 3119 } |
| 3120 instance_type_arguments = |
| 3121 closure->ptr()->instantiator_type_arguments_; |
3112 instance_cid_or_function = closure->ptr()->function_; | 3122 instance_cid_or_function = closure->ptr()->function_; |
3113 } else { | 3123 } else { |
3114 instance_cid_or_function = Smi::New(cid); | 3124 instance_cid_or_function = Smi::New(cid); |
3115 | 3125 |
3116 RawClass* instance_class = thread->isolate()->class_table()->At(cid); | 3126 RawClass* instance_class = thread->isolate()->class_table()->At(cid); |
3117 if (instance_class->ptr()->num_type_arguments_ < 0) { | 3127 if (instance_class->ptr()->num_type_arguments_ < 0) { |
3118 goto AssertAssignableCallRuntime; | 3128 goto AssertAssignableCallRuntime; |
3119 } else if (instance_class->ptr()->num_type_arguments_ > 0) { | 3129 } else if (instance_class->ptr()->num_type_arguments_ > 0) { |
3120 instance_type_arguments = reinterpret_cast<RawTypeArguments**>( | 3130 instance_type_arguments = reinterpret_cast<RawTypeArguments**>( |
3121 instance->ptr())[instance_class->ptr() | 3131 instance->ptr())[instance_class->ptr() |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3873 pc_ = pc; | 3883 pc_ = pc; |
3874 } | 3884 } |
3875 | 3885 |
3876 buf->Longjmp(); | 3886 buf->Longjmp(); |
3877 UNREACHABLE(); | 3887 UNREACHABLE(); |
3878 } | 3888 } |
3879 | 3889 |
3880 } // namespace dart | 3890 } // namespace dart |
3881 | 3891 |
3882 #endif // defined TARGET_ARCH_DBC | 3892 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |