Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: runtime/vm/object.h

Issue 23465004: More cleanup related to malformed and malbounded types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 } 810 }
811 811
812 // Check if this class represents a canonical signature class, i.e. not an 812 // Check if this class represents a canonical signature class, i.e. not an
813 // alias as defined in a typedef. 813 // alias as defined in a typedef.
814 bool IsCanonicalSignatureClass() const; 814 bool IsCanonicalSignatureClass() const;
815 815
816 // Check the subtype relationship. 816 // Check the subtype relationship.
817 bool IsSubtypeOf(const AbstractTypeArguments& type_arguments, 817 bool IsSubtypeOf(const AbstractTypeArguments& type_arguments,
818 const Class& other, 818 const Class& other,
819 const AbstractTypeArguments& other_type_arguments, 819 const AbstractTypeArguments& other_type_arguments,
820 Error* malformed_error) const { 820 Error* bound_error) const {
821 return TypeTest(kIsSubtypeOf, 821 return TypeTest(kIsSubtypeOf,
822 type_arguments, 822 type_arguments,
823 other, 823 other,
824 other_type_arguments, 824 other_type_arguments,
825 malformed_error); 825 bound_error);
826 } 826 }
827 827
828 // Check the 'more specific' relationship. 828 // Check the 'more specific' relationship.
829 bool IsMoreSpecificThan(const AbstractTypeArguments& type_arguments, 829 bool IsMoreSpecificThan(const AbstractTypeArguments& type_arguments,
830 const Class& other, 830 const Class& other,
831 const AbstractTypeArguments& other_type_arguments, 831 const AbstractTypeArguments& other_type_arguments,
832 Error* malformed_error) const { 832 Error* bound_error) const {
833 return TypeTest(kIsMoreSpecificThan, 833 return TypeTest(kIsMoreSpecificThan,
834 type_arguments, 834 type_arguments,
835 other, 835 other,
836 other_type_arguments, 836 other_type_arguments,
837 malformed_error); 837 bound_error);
838 } 838 }
839 839
840 // Check if this is the top level class. 840 // Check if this is the top level class.
841 bool IsTopLevel() const; 841 bool IsTopLevel() const;
842 842
843 RawArray* fields() const { return raw_ptr()->fields_; } 843 RawArray* fields() const { return raw_ptr()->fields_; }
844 void SetFields(const Array& value) const; 844 void SetFields(const Array& value) const;
845 845
846 // Returns true if non-static fields are defined. 846 // Returns true if non-static fields are defined.
847 bool HasInstanceFields() const; 847 bool HasInstanceFields() const;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 const String& name) const; 1060 const String& name) const;
1061 1061
1062 // Allocate an instance class which has a VM implementation. 1062 // Allocate an instance class which has a VM implementation.
1063 template <class FakeInstance> static RawClass* New(intptr_t id); 1063 template <class FakeInstance> static RawClass* New(intptr_t id);
1064 1064
1065 // Check the subtype or 'more specific' relationship. 1065 // Check the subtype or 'more specific' relationship.
1066 bool TypeTest(TypeTestKind test_kind, 1066 bool TypeTest(TypeTestKind test_kind,
1067 const AbstractTypeArguments& type_arguments, 1067 const AbstractTypeArguments& type_arguments,
1068 const Class& other, 1068 const Class& other,
1069 const AbstractTypeArguments& other_type_arguments, 1069 const AbstractTypeArguments& other_type_arguments,
1070 Error* malformed_error) const; 1070 Error* bound_error) const;
1071 1071
1072 FINAL_HEAP_OBJECT_IMPLEMENTATION(Class, Object); 1072 FINAL_HEAP_OBJECT_IMPLEMENTATION(Class, Object);
1073 friend class AbstractType; 1073 friend class AbstractType;
1074 friend class Instance; 1074 friend class Instance;
1075 friend class Object; 1075 friend class Object;
1076 friend class Type; 1076 friend class Type;
1077 }; 1077 };
1078 1078
1079 1079
1080 // Unresolved class is used for storing unresolved names which will be resolved 1080 // Unresolved class is used for storing unresolved names which will be resolved
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 class AbstractTypeArguments : public Object { 1114 class AbstractTypeArguments : public Object {
1115 public: 1115 public:
1116 // Returns true if both arguments represent vectors of equal types. 1116 // Returns true if both arguments represent vectors of equal types.
1117 static bool AreEqual(const AbstractTypeArguments& arguments, 1117 static bool AreEqual(const AbstractTypeArguments& arguments,
1118 const AbstractTypeArguments& other_arguments); 1118 const AbstractTypeArguments& other_arguments);
1119 1119
1120 // Return 'this' if this type argument vector is instantiated, i.e. if it does 1120 // Return 'this' if this type argument vector is instantiated, i.e. if it does
1121 // not refer to type parameters. Otherwise, return a new type argument vector 1121 // not refer to type parameters. Otherwise, return a new type argument vector
1122 // where each reference to a type parameter is replaced with the corresponding 1122 // where each reference to a type parameter is replaced with the corresponding
1123 // type of the instantiator type argument vector. 1123 // type of the instantiator type argument vector.
1124 // If malformed_error is not NULL, it may be set to reflect a bound error. 1124 // If bound_error is not NULL, it may be set to reflect a bound error.
1125 virtual RawAbstractTypeArguments* InstantiateFrom( 1125 virtual RawAbstractTypeArguments* InstantiateFrom(
1126 const AbstractTypeArguments& instantiator_type_arguments, 1126 const AbstractTypeArguments& instantiator_type_arguments,
1127 Error* malformed_error) const; 1127 Error* bound_error) const;
1128 1128
1129 // Do not canonicalize InstantiatedTypeArguments or NULL objects 1129 // Do not canonicalize InstantiatedTypeArguments or NULL objects
1130 virtual RawAbstractTypeArguments* Canonicalize() const { return this->raw(); } 1130 virtual RawAbstractTypeArguments* Canonicalize() const { return this->raw(); }
1131 1131
1132 // The name of this type argument vector, e.g. "<T, dynamic, List<T>, Smi>". 1132 // The name of this type argument vector, e.g. "<T, dynamic, List<T>, Smi>".
1133 virtual RawString* Name() const { 1133 virtual RawString* Name() const {
1134 return SubvectorName(0, Length(), kInternalName); 1134 return SubvectorName(0, Length(), kInternalName);
1135 } 1135 }
1136 1136
1137 // The name of this type argument vector, e.g. "<T, dynamic, List<T>, int>". 1137 // The name of this type argument vector, e.g. "<T, dynamic, List<T>, int>".
(...skipping 12 matching lines...) Expand all
1150 // it was instantiated from a raw (null) instantiator, i.e. consider each type 1150 // it was instantiated from a raw (null) instantiator, i.e. consider each type
1151 // parameter as it would be first instantiated from a vector of dynamic types. 1151 // parameter as it would be first instantiated from a vector of dynamic types.
1152 // Consider only a prefix of length 'len'. 1152 // Consider only a prefix of length 'len'.
1153 bool IsRawInstantiatedRaw(intptr_t len) const { 1153 bool IsRawInstantiatedRaw(intptr_t len) const {
1154 return IsDynamicTypes(true, len); 1154 return IsDynamicTypes(true, len);
1155 } 1155 }
1156 1156
1157 // Check the subtype relationship, considering only a prefix of length 'len'. 1157 // Check the subtype relationship, considering only a prefix of length 'len'.
1158 bool IsSubtypeOf(const AbstractTypeArguments& other, 1158 bool IsSubtypeOf(const AbstractTypeArguments& other,
1159 intptr_t len, 1159 intptr_t len,
1160 Error* malformed_error) const { 1160 Error* bound_error) const {
1161 return TypeTest(kIsSubtypeOf, other, len, malformed_error); 1161 return TypeTest(kIsSubtypeOf, other, len, bound_error);
1162 } 1162 }
1163 1163
1164 // Check the 'more specific' relationship, considering only a prefix of 1164 // Check the 'more specific' relationship, considering only a prefix of
1165 // length 'len'. 1165 // length 'len'.
1166 bool IsMoreSpecificThan(const AbstractTypeArguments& other, 1166 bool IsMoreSpecificThan(const AbstractTypeArguments& other,
1167 intptr_t len, 1167 intptr_t len,
1168 Error* malformed_error) const { 1168 Error* bound_error) const {
1169 return TypeTest(kIsMoreSpecificThan, other, len, malformed_error); 1169 return TypeTest(kIsMoreSpecificThan, other, len, bound_error);
1170 } 1170 }
1171 1171
1172 bool Equals(const AbstractTypeArguments& other) const; 1172 bool Equals(const AbstractTypeArguments& other) const;
1173 1173
1174 // UNREACHABLEs as AbstractTypeArguments is an abstract class. 1174 // UNREACHABLEs as AbstractTypeArguments is an abstract class.
1175 virtual intptr_t Length() const; 1175 virtual intptr_t Length() const;
1176 virtual RawAbstractType* TypeAt(intptr_t index) const; 1176 virtual RawAbstractType* TypeAt(intptr_t index) const;
1177 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const; 1177 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const;
1178 virtual bool IsResolved() const; 1178 virtual bool IsResolved() const;
1179 virtual bool IsInstantiated() const; 1179 virtual bool IsInstantiated() const;
1180 virtual bool IsUninstantiatedIdentity() const; 1180 virtual bool IsUninstantiatedIdentity() const;
1181 virtual bool CanShareInstantiatorTypeArguments( 1181 virtual bool CanShareInstantiatorTypeArguments(
1182 const Class& instantiator_class) const; 1182 const Class& instantiator_class) const;
1183 virtual bool IsBounded() const; 1183 virtual bool IsBounded() const;
1184 1184
1185 virtual intptr_t Hash() const; 1185 virtual intptr_t Hash() const;
1186 1186
1187 private: 1187 private:
1188 // Check if this type argument vector consists solely of DynamicType, 1188 // Check if this type argument vector consists solely of DynamicType,
1189 // considering only a prefix of length 'len'. 1189 // considering only a prefix of length 'len'.
1190 // If raw_instantiated is true, consider each type parameter to be first 1190 // If raw_instantiated is true, consider each type parameter to be first
1191 // instantiated from a vector of dynamic types. 1191 // instantiated from a vector of dynamic types.
1192 bool IsDynamicTypes(bool raw_instantiated, intptr_t len) const; 1192 bool IsDynamicTypes(bool raw_instantiated, intptr_t len) const;
1193 1193
1194 // Check the subtype or 'more specific' relationship, considering only a 1194 // Check the subtype or 'more specific' relationship, considering only a
1195 // prefix of length 'len'. 1195 // prefix of length 'len'.
1196 bool TypeTest(TypeTestKind test_kind, 1196 bool TypeTest(TypeTestKind test_kind,
1197 const AbstractTypeArguments& other, 1197 const AbstractTypeArguments& other,
1198 intptr_t len, 1198 intptr_t len,
1199 Error* malformed_error) const; 1199 Error* bound_error) const;
1200 1200
1201 // Return the internal or public name of a subvector of this type argument 1201 // Return the internal or public name of a subvector of this type argument
1202 // vector, e.g. "<T, dynamic, List<T>, int>". 1202 // vector, e.g. "<T, dynamic, List<T>, int>".
1203 RawString* SubvectorName(intptr_t from_index, 1203 RawString* SubvectorName(intptr_t from_index,
1204 intptr_t len, 1204 intptr_t len,
1205 NameVisibility name_visibility) const; 1205 NameVisibility name_visibility) const;
1206 1206
1207 protected: 1207 protected:
1208 HEAP_OBJECT_IMPLEMENTATION(AbstractTypeArguments, Object); 1208 HEAP_OBJECT_IMPLEMENTATION(AbstractTypeArguments, Object);
1209 friend class AbstractType; 1209 friend class AbstractType;
(...skipping 14 matching lines...) Expand all
1224 virtual bool IsInstantiated() const; 1224 virtual bool IsInstantiated() const;
1225 virtual bool IsUninstantiatedIdentity() const; 1225 virtual bool IsUninstantiatedIdentity() const;
1226 virtual bool CanShareInstantiatorTypeArguments( 1226 virtual bool CanShareInstantiatorTypeArguments(
1227 const Class& instantiator_class) const; 1227 const Class& instantiator_class) const;
1228 virtual bool IsBounded() const; 1228 virtual bool IsBounded() const;
1229 // Canonicalize only if instantiated, otherwise returns 'this'. 1229 // Canonicalize only if instantiated, otherwise returns 'this'.
1230 virtual RawAbstractTypeArguments* Canonicalize() const; 1230 virtual RawAbstractTypeArguments* Canonicalize() const;
1231 1231
1232 virtual RawAbstractTypeArguments* InstantiateFrom( 1232 virtual RawAbstractTypeArguments* InstantiateFrom(
1233 const AbstractTypeArguments& instantiator_type_arguments, 1233 const AbstractTypeArguments& instantiator_type_arguments,
1234 Error* malformed_error) const; 1234 Error* bound_error) const;
1235 1235
1236 static const intptr_t kBytesPerElement = kWordSize; 1236 static const intptr_t kBytesPerElement = kWordSize;
1237 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; 1237 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement;
1238 1238
1239 static intptr_t length_offset() { 1239 static intptr_t length_offset() {
1240 return OFFSET_OF(RawTypeArguments, length_); 1240 return OFFSET_OF(RawTypeArguments, length_);
1241 } 1241 }
1242 1242
1243 static intptr_t InstanceSize() { 1243 static intptr_t InstanceSize() {
1244 ASSERT(sizeof(RawTypeArguments) == OFFSET_OF(RawTypeArguments, types_)); 1244 ASSERT(sizeof(RawTypeArguments) == OFFSET_OF(RawTypeArguments, types_));
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 String* error_message) const; 1670 String* error_message) const;
1671 1671
1672 // Fully qualified name uniquely identifying the function under gdb and during 1672 // Fully qualified name uniquely identifying the function under gdb and during
1673 // ast printing. The special ':' character, if present, is replaced by '_'. 1673 // ast printing. The special ':' character, if present, is replaced by '_'.
1674 const char* ToFullyQualifiedCString() const; 1674 const char* ToFullyQualifiedCString() const;
1675 1675
1676 // Returns true if this function has parameters that are compatible with the 1676 // Returns true if this function has parameters that are compatible with the
1677 // parameters of the other function in order for this function to override the 1677 // parameters of the other function in order for this function to override the
1678 // other function. 1678 // other function.
1679 bool HasCompatibleParametersWith(const Function& other, 1679 bool HasCompatibleParametersWith(const Function& other,
1680 Error* malformed_error) const; 1680 Error* bound_error) const;
1681 1681
1682 // Returns true if the type of this function is a subtype of the type of 1682 // Returns true if the type of this function is a subtype of the type of
1683 // the other function. 1683 // the other function.
1684 bool IsSubtypeOf(const AbstractTypeArguments& type_arguments, 1684 bool IsSubtypeOf(const AbstractTypeArguments& type_arguments,
1685 const Function& other, 1685 const Function& other,
1686 const AbstractTypeArguments& other_type_arguments, 1686 const AbstractTypeArguments& other_type_arguments,
1687 Error* malformed_error) const { 1687 Error* bound_error) const {
1688 return TypeTest(kIsSubtypeOf, 1688 return TypeTest(kIsSubtypeOf,
1689 type_arguments, 1689 type_arguments,
1690 other, 1690 other,
1691 other_type_arguments, 1691 other_type_arguments,
1692 malformed_error); 1692 bound_error);
1693 } 1693 }
1694 1694
1695 // Returns true if the type of this function is more specific than the type of 1695 // Returns true if the type of this function is more specific than the type of
1696 // the other function. 1696 // the other function.
1697 bool IsMoreSpecificThan(const AbstractTypeArguments& type_arguments, 1697 bool IsMoreSpecificThan(const AbstractTypeArguments& type_arguments,
1698 const Function& other, 1698 const Function& other,
1699 const AbstractTypeArguments& other_type_arguments, 1699 const AbstractTypeArguments& other_type_arguments,
1700 Error* malformed_error) const { 1700 Error* bound_error) const {
1701 return TypeTest(kIsMoreSpecificThan, 1701 return TypeTest(kIsMoreSpecificThan,
1702 type_arguments, 1702 type_arguments,
1703 other, 1703 other,
1704 other_type_arguments, 1704 other_type_arguments,
1705 malformed_error); 1705 bound_error);
1706 } 1706 }
1707 1707
1708 // Returns true if this function represents an explicit getter function. 1708 // Returns true if this function represents an explicit getter function.
1709 bool IsGetterFunction() const { 1709 bool IsGetterFunction() const {
1710 return kind() == RawFunction::kGetterFunction; 1710 return kind() == RawFunction::kGetterFunction;
1711 } 1711 }
1712 1712
1713 // Returns true if this function represents an implicit getter function. 1713 // Returns true if this function represents an implicit getter function.
1714 bool IsImplicitGetterFunction() const { 1714 bool IsImplicitGetterFunction() const {
1715 return kind() == RawFunction::kImplicitGetter; 1715 return kind() == RawFunction::kImplicitGetter;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 1842
1843 RawString* BuildSignature(bool instantiate, 1843 RawString* BuildSignature(bool instantiate,
1844 NameVisibility name_visibility, 1844 NameVisibility name_visibility,
1845 const AbstractTypeArguments& instantiator) const; 1845 const AbstractTypeArguments& instantiator) const;
1846 1846
1847 // Check the subtype or 'more specific' relationship. 1847 // Check the subtype or 'more specific' relationship.
1848 bool TypeTest(TypeTestKind test_kind, 1848 bool TypeTest(TypeTestKind test_kind,
1849 const AbstractTypeArguments& type_arguments, 1849 const AbstractTypeArguments& type_arguments,
1850 const Function& other, 1850 const Function& other,
1851 const AbstractTypeArguments& other_type_arguments, 1851 const AbstractTypeArguments& other_type_arguments,
1852 Error* malformed_error) const; 1852 Error* bound_error) const;
1853 1853
1854 // Checks the type of the formal parameter at the given position for 1854 // Checks the type of the formal parameter at the given position for
1855 // subtyping or 'more specific' relationship between the type of this function 1855 // subtyping or 'more specific' relationship between the type of this function
1856 // and the type of the other function. 1856 // and the type of the other function.
1857 bool TestParameterType(TypeTestKind test_kind, 1857 bool TestParameterType(TypeTestKind test_kind,
1858 intptr_t parameter_position, 1858 intptr_t parameter_position,
1859 intptr_t other_parameter_position, 1859 intptr_t other_parameter_position,
1860 const AbstractTypeArguments& type_arguments, 1860 const AbstractTypeArguments& type_arguments,
1861 const Function& other, 1861 const Function& other,
1862 const AbstractTypeArguments& other_type_arguments, 1862 const AbstractTypeArguments& other_type_arguments,
1863 Error* malformed_error) const; 1863 Error* bound_error) const;
1864 1864
1865 FINAL_HEAP_OBJECT_IMPLEMENTATION(Function, Object); 1865 FINAL_HEAP_OBJECT_IMPLEMENTATION(Function, Object);
1866 friend class Class; 1866 friend class Class;
1867 }; 1867 };
1868 1868
1869 1869
1870 class ClosureData: public Object { 1870 class ClosureData: public Object {
1871 public: 1871 public:
1872 static intptr_t InstanceSize() { 1872 static intptr_t InstanceSize() {
1873 return RoundedAllocationSize(sizeof(RawClosureData)); 1873 return RoundedAllocationSize(sizeof(RawClosureData));
(...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after
3699 } 3699 }
3700 3700
3701 RawType* GetType() const; 3701 RawType* GetType() const;
3702 3702
3703 virtual RawAbstractTypeArguments* GetTypeArguments() const; 3703 virtual RawAbstractTypeArguments* GetTypeArguments() const;
3704 virtual void SetTypeArguments(const AbstractTypeArguments& value) const; 3704 virtual void SetTypeArguments(const AbstractTypeArguments& value) const;
3705 3705
3706 // Check if the type of this instance is a subtype of the given type. 3706 // Check if the type of this instance is a subtype of the given type.
3707 bool IsInstanceOf(const AbstractType& type, 3707 bool IsInstanceOf(const AbstractType& type,
3708 const AbstractTypeArguments& type_instantiator, 3708 const AbstractTypeArguments& type_instantiator,
3709 Error* malformed_error) const; 3709 Error* bound_error) const;
3710 3710
3711 bool IsValidNativeIndex(int index) const { 3711 bool IsValidNativeIndex(int index) const {
3712 return ((index >= 0) && (index < clazz()->ptr()->num_native_fields_)); 3712 return ((index >= 0) && (index < clazz()->ptr()->num_native_fields_));
3713 } 3713 }
3714 3714
3715 inline intptr_t GetNativeField(Isolate* isolate, int index) const; 3715 inline intptr_t GetNativeField(Isolate* isolate, int index) const;
3716 void SetNativeField(int index, intptr_t value) const; 3716 void SetNativeField(int index, intptr_t value) const;
3717 3717
3718 // Returns true if the instance is a closure object. 3718 // Returns true if the instance is a closure object.
3719 bool IsClosure() const; 3719 bool IsClosure() const;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
3774 virtual bool HasResolvedTypeClass() const; 3774 virtual bool HasResolvedTypeClass() const;
3775 virtual RawClass* type_class() const; 3775 virtual RawClass* type_class() const;
3776 virtual RawUnresolvedClass* unresolved_class() const; 3776 virtual RawUnresolvedClass* unresolved_class() const;
3777 virtual RawAbstractTypeArguments* arguments() const; 3777 virtual RawAbstractTypeArguments* arguments() const;
3778 virtual intptr_t token_pos() const; 3778 virtual intptr_t token_pos() const;
3779 virtual bool IsInstantiated() const; 3779 virtual bool IsInstantiated() const;
3780 virtual bool Equals(const Instance& other) const; 3780 virtual bool Equals(const Instance& other) const;
3781 3781
3782 // Instantiate this type using the given type argument vector. 3782 // Instantiate this type using the given type argument vector.
3783 // Return a new type, or return 'this' if it is already instantiated. 3783 // Return a new type, or return 'this' if it is already instantiated.
3784 // If malformed_error is not NULL, it may be set to reflect a bound error. 3784 // If bound_error is not NULL, it may be set to reflect a bound error.
3785 virtual RawAbstractType* InstantiateFrom( 3785 virtual RawAbstractType* InstantiateFrom(
3786 const AbstractTypeArguments& instantiator_type_arguments, 3786 const AbstractTypeArguments& instantiator_type_arguments,
3787 Error* malformed_error) const; 3787 Error* bound_error) const;
3788 3788
3789 virtual RawInstance* CheckAndCanonicalize(const char** error_str) const { 3789 virtual RawInstance* CheckAndCanonicalize(const char** error_str) const {
3790 return Canonicalize(); 3790 return Canonicalize();
3791 } 3791 }
3792 3792
3793 // Return the canonical version of this type. 3793 // Return the canonical version of this type.
3794 virtual RawAbstractType* Canonicalize() const; 3794 virtual RawAbstractType* Canonicalize() const;
3795 3795
3796 // The name of this type, including the names of its type arguments, if any. 3796 // The name of this type, including the names of its type arguments, if any.
3797 virtual RawString* Name() const { 3797 virtual RawString* Name() const {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
3846 // Check if this type represents the 'num' type. 3846 // Check if this type represents the 'num' type.
3847 bool IsNumberType() const; 3847 bool IsNumberType() const;
3848 3848
3849 // Check if this type represents the 'String' type. 3849 // Check if this type represents the 'String' type.
3850 bool IsStringType() const; 3850 bool IsStringType() const;
3851 3851
3852 // Check if this type represents the 'Function' type. 3852 // Check if this type represents the 'Function' type.
3853 bool IsFunctionType() const; 3853 bool IsFunctionType() const;
3854 3854
3855 // Check the subtype relationship. 3855 // Check the subtype relationship.
3856 bool IsSubtypeOf(const AbstractType& other, Error* malformed_error) const { 3856 bool IsSubtypeOf(const AbstractType& other, Error* bound_error) const {
3857 return TypeTest(kIsSubtypeOf, other, malformed_error); 3857 return TypeTest(kIsSubtypeOf, other, bound_error);
3858 } 3858 }
3859 3859
3860 // Check the 'more specific' relationship. 3860 // Check the 'more specific' relationship.
3861 bool IsMoreSpecificThan(const AbstractType& other, 3861 bool IsMoreSpecificThan(const AbstractType& other,
3862 Error* malformed_error) const { 3862 Error* bound_error) const {
3863 return TypeTest(kIsMoreSpecificThan, other, malformed_error); 3863 return TypeTest(kIsMoreSpecificThan, other, bound_error);
3864 } 3864 }
3865 3865
3866 private: 3866 private:
3867 // Check the subtype or 'more specific' relationship. 3867 // Check the subtype or 'more specific' relationship.
3868 bool TypeTest(TypeTestKind test_kind, 3868 bool TypeTest(TypeTestKind test_kind,
3869 const AbstractType& other, 3869 const AbstractType& other,
3870 Error* malformed_error) const; 3870 Error* bound_error) const;
3871 3871
3872 // Return the internal or public name of this type, including the names of its 3872 // Return the internal or public name of this type, including the names of its
3873 // type arguments, if any. 3873 // type arguments, if any.
3874 RawString* BuildName(NameVisibility visibility) const; 3874 RawString* BuildName(NameVisibility visibility) const;
3875 3875
3876 protected: 3876 protected:
3877 HEAP_OBJECT_IMPLEMENTATION(AbstractType, Instance); 3877 HEAP_OBJECT_IMPLEMENTATION(AbstractType, Instance);
3878 friend class AbstractTypeArguments; 3878 friend class AbstractTypeArguments;
3879 friend class Class; 3879 friend class Class;
3880 friend class Function; 3880 friend class Function;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
4020 virtual bool HasResolvedTypeClass() const { return false; } 4020 virtual bool HasResolvedTypeClass() const { return false; }
4021 RawClass* parameterized_class() const { 4021 RawClass* parameterized_class() const {
4022 return raw_ptr()->parameterized_class_; 4022 return raw_ptr()->parameterized_class_;
4023 } 4023 }
4024 RawString* name() const { return raw_ptr()->name_; } 4024 RawString* name() const { return raw_ptr()->name_; }
4025 intptr_t index() const { return raw_ptr()->index_; } 4025 intptr_t index() const { return raw_ptr()->index_; }
4026 void set_index(intptr_t value) const; 4026 void set_index(intptr_t value) const;
4027 RawAbstractType* bound() const { return raw_ptr()->bound_; } 4027 RawAbstractType* bound() const { return raw_ptr()->bound_; }
4028 void set_bound(const AbstractType& value) const; 4028 void set_bound(const AbstractType& value) const;
4029 // Returns true if bounded_type is below upper_bound, otherwise return false 4029 // Returns true if bounded_type is below upper_bound, otherwise return false
4030 // and set malformed_error if not NULL. 4030 // and set bound_error if not NULL.
4031 bool CheckBound(const AbstractType& bounded_type, 4031 bool CheckBound(const AbstractType& bounded_type,
4032 const AbstractType& upper_bound, 4032 const AbstractType& upper_bound,
4033 Error* malformed_error) const; 4033 Error* bound_error) const;
4034 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } 4034 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; }
4035 virtual bool IsInstantiated() const { return false; } 4035 virtual bool IsInstantiated() const { return false; }
4036 virtual bool Equals(const Instance& other) const; 4036 virtual bool Equals(const Instance& other) const;
4037 virtual RawAbstractType* InstantiateFrom( 4037 virtual RawAbstractType* InstantiateFrom(
4038 const AbstractTypeArguments& instantiator_type_arguments, 4038 const AbstractTypeArguments& instantiator_type_arguments,
4039 Error* malformed_error) const; 4039 Error* bound_error) const;
4040 virtual RawAbstractType* Canonicalize() const { return raw(); } 4040 virtual RawAbstractType* Canonicalize() const { return raw(); }
4041 4041
4042 virtual intptr_t Hash() const; 4042 virtual intptr_t Hash() const;
4043 4043
4044 static intptr_t InstanceSize() { 4044 static intptr_t InstanceSize() {
4045 return RoundedAllocationSize(sizeof(RawTypeParameter)); 4045 return RoundedAllocationSize(sizeof(RawTypeParameter));
4046 } 4046 }
4047 4047
4048 static RawTypeParameter* New(const Class& parameterized_class, 4048 static RawTypeParameter* New(const Class& parameterized_class,
4049 intptr_t index, 4049 intptr_t index,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
4101 } 4101 }
4102 virtual intptr_t token_pos() const { 4102 virtual intptr_t token_pos() const {
4103 return AbstractType::Handle(type()).token_pos(); 4103 return AbstractType::Handle(type()).token_pos();
4104 } 4104 }
4105 virtual bool IsInstantiated() const { 4105 virtual bool IsInstantiated() const {
4106 return AbstractType::Handle(type()).IsInstantiated(); 4106 return AbstractType::Handle(type()).IsInstantiated();
4107 } 4107 }
4108 virtual bool Equals(const Instance& other) const; 4108 virtual bool Equals(const Instance& other) const;
4109 virtual RawAbstractType* InstantiateFrom( 4109 virtual RawAbstractType* InstantiateFrom(
4110 const AbstractTypeArguments& instantiator_type_arguments, 4110 const AbstractTypeArguments& instantiator_type_arguments,
4111 Error* malformed_error) const; 4111 Error* bound_error) const;
4112 virtual RawAbstractType* Canonicalize() const { return raw(); } 4112 virtual RawAbstractType* Canonicalize() const { return raw(); }
4113 4113
4114 virtual intptr_t Hash() const; 4114 virtual intptr_t Hash() const;
4115 4115
4116 static intptr_t InstanceSize() { 4116 static intptr_t InstanceSize() {
4117 return RoundedAllocationSize(sizeof(RawBoundedType)); 4117 return RoundedAllocationSize(sizeof(RawBoundedType));
4118 } 4118 }
4119 4119
4120 static RawBoundedType* New(const AbstractType& type, 4120 static RawBoundedType* New(const AbstractType& type,
4121 const AbstractType& bound, 4121 const AbstractType& bound,
(...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after
6131 6131
6132 6132
6133 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6133 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6134 intptr_t index) { 6134 intptr_t index) {
6135 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6135 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6136 } 6136 }
6137 6137
6138 } // namespace dart 6138 } // namespace dart
6139 6139
6140 #endif // VM_OBJECT_H_ 6140 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_mips.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698