| 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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 virtual RawError* malformed_error() const; | 783 virtual RawError* malformed_error() const; |
| 784 virtual void set_malformed_error(const Error& value) const; | 784 virtual void set_malformed_error(const Error& value) const; |
| 785 virtual bool IsResolved() const; | 785 virtual bool IsResolved() const; |
| 786 virtual bool HasResolvedTypeClass() const; | 786 virtual bool HasResolvedTypeClass() const; |
| 787 virtual RawClass* type_class() const; | 787 virtual RawClass* type_class() const; |
| 788 virtual RawUnresolvedClass* unresolved_class() const; | 788 virtual RawUnresolvedClass* unresolved_class() const; |
| 789 virtual RawAbstractTypeArguments* arguments() const; | 789 virtual RawAbstractTypeArguments* arguments() const; |
| 790 virtual intptr_t token_index() const; | 790 virtual intptr_t token_index() const; |
| 791 virtual bool IsInstantiated() const; | 791 virtual bool IsInstantiated() const; |
| 792 virtual bool Equals(const AbstractType& other) const; | 792 virtual bool Equals(const AbstractType& other) const; |
| 793 virtual bool IsIdentical(const AbstractType& other) const; |
| 793 | 794 |
| 794 // Instantiate this type using the given type argument vector. | 795 // Instantiate this type using the given type argument vector. |
| 795 // Return a new type, or return 'this' if it is already instantiated. | 796 // Return a new type, or return 'this' if it is already instantiated. |
| 796 virtual RawAbstractType* InstantiateFrom( | 797 virtual RawAbstractType* InstantiateFrom( |
| 797 const AbstractTypeArguments& instantiator_type_arguments) const; | 798 const AbstractTypeArguments& instantiator_type_arguments) const; |
| 798 | 799 |
| 799 // Return the canonical version of this type. | 800 // Return the canonical version of this type. |
| 800 virtual RawAbstractType* Canonicalize() const; | 801 virtual RawAbstractType* Canonicalize() const; |
| 801 | 802 |
| 802 // The name of this type, including the names of its type arguments, if any. | 803 // The name of this type, including the names of its type arguments, if any. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 } | 890 } |
| 890 void set_is_being_finalized() const; | 891 void set_is_being_finalized() const; |
| 891 virtual bool IsMalformed() const; | 892 virtual bool IsMalformed() const; |
| 892 virtual RawError* malformed_error() const; | 893 virtual RawError* malformed_error() const; |
| 893 virtual void set_malformed_error(const Error& value) const; | 894 virtual void set_malformed_error(const Error& value) const; |
| 894 virtual bool IsResolved() const; // Class and all arguments classes resolved. | 895 virtual bool IsResolved() const; // Class and all arguments classes resolved. |
| 895 virtual bool HasResolvedTypeClass() const; // Own type class resolved. | 896 virtual bool HasResolvedTypeClass() const; // Own type class resolved. |
| 896 virtual RawClass* type_class() const; | 897 virtual RawClass* type_class() const; |
| 897 void set_type_class(const Object& value) const; | 898 void set_type_class(const Object& value) const; |
| 898 virtual RawUnresolvedClass* unresolved_class() const; | 899 virtual RawUnresolvedClass* unresolved_class() const; |
| 900 RawString* TypeClassName() const; |
| 899 virtual RawAbstractTypeArguments* arguments() const; | 901 virtual RawAbstractTypeArguments* arguments() const; |
| 900 void set_arguments(const AbstractTypeArguments& value) const; | 902 void set_arguments(const AbstractTypeArguments& value) const; |
| 901 virtual intptr_t token_index() const { return raw_ptr()->token_index_; } | 903 virtual intptr_t token_index() const { return raw_ptr()->token_index_; } |
| 902 virtual bool IsInstantiated() const; | 904 virtual bool IsInstantiated() const; |
| 903 virtual bool Equals(const AbstractType& other) const; | 905 virtual bool Equals(const AbstractType& other) const; |
| 906 virtual bool IsIdentical(const AbstractType& other) const; |
| 904 virtual RawAbstractType* InstantiateFrom( | 907 virtual RawAbstractType* InstantiateFrom( |
| 905 const AbstractTypeArguments& instantiator_type_arguments) const; | 908 const AbstractTypeArguments& instantiator_type_arguments) const; |
| 906 virtual RawAbstractType* Canonicalize() const; | 909 virtual RawAbstractType* Canonicalize() const; |
| 907 | 910 |
| 908 static intptr_t InstanceSize() { | 911 static intptr_t InstanceSize() { |
| 909 return RoundedAllocationSize(sizeof(RawType)); | 912 return RoundedAllocationSize(sizeof(RawType)); |
| 910 } | 913 } |
| 911 | 914 |
| 912 // The type of the literal 'null'. | 915 // The type of the literal 'null'. |
| 913 static RawType* NullType(); | 916 static RawType* NullType(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 virtual bool HasResolvedTypeClass() const { return false; } | 982 virtual bool HasResolvedTypeClass() const { return false; } |
| 980 RawClass* parameterized_class() const { | 983 RawClass* parameterized_class() const { |
| 981 return raw_ptr()->parameterized_class_; | 984 return raw_ptr()->parameterized_class_; |
| 982 } | 985 } |
| 983 virtual RawString* Name() const { return raw_ptr()->name_; } | 986 virtual RawString* Name() const { return raw_ptr()->name_; } |
| 984 virtual intptr_t Index() const { return raw_ptr()->index_; } | 987 virtual intptr_t Index() const { return raw_ptr()->index_; } |
| 985 void set_index(intptr_t value) const; | 988 void set_index(intptr_t value) const; |
| 986 virtual intptr_t token_index() const { return raw_ptr()->token_index_; } | 989 virtual intptr_t token_index() const { return raw_ptr()->token_index_; } |
| 987 virtual bool IsInstantiated() const { return false; } | 990 virtual bool IsInstantiated() const { return false; } |
| 988 virtual bool Equals(const AbstractType& other) const; | 991 virtual bool Equals(const AbstractType& other) const; |
| 992 virtual bool IsIdentical(const AbstractType& other) const; |
| 989 virtual RawAbstractType* InstantiateFrom( | 993 virtual RawAbstractType* InstantiateFrom( |
| 990 const AbstractTypeArguments& instantiator_type_arguments) const; | 994 const AbstractTypeArguments& instantiator_type_arguments) const; |
| 991 virtual RawAbstractType* Canonicalize() const { return raw(); } | 995 virtual RawAbstractType* Canonicalize() const { return raw(); } |
| 992 | 996 |
| 993 static intptr_t InstanceSize() { | 997 static intptr_t InstanceSize() { |
| 994 return RoundedAllocationSize(sizeof(RawTypeParameter)); | 998 return RoundedAllocationSize(sizeof(RawTypeParameter)); |
| 995 } | 999 } |
| 996 | 1000 |
| 997 static RawTypeParameter* New(const Class& parameterized_class, | 1001 static RawTypeParameter* New(const Class& parameterized_class, |
| 998 intptr_t index, | 1002 intptr_t index, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 | 1063 |
| 1060 | 1064 |
| 1061 // AbstractTypeArguments is an abstract superclass. | 1065 // AbstractTypeArguments is an abstract superclass. |
| 1062 // Subclasses of AbstractTypeArguments are TypeArguments and InstantiatedTypes. | 1066 // Subclasses of AbstractTypeArguments are TypeArguments and InstantiatedTypes. |
| 1063 class AbstractTypeArguments : public Object { | 1067 class AbstractTypeArguments : public Object { |
| 1064 public: | 1068 public: |
| 1065 // Returns true if both arguments represent vectors of equal types. | 1069 // Returns true if both arguments represent vectors of equal types. |
| 1066 static bool AreEqual(const AbstractTypeArguments& arguments, | 1070 static bool AreEqual(const AbstractTypeArguments& arguments, |
| 1067 const AbstractTypeArguments& other_arguments); | 1071 const AbstractTypeArguments& other_arguments); |
| 1068 | 1072 |
| 1073 // Returns true if both arguments represent vectors of possibly still |
| 1074 // unresolved identical types. |
| 1075 static bool AreIdentical(const AbstractTypeArguments& arguments, |
| 1076 const AbstractTypeArguments& other_arguments); |
| 1077 |
| 1069 // Return 'this' if this type argument vector is instantiated, i.e. if it does | 1078 // Return 'this' if this type argument vector is instantiated, i.e. if it does |
| 1070 // not refer to type parameters. Otherwise, return a new type argument vector | 1079 // not refer to type parameters. Otherwise, return a new type argument vector |
| 1071 // where each reference to a type parameter is replaced with the corresponding | 1080 // where each reference to a type parameter is replaced with the corresponding |
| 1072 // type of the instantiator type argument vector. | 1081 // type of the instantiator type argument vector. |
| 1073 virtual RawAbstractTypeArguments* InstantiateFrom( | 1082 virtual RawAbstractTypeArguments* InstantiateFrom( |
| 1074 const AbstractTypeArguments& instantiator_type_arguments) const; | 1083 const AbstractTypeArguments& instantiator_type_arguments) const; |
| 1075 | 1084 |
| 1076 // Do not canonicalize InstantiatedTypeArguments or NULL objects | 1085 // Do not canonicalize InstantiatedTypeArguments or NULL objects |
| 1077 virtual RawAbstractTypeArguments* Canonicalize() const { return this->raw(); } | 1086 virtual RawAbstractTypeArguments* Canonicalize() const { return this->raw(); } |
| 1078 | 1087 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 | 1137 |
| 1129 protected: | 1138 protected: |
| 1130 HEAP_OBJECT_IMPLEMENTATION(AbstractTypeArguments, Object); | 1139 HEAP_OBJECT_IMPLEMENTATION(AbstractTypeArguments, Object); |
| 1131 friend class Class; | 1140 friend class Class; |
| 1132 }; | 1141 }; |
| 1133 | 1142 |
| 1134 | 1143 |
| 1135 // A TypeArguments is an array of AbstractType. | 1144 // A TypeArguments is an array of AbstractType. |
| 1136 class TypeArguments : public AbstractTypeArguments { | 1145 class TypeArguments : public AbstractTypeArguments { |
| 1137 public: | 1146 public: |
| 1138 // Returns true if both arguments represent identical vectors of type | |
| 1139 // parameters, in number and names (but the type class may be different). | |
| 1140 static bool AreIdenticalTypeParameters(const TypeArguments& arguments, | |
| 1141 const TypeArguments& other_arguments); | |
| 1142 | |
| 1143 virtual intptr_t Length() const; | 1147 virtual intptr_t Length() const; |
| 1144 virtual RawAbstractType* TypeAt(intptr_t index) const; | 1148 virtual RawAbstractType* TypeAt(intptr_t index) const; |
| 1145 static intptr_t type_at_offset(intptr_t index) { | 1149 static intptr_t type_at_offset(intptr_t index) { |
| 1146 return OFFSET_OF(RawTypeArguments, types_) + index * kWordSize; | 1150 return OFFSET_OF(RawTypeArguments, types_) + index * kWordSize; |
| 1147 } | 1151 } |
| 1148 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const; | 1152 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const; |
| 1149 virtual bool IsResolved() const; | 1153 virtual bool IsResolved() const; |
| 1150 virtual bool IsInstantiated() const; | 1154 virtual bool IsInstantiated() const; |
| 1151 virtual bool IsUninstantiatedIdentity() const; | 1155 virtual bool IsUninstantiatedIdentity() const; |
| 1152 // Canonicalize only if instantiated, otherwise returns 'this'. | 1156 // Canonicalize only if instantiated, otherwise returns 'this'. |
| (...skipping 2807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3960 } | 3964 } |
| 3961 | 3965 |
| 3962 | 3966 |
| 3963 intptr_t Stackmap::SizeInBits() const { | 3967 intptr_t Stackmap::SizeInBits() const { |
| 3964 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); | 3968 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); |
| 3965 } | 3969 } |
| 3966 | 3970 |
| 3967 } // namespace dart | 3971 } // namespace dart |
| 3968 | 3972 |
| 3969 #endif // VM_OBJECT_H_ | 3973 #endif // VM_OBJECT_H_ |
| OLD | NEW |