| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 static intptr_t type_parameters_offset() { | 722 static intptr_t type_parameters_offset() { |
| 723 return OFFSET_OF(RawClass, type_parameters_); | 723 return OFFSET_OF(RawClass, type_parameters_); |
| 724 } | 724 } |
| 725 | 725 |
| 726 // Return a TypeParameter if the type_name is a type parameter of this class. | 726 // Return a TypeParameter if the type_name is a type parameter of this class. |
| 727 // Return null otherwise. | 727 // Return null otherwise. |
| 728 RawTypeParameter* LookupTypeParameter(const String& type_name) const; | 728 RawTypeParameter* LookupTypeParameter(const String& type_name) const; |
| 729 | 729 |
| 730 // The type argument vector is flattened and includes the type arguments of | 730 // The type argument vector is flattened and includes the type arguments of |
| 731 // the super class. | 731 // the super class. |
| 732 bool HasTypeArguments() const; | |
| 733 intptr_t NumTypeArguments() const; | 732 intptr_t NumTypeArguments() const; |
| 734 | 733 |
| 735 // Return the number of type arguments that are specific to this class, i.e. | 734 // Return the number of type arguments that are specific to this class, i.e. |
| 736 // not overlapping with the type arguments of the super class of this class. | 735 // not overlapping with the type arguments of the super class of this class. |
| 737 intptr_t NumOwnTypeArguments() const; | 736 intptr_t NumOwnTypeArguments() const; |
| 738 | 737 |
| 739 // If this class is parameterized, each instance has a type_arguments field. | 738 // If this class is parameterized, each instance has a type_arguments field. |
| 740 static const intptr_t kNoTypeArguments = -1; | 739 static const intptr_t kNoTypeArguments = -1; |
| 741 intptr_t type_arguments_field_offset() const { | 740 intptr_t type_arguments_field_offset() const { |
| 742 ASSERT(is_type_finalized() || is_prefinalized()); | 741 ASSERT(is_type_finalized() || is_prefinalized()); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 bool is_mixin_typedef() const { | 941 bool is_mixin_typedef() const { |
| 943 return MixinTypedefBit::decode(raw_ptr()->state_bits_); | 942 return MixinTypedefBit::decode(raw_ptr()->state_bits_); |
| 944 } | 943 } |
| 945 void set_is_mixin_typedef() const; | 944 void set_is_mixin_typedef() const; |
| 946 | 945 |
| 947 bool is_mixin_type_applied() const { | 946 bool is_mixin_type_applied() const { |
| 948 return MixinTypeAppliedBit::decode(raw_ptr()->state_bits_); | 947 return MixinTypeAppliedBit::decode(raw_ptr()->state_bits_); |
| 949 } | 948 } |
| 950 void set_is_mixin_type_applied() const; | 949 void set_is_mixin_type_applied() const; |
| 951 | 950 |
| 952 int num_native_fields() const { | 951 uint16_t num_native_fields() const { |
| 953 return raw_ptr()->num_native_fields_; | 952 return raw_ptr()->num_native_fields_; |
| 954 } | 953 } |
| 955 void set_num_native_fields(int value) const { | 954 void set_num_native_fields(uint16_t value) const { |
| 956 raw_ptr()->num_native_fields_ = value; | 955 raw_ptr()->num_native_fields_ = value; |
| 957 } | 956 } |
| 958 static intptr_t num_native_fields_offset() { | |
| 959 return OFFSET_OF(RawClass, num_native_fields_); | |
| 960 } | |
| 961 | 957 |
| 962 RawCode* allocation_stub() const { | 958 RawCode* allocation_stub() const { |
| 963 return raw_ptr()->allocation_stub_; | 959 return raw_ptr()->allocation_stub_; |
| 964 } | 960 } |
| 965 void set_allocation_stub(const Code& value) const; | 961 void set_allocation_stub(const Code& value) const; |
| 966 | 962 |
| 967 RawArray* constants() const; | 963 RawArray* constants() const; |
| 968 | 964 |
| 969 RawFunction* GetInvocationDispatcher(const String& target_name, | 965 RawFunction* GetInvocationDispatcher(const String& target_name, |
| 970 const Array& args_desc, | 966 const Array& args_desc, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 void set_canonical_types(const Array& value) const; | 1065 void set_canonical_types(const Array& value) const; |
| 1070 RawArray* canonical_types() const; | 1066 RawArray* canonical_types() const; |
| 1071 | 1067 |
| 1072 RawArray* invocation_dispatcher_cache() const; | 1068 RawArray* invocation_dispatcher_cache() const; |
| 1073 void set_invocation_dispatcher_cache(const Array& cache) const; | 1069 void set_invocation_dispatcher_cache(const Array& cache) const; |
| 1074 RawFunction* CreateInvocationDispatcher(const String& target_name, | 1070 RawFunction* CreateInvocationDispatcher(const String& target_name, |
| 1075 const Array& args_desc, | 1071 const Array& args_desc, |
| 1076 RawFunction::Kind kind) const; | 1072 RawFunction::Kind kind) const; |
| 1077 void CalculateFieldOffsets() const; | 1073 void CalculateFieldOffsets() const; |
| 1078 | 1074 |
| 1075 // Initial value for the cached number of type arguments. |
| 1076 static const intptr_t kUnknownNumTypeArguments = -1; |
| 1077 |
| 1078 int16_t num_type_arguments() const { |
| 1079 return raw_ptr()->num_type_arguments_; |
| 1080 } |
| 1081 void set_num_type_arguments(intptr_t value) const; |
| 1082 |
| 1083 int16_t num_own_type_arguments() const { |
| 1084 return raw_ptr()->num_own_type_arguments_; |
| 1085 } |
| 1086 void set_num_own_type_arguments(intptr_t value) const; |
| 1087 |
| 1079 // Assigns empty array to all raw class array fields. | 1088 // Assigns empty array to all raw class array fields. |
| 1080 void InitEmptyFields(); | 1089 void InitEmptyFields(); |
| 1081 | 1090 |
| 1082 static RawFunction* CheckFunctionType(const Function& func, intptr_t type); | 1091 static RawFunction* CheckFunctionType(const Function& func, intptr_t type); |
| 1083 RawFunction* LookupFunction(const String& name, intptr_t type) const; | 1092 RawFunction* LookupFunction(const String& name, intptr_t type) const; |
| 1084 RawFunction* LookupFunctionAllowPrivate(const String& name, | 1093 RawFunction* LookupFunctionAllowPrivate(const String& name, |
| 1085 intptr_t type) const; | 1094 intptr_t type) const; |
| 1086 RawField* LookupField(const String& name, intptr_t type) const; | 1095 RawField* LookupField(const String& name, intptr_t type) const; |
| 1087 | 1096 |
| 1088 RawFunction* LookupAccessorFunction(const char* prefix, | 1097 RawFunction* LookupAccessorFunction(const char* prefix, |
| (...skipping 5174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6263 | 6272 |
| 6264 | 6273 |
| 6265 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6274 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6266 intptr_t index) { | 6275 intptr_t index) { |
| 6267 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6276 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6268 } | 6277 } |
| 6269 | 6278 |
| 6270 } // namespace dart | 6279 } // namespace dart |
| 6271 | 6280 |
| 6272 #endif // VM_OBJECT_H_ | 6281 #endif // VM_OBJECT_H_ |
| OLD | NEW |