| 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 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1520 void set_ident(const String& ident) const; | 1520 void set_ident(const String& ident) const; |
| 1521 void set_token_pos(intptr_t token_pos) const; | 1521 void set_token_pos(intptr_t token_pos) const; |
| 1522 | 1522 |
| 1523 static RawUnresolvedClass* New(); | 1523 static RawUnresolvedClass* New(); |
| 1524 | 1524 |
| 1525 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object); | 1525 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object); |
| 1526 friend class Class; | 1526 friend class Class; |
| 1527 }; | 1527 }; |
| 1528 | 1528 |
| 1529 | 1529 |
| 1530 typedef ZoneGrowableArray<const AbstractType*> Trail; |
| 1531 typedef ZoneGrowableArray<const AbstractType*>* TrailPtr; |
| 1532 |
| 1530 // A TypeArguments is an array of AbstractType. | 1533 // A TypeArguments is an array of AbstractType. |
| 1531 class TypeArguments : public Object { | 1534 class TypeArguments : public Object { |
| 1532 public: | 1535 public: |
| 1533 intptr_t Length() const; | 1536 intptr_t Length() const; |
| 1534 RawAbstractType* TypeAt(intptr_t index) const; | 1537 RawAbstractType* TypeAt(intptr_t index) const; |
| 1535 static intptr_t type_at_offset(intptr_t index) { | 1538 static intptr_t type_at_offset(intptr_t index) { |
| 1536 return OFFSET_OF_RETURNED_VALUE( | 1539 return OFFSET_OF_RETURNED_VALUE( |
| 1537 RawTypeArguments, types) + index * kWordSize; | 1540 RawTypeArguments, types) + index * kWordSize; |
| 1538 } | 1541 } |
| 1539 void SetTypeAt(intptr_t index, const AbstractType& value) const; | 1542 void SetTypeAt(intptr_t index, const AbstractType& value) const; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 intptr_t len, | 1588 intptr_t len, |
| 1586 Error* bound_error) const { | 1589 Error* bound_error) const { |
| 1587 return TypeTest(kIsMoreSpecificThan, other, from_index, len, bound_error); | 1590 return TypeTest(kIsMoreSpecificThan, other, from_index, len, bound_error); |
| 1588 } | 1591 } |
| 1589 | 1592 |
| 1590 // Check if the vectors are equal (they may be null). | 1593 // Check if the vectors are equal (they may be null). |
| 1591 bool Equals(const TypeArguments& other) const { | 1594 bool Equals(const TypeArguments& other) const { |
| 1592 return IsSubvectorEquivalent(other, 0, IsNull() ? 0 : Length()); | 1595 return IsSubvectorEquivalent(other, 0, IsNull() ? 0 : Length()); |
| 1593 } | 1596 } |
| 1594 | 1597 |
| 1595 bool IsEquivalent(const TypeArguments& other, | 1598 bool IsEquivalent(const TypeArguments& other, TrailPtr trail = NULL) const { |
| 1596 GrowableObjectArray* trail = NULL) const { | |
| 1597 return IsSubvectorEquivalent(other, 0, IsNull() ? 0 : Length(), trail); | 1599 return IsSubvectorEquivalent(other, 0, IsNull() ? 0 : Length(), trail); |
| 1598 } | 1600 } |
| 1599 bool IsSubvectorEquivalent(const TypeArguments& other, | 1601 bool IsSubvectorEquivalent(const TypeArguments& other, |
| 1600 intptr_t from_index, | 1602 intptr_t from_index, |
| 1601 intptr_t len, | 1603 intptr_t len, |
| 1602 GrowableObjectArray* trail = NULL) const; | 1604 TrailPtr trail = NULL) const; |
| 1603 | 1605 |
| 1604 // Check if the vector is instantiated (it must not be null). | 1606 // Check if the vector is instantiated (it must not be null). |
| 1605 bool IsInstantiated(GrowableObjectArray* trail = NULL) const { | 1607 bool IsInstantiated(TrailPtr trail = NULL) const { |
| 1606 return IsSubvectorInstantiated(0, Length(), trail); | 1608 return IsSubvectorInstantiated(0, Length(), trail); |
| 1607 } | 1609 } |
| 1608 bool IsSubvectorInstantiated(intptr_t from_index, | 1610 bool IsSubvectorInstantiated(intptr_t from_index, |
| 1609 intptr_t len, | 1611 intptr_t len, |
| 1610 GrowableObjectArray* trail = NULL) const; | 1612 TrailPtr trail = NULL) const; |
| 1611 bool IsUninstantiatedIdentity() const; | 1613 bool IsUninstantiatedIdentity() const; |
| 1612 bool CanShareInstantiatorTypeArguments(const Class& instantiator_class) const; | 1614 bool CanShareInstantiatorTypeArguments(const Class& instantiator_class) const; |
| 1613 | 1615 |
| 1614 // Return true if all types of this vector are respectively, resolved, | 1616 // Return true if all types of this vector are respectively, resolved, |
| 1615 // finalized, or bounded. | 1617 // finalized, or bounded. |
| 1616 bool IsResolved() const; | 1618 bool IsResolved() const; |
| 1617 bool IsFinalized() const; | 1619 bool IsFinalized() const; |
| 1618 bool IsBounded() const; | 1620 bool IsBounded() const; |
| 1619 | 1621 |
| 1620 // Return true if this vector contains a recursive type argument. | 1622 // Return true if this vector contains a recursive type argument. |
| 1621 bool IsRecursive() const; | 1623 bool IsRecursive() const; |
| 1622 | 1624 |
| 1623 // Clone this type argument vector and clone all unfinalized type arguments. | 1625 // Clone this type argument vector and clone all unfinalized type arguments. |
| 1624 // Finalized type arguments are shared. | 1626 // Finalized type arguments are shared. |
| 1625 RawTypeArguments* CloneUnfinalized() const; | 1627 RawTypeArguments* CloneUnfinalized() const; |
| 1626 | 1628 |
| 1627 // Clone this type argument vector and clone all uninstantiated type | 1629 // Clone this type argument vector and clone all uninstantiated type |
| 1628 // arguments, changing the class owner of type parameters. | 1630 // arguments, changing the class owner of type parameters. |
| 1629 // Instantiated type arguments are shared. | 1631 // Instantiated type arguments are shared. |
| 1630 RawTypeArguments* CloneUninstantiated( | 1632 RawTypeArguments* CloneUninstantiated( |
| 1631 const Class& new_owner, | 1633 const Class& new_owner, TrailPtr trail = NULL) const; |
| 1632 GrowableObjectArray* trail = NULL) const; | |
| 1633 | 1634 |
| 1634 // Canonicalize only if instantiated, otherwise returns 'this'. | 1635 // Canonicalize only if instantiated, otherwise returns 'this'. |
| 1635 RawTypeArguments* Canonicalize(GrowableObjectArray* trail = NULL) const; | 1636 RawTypeArguments* Canonicalize(TrailPtr trail = NULL) const; |
| 1636 | 1637 |
| 1637 // Return 'this' if this type argument vector is instantiated, i.e. if it does | 1638 // Return 'this' if this type argument vector is instantiated, i.e. if it does |
| 1638 // not refer to type parameters. Otherwise, return a new type argument vector | 1639 // not refer to type parameters. Otherwise, return a new type argument vector |
| 1639 // where each reference to a type parameter is replaced with the corresponding | 1640 // where each reference to a type parameter is replaced with the corresponding |
| 1640 // type of the instantiator type argument vector. | 1641 // type of the instantiator type argument vector. |
| 1641 // If bound_error is not NULL, it may be set to reflect a bound error. | 1642 // If bound_error is not NULL, it may be set to reflect a bound error. |
| 1642 RawTypeArguments* InstantiateFrom( | 1643 RawTypeArguments* InstantiateFrom( |
| 1643 const TypeArguments& instantiator_type_arguments, | 1644 const TypeArguments& instantiator_type_arguments, |
| 1644 Error* bound_error, | 1645 Error* bound_error, |
| 1645 GrowableObjectArray* trail = NULL) const; | 1646 TrailPtr trail = NULL) const; |
| 1646 | 1647 |
| 1647 // Runtime instantiation with canonicalization. Not to be used during type | 1648 // Runtime instantiation with canonicalization. Not to be used during type |
| 1648 // finalization at compile time. | 1649 // finalization at compile time. |
| 1649 RawTypeArguments* InstantiateAndCanonicalizeFrom( | 1650 RawTypeArguments* InstantiateAndCanonicalizeFrom( |
| 1650 const TypeArguments& instantiator_type_arguments, | 1651 const TypeArguments& instantiator_type_arguments, |
| 1651 Error* bound_error) const; | 1652 Error* bound_error) const; |
| 1652 | 1653 |
| 1653 // Return true if this type argument vector has cached instantiations. | 1654 // Return true if this type argument vector has cached instantiations. |
| 1654 bool HasInstantiations() const; | 1655 bool HasInstantiations() const; |
| 1655 | 1656 |
| (...skipping 3308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4964 virtual bool IsMalbounded() const; | 4965 virtual bool IsMalbounded() const; |
| 4965 virtual bool IsMalformedOrMalbounded() const; | 4966 virtual bool IsMalformedOrMalbounded() const; |
| 4966 virtual RawLanguageError* error() const; | 4967 virtual RawLanguageError* error() const; |
| 4967 virtual void set_error(const LanguageError& value) const; | 4968 virtual void set_error(const LanguageError& value) const; |
| 4968 virtual bool IsResolved() const; | 4969 virtual bool IsResolved() const; |
| 4969 virtual bool HasResolvedTypeClass() const; | 4970 virtual bool HasResolvedTypeClass() const; |
| 4970 virtual RawClass* type_class() const; | 4971 virtual RawClass* type_class() const; |
| 4971 virtual RawUnresolvedClass* unresolved_class() const; | 4972 virtual RawUnresolvedClass* unresolved_class() const; |
| 4972 virtual RawTypeArguments* arguments() const; | 4973 virtual RawTypeArguments* arguments() const; |
| 4973 virtual intptr_t token_pos() const; | 4974 virtual intptr_t token_pos() const; |
| 4974 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const; | 4975 virtual bool IsInstantiated(TrailPtr trail = NULL) const; |
| 4975 virtual bool CanonicalizeEquals(const Instance& other) const { | 4976 virtual bool CanonicalizeEquals(const Instance& other) const { |
| 4976 return Equals(other); | 4977 return Equals(other); |
| 4977 } | 4978 } |
| 4978 virtual bool Equals(const Instance& other) const { | 4979 virtual bool Equals(const Instance& other) const { |
| 4979 return IsEquivalent(other); | 4980 return IsEquivalent(other); |
| 4980 } | 4981 } |
| 4981 virtual bool IsEquivalent(const Instance& other, | 4982 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const; |
| 4982 GrowableObjectArray* trail = NULL) const; | |
| 4983 virtual bool IsRecursive() const; | 4983 virtual bool IsRecursive() const; |
| 4984 | 4984 |
| 4985 // Instantiate this type using the given type argument vector. | 4985 // Instantiate this type using the given type argument vector. |
| 4986 // Return a new type, or return 'this' if it is already instantiated. | 4986 // Return a new type, or return 'this' if it is already instantiated. |
| 4987 // If bound_error is not NULL, it may be set to reflect a bound error. | 4987 // If bound_error is not NULL, it may be set to reflect a bound error. |
| 4988 virtual RawAbstractType* InstantiateFrom( | 4988 virtual RawAbstractType* InstantiateFrom( |
| 4989 const TypeArguments& instantiator_type_arguments, | 4989 const TypeArguments& instantiator_type_arguments, |
| 4990 Error* bound_error, | 4990 Error* bound_error, |
| 4991 GrowableObjectArray* trail = NULL) const; | 4991 TrailPtr trail = NULL) const; |
| 4992 | 4992 |
| 4993 // Return a clone of this unfinalized type or the type itself if it is | 4993 // Return a clone of this unfinalized type or the type itself if it is |
| 4994 // already finalized. Apply recursively to type arguments, i.e. finalized | 4994 // already finalized. Apply recursively to type arguments, i.e. finalized |
| 4995 // type arguments of an unfinalized type are not cloned, but shared. | 4995 // type arguments of an unfinalized type are not cloned, but shared. |
| 4996 virtual RawAbstractType* CloneUnfinalized() const; | 4996 virtual RawAbstractType* CloneUnfinalized() const; |
| 4997 | 4997 |
| 4998 // Return a clone of this uninstantiated type where all references to type | 4998 // Return a clone of this uninstantiated type where all references to type |
| 4999 // parameters are replaced with references to type parameters of the same name | 4999 // parameters are replaced with references to type parameters of the same name |
| 5000 // but belonging to the new owner class. | 5000 // but belonging to the new owner class. |
| 5001 // Apply recursively to type arguments, i.e. instantiated type arguments of | 5001 // Apply recursively to type arguments, i.e. instantiated type arguments of |
| 5002 // an uninstantiated type are not cloned, but shared. | 5002 // an uninstantiated type are not cloned, but shared. |
| 5003 virtual RawAbstractType* CloneUninstantiated( | 5003 virtual RawAbstractType* CloneUninstantiated( |
| 5004 const Class& new_owner, | 5004 const Class& new_owner, TrailPtr trail = NULL) const; |
| 5005 GrowableObjectArray* trail = NULL) const; | |
| 5006 | 5005 |
| 5007 virtual RawInstance* CheckAndCanonicalize(const char** error_str) const { | 5006 virtual RawInstance* CheckAndCanonicalize(const char** error_str) const { |
| 5008 return Canonicalize(); | 5007 return Canonicalize(); |
| 5009 } | 5008 } |
| 5010 | 5009 |
| 5011 // Return the canonical version of this type. | 5010 // Return the canonical version of this type. |
| 5012 virtual RawAbstractType* Canonicalize( | 5011 virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const; |
| 5013 GrowableObjectArray* trail = NULL) const; | |
| 5014 | 5012 |
| 5015 // Return the object associated with the receiver in the trail or | 5013 // Return the object associated with the receiver in the trail or |
| 5016 // Object::null() if the receiver is not contained in the trail. | 5014 // AbstractType::null() if the receiver is not contained in the trail. |
| 5017 RawObject* OnlyBuddyInTrail(GrowableObjectArray* trail) const; | 5015 RawAbstractType* OnlyBuddyInTrail(TrailPtr trail) const; |
| 5018 | 5016 |
| 5019 // If the trail is null, allocate a trail, add the pair <receiver, buddy> to | 5017 // If the trail is null, allocate a trail, add the pair <receiver, buddy> to |
| 5020 // the trail. The receiver may only be added once with its only buddy. | 5018 // the trail. The receiver may only be added once with its only buddy. |
| 5021 void AddOnlyBuddyToTrail(GrowableObjectArray** trail, | 5019 void AddOnlyBuddyToTrail(TrailPtr* trail, const AbstractType& buddy) const; |
| 5022 const Object& buddy) const; | |
| 5023 | 5020 |
| 5024 // The name of this type, including the names of its type arguments, if any. | 5021 // The name of this type, including the names of its type arguments, if any. |
| 5025 virtual RawString* Name() const { | 5022 virtual RawString* Name() const { |
| 5026 return BuildName(kInternalName); | 5023 return BuildName(kInternalName); |
| 5027 } | 5024 } |
| 5028 | 5025 |
| 5029 virtual RawString* PrettyName() const { | 5026 virtual RawString* PrettyName() const { |
| 5030 return BuildName(kPrettyName); | 5027 return BuildName(kPrettyName); |
| 5031 } | 5028 } |
| 5032 | 5029 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5151 return raw_ptr()->type_state_ >= RawType::kResolved; | 5148 return raw_ptr()->type_state_ >= RawType::kResolved; |
| 5152 } | 5149 } |
| 5153 void set_is_resolved() const; | 5150 void set_is_resolved() const; |
| 5154 virtual bool HasResolvedTypeClass() const; // Own type class resolved. | 5151 virtual bool HasResolvedTypeClass() const; // Own type class resolved. |
| 5155 virtual RawClass* type_class() const; | 5152 virtual RawClass* type_class() const; |
| 5156 void set_type_class(const Object& value) const; | 5153 void set_type_class(const Object& value) const; |
| 5157 virtual RawUnresolvedClass* unresolved_class() const; | 5154 virtual RawUnresolvedClass* unresolved_class() const; |
| 5158 virtual RawTypeArguments* arguments() const; | 5155 virtual RawTypeArguments* arguments() const; |
| 5159 void set_arguments(const TypeArguments& value) const; | 5156 void set_arguments(const TypeArguments& value) const; |
| 5160 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } | 5157 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } |
| 5161 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const; | 5158 virtual bool IsInstantiated(TrailPtr trail = NULL) const; |
| 5162 virtual bool IsEquivalent(const Instance& other, | 5159 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const; |
| 5163 GrowableObjectArray* trail = NULL) const; | |
| 5164 virtual bool IsRecursive() const; | 5160 virtual bool IsRecursive() const; |
| 5165 virtual RawAbstractType* InstantiateFrom( | 5161 virtual RawAbstractType* InstantiateFrom( |
| 5166 const TypeArguments& instantiator_type_arguments, | 5162 const TypeArguments& instantiator_type_arguments, |
| 5167 Error* malformed_error, | 5163 Error* malformed_error, |
| 5168 GrowableObjectArray* trail = NULL) const; | 5164 TrailPtr trail = NULL) const; |
| 5169 virtual RawAbstractType* CloneUnfinalized() const; | 5165 virtual RawAbstractType* CloneUnfinalized() const; |
| 5170 virtual RawAbstractType* CloneUninstantiated( | 5166 virtual RawAbstractType* CloneUninstantiated( |
| 5171 const Class& new_owner, | 5167 const Class& new_owner, |
| 5172 GrowableObjectArray* trail = NULL) const; | 5168 TrailPtr trail = NULL) const; |
| 5173 virtual RawAbstractType* Canonicalize( | 5169 virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const; |
| 5174 GrowableObjectArray* trail = NULL) const; | |
| 5175 | 5170 |
| 5176 virtual intptr_t Hash() const; | 5171 virtual intptr_t Hash() const; |
| 5177 | 5172 |
| 5178 static intptr_t InstanceSize() { | 5173 static intptr_t InstanceSize() { |
| 5179 return RoundedAllocationSize(sizeof(RawType)); | 5174 return RoundedAllocationSize(sizeof(RawType)); |
| 5180 } | 5175 } |
| 5181 | 5176 |
| 5182 // The type of the literal 'null'. | 5177 // The type of the literal 'null'. |
| 5183 static RawType* NullType(); | 5178 static RawType* NullType(); |
| 5184 | 5179 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5273 void set_type(const AbstractType& value) const; | 5268 void set_type(const AbstractType& value) const; |
| 5274 virtual RawClass* type_class() const { | 5269 virtual RawClass* type_class() const { |
| 5275 return AbstractType::Handle(type()).type_class(); | 5270 return AbstractType::Handle(type()).type_class(); |
| 5276 } | 5271 } |
| 5277 virtual RawTypeArguments* arguments() const { | 5272 virtual RawTypeArguments* arguments() const { |
| 5278 return AbstractType::Handle(type()).arguments(); | 5273 return AbstractType::Handle(type()).arguments(); |
| 5279 } | 5274 } |
| 5280 virtual intptr_t token_pos() const { | 5275 virtual intptr_t token_pos() const { |
| 5281 return AbstractType::Handle(type()).token_pos(); | 5276 return AbstractType::Handle(type()).token_pos(); |
| 5282 } | 5277 } |
| 5283 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const; | 5278 virtual bool IsInstantiated(TrailPtr trail = NULL) const; |
| 5284 virtual bool IsEquivalent(const Instance& other, | 5279 virtual bool IsEquivalent(const Instance& other, |
| 5285 GrowableObjectArray* trail = NULL) const; | 5280 TrailPtr trail = NULL) const; |
| 5286 virtual bool IsRecursive() const { return true; } | 5281 virtual bool IsRecursive() const { return true; } |
| 5287 virtual RawTypeRef* InstantiateFrom( | 5282 virtual RawTypeRef* InstantiateFrom( |
| 5288 const TypeArguments& instantiator_type_arguments, | 5283 const TypeArguments& instantiator_type_arguments, |
| 5289 Error* bound_error, | 5284 Error* bound_error, |
| 5290 GrowableObjectArray* trail = NULL) const; | 5285 TrailPtr trail = NULL) const; |
| 5291 virtual RawTypeRef* CloneUninstantiated( | 5286 virtual RawTypeRef* CloneUninstantiated( |
| 5292 const Class& new_owner, | 5287 const Class& new_owner, |
| 5293 GrowableObjectArray* trail = NULL) const; | 5288 TrailPtr trail = NULL) const; |
| 5294 virtual RawAbstractType* Canonicalize( | 5289 virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const; |
| 5295 GrowableObjectArray* trail = NULL) const; | |
| 5296 | 5290 |
| 5297 virtual intptr_t Hash() const; | 5291 virtual intptr_t Hash() const; |
| 5298 | 5292 |
| 5299 // Return true if the receiver is contained in the trail. | 5293 // Return true if the receiver is contained in the trail. |
| 5300 // Otherwise, if the trail is null, allocate a trail, then add the receiver to | 5294 // Otherwise, if the trail is null, allocate a trail, then add the receiver to |
| 5301 // the trail and return false. | 5295 // the trail and return false. |
| 5302 bool TestAndAddToTrail(GrowableObjectArray** trail) const; | 5296 bool TestAndAddToTrail(TrailPtr* trail) const; |
| 5303 | 5297 |
| 5304 // Return true if the pair <receiver, buddy> is contained in the trail. | 5298 // Return true if the pair <receiver, buddy> is contained in the trail. |
| 5305 // Otherwise, if the trail is null, allocate a trail, add the pair <receiver, | 5299 // Otherwise, if the trail is null, allocate a trail, add the pair <receiver, |
| 5306 // buddy> to the trail and return false. | 5300 // buddy> to the trail and return false. |
| 5307 // The receiver may be added several times, each time with a different buddy. | 5301 // The receiver may be added several times, each time with a different buddy. |
| 5308 bool TestAndAddBuddyToTrail(GrowableObjectArray** trail, | 5302 bool TestAndAddBuddyToTrail(TrailPtr* trail, const AbstractType& buddy) const; |
| 5309 const Object& buddy) const; | |
| 5310 | 5303 |
| 5311 static intptr_t InstanceSize() { | 5304 static intptr_t InstanceSize() { |
| 5312 return RoundedAllocationSize(sizeof(RawTypeRef)); | 5305 return RoundedAllocationSize(sizeof(RawTypeRef)); |
| 5313 } | 5306 } |
| 5314 | 5307 |
| 5315 static RawTypeRef* New(const AbstractType& type); | 5308 static RawTypeRef* New(const AbstractType& type); |
| 5316 | 5309 |
| 5317 private: | 5310 private: |
| 5318 static RawTypeRef* New(); | 5311 static RawTypeRef* New(); |
| 5319 | 5312 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5354 RawAbstractType* bound() const { return raw_ptr()->bound_; } | 5347 RawAbstractType* bound() const { return raw_ptr()->bound_; } |
| 5355 void set_bound(const AbstractType& value) const; | 5348 void set_bound(const AbstractType& value) const; |
| 5356 // Returns true if bounded_type is below upper_bound, otherwise return false | 5349 // Returns true if bounded_type is below upper_bound, otherwise return false |
| 5357 // and set bound_error if both bounded_type and upper_bound are instantiated. | 5350 // and set bound_error if both bounded_type and upper_bound are instantiated. |
| 5358 // If one or both are not instantiated, returning false only means that the | 5351 // If one or both are not instantiated, returning false only means that the |
| 5359 // bound cannot be checked yet and this is not an error. | 5352 // bound cannot be checked yet and this is not an error. |
| 5360 bool CheckBound(const AbstractType& bounded_type, | 5353 bool CheckBound(const AbstractType& bounded_type, |
| 5361 const AbstractType& upper_bound, | 5354 const AbstractType& upper_bound, |
| 5362 Error* bound_error) const; | 5355 Error* bound_error) const; |
| 5363 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } | 5356 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } |
| 5364 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const { | 5357 virtual bool IsInstantiated(TrailPtr trail = NULL) const { |
| 5365 return false; | 5358 return false; |
| 5366 } | 5359 } |
| 5367 virtual bool IsEquivalent(const Instance& other, | 5360 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const; |
| 5368 GrowableObjectArray* trail = NULL) const; | |
| 5369 virtual bool IsRecursive() const { return false; } | 5361 virtual bool IsRecursive() const { return false; } |
| 5370 virtual RawAbstractType* InstantiateFrom( | 5362 virtual RawAbstractType* InstantiateFrom( |
| 5371 const TypeArguments& instantiator_type_arguments, | 5363 const TypeArguments& instantiator_type_arguments, |
| 5372 Error* bound_error, | 5364 Error* bound_error, |
| 5373 GrowableObjectArray* trail = NULL) const; | 5365 TrailPtr trail = NULL) const; |
| 5374 virtual RawAbstractType* CloneUnfinalized() const; | 5366 virtual RawAbstractType* CloneUnfinalized() const; |
| 5375 virtual RawAbstractType* CloneUninstantiated( | 5367 virtual RawAbstractType* CloneUninstantiated( |
| 5376 const Class& new_owner, | 5368 const Class& new_owner, TrailPtr trail = NULL) const; |
| 5377 GrowableObjectArray* trail = NULL) const; | 5369 virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const { |
| 5378 virtual RawAbstractType* Canonicalize( | |
| 5379 GrowableObjectArray* trail = NULL) const { | |
| 5380 return raw(); | 5370 return raw(); |
| 5381 } | 5371 } |
| 5382 | 5372 |
| 5383 virtual intptr_t Hash() const; | 5373 virtual intptr_t Hash() const; |
| 5384 | 5374 |
| 5385 static intptr_t InstanceSize() { | 5375 static intptr_t InstanceSize() { |
| 5386 return RoundedAllocationSize(sizeof(RawTypeParameter)); | 5376 return RoundedAllocationSize(sizeof(RawTypeParameter)); |
| 5387 } | 5377 } |
| 5388 | 5378 |
| 5389 static RawTypeParameter* New(const Class& parameterized_class, | 5379 static RawTypeParameter* New(const Class& parameterized_class, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5437 return AbstractType::Handle(type()).arguments(); | 5427 return AbstractType::Handle(type()).arguments(); |
| 5438 } | 5428 } |
| 5439 RawAbstractType* type() const { return raw_ptr()->type_; } | 5429 RawAbstractType* type() const { return raw_ptr()->type_; } |
| 5440 RawAbstractType* bound() const { return raw_ptr()->bound_; } | 5430 RawAbstractType* bound() const { return raw_ptr()->bound_; } |
| 5441 RawTypeParameter* type_parameter() const { | 5431 RawTypeParameter* type_parameter() const { |
| 5442 return raw_ptr()->type_parameter_; | 5432 return raw_ptr()->type_parameter_; |
| 5443 } | 5433 } |
| 5444 virtual intptr_t token_pos() const { | 5434 virtual intptr_t token_pos() const { |
| 5445 return AbstractType::Handle(type()).token_pos(); | 5435 return AbstractType::Handle(type()).token_pos(); |
| 5446 } | 5436 } |
| 5447 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const { | 5437 virtual bool IsInstantiated(TrailPtr trail = NULL) const { |
| 5448 // It is not possible to encounter an instantiated bounded type with an | 5438 // It is not possible to encounter an instantiated bounded type with an |
| 5449 // uninstantiated upper bound. Therefore, we do not need to check if the | 5439 // uninstantiated upper bound. Therefore, we do not need to check if the |
| 5450 // bound is instantiated. Moreover, doing so could lead into cycles, as in | 5440 // bound is instantiated. Moreover, doing so could lead into cycles, as in |
| 5451 // class C<T extends C<C>> { }. | 5441 // class C<T extends C<C>> { }. |
| 5452 return AbstractType::Handle(type()).IsInstantiated(); | 5442 return AbstractType::Handle(type()).IsInstantiated(); |
| 5453 } | 5443 } |
| 5454 virtual bool IsEquivalent(const Instance& other, | 5444 virtual bool IsEquivalent(const Instance& other, TrailPtr trail = NULL) const; |
| 5455 GrowableObjectArray* trail = NULL) const; | |
| 5456 virtual bool IsRecursive() const; | 5445 virtual bool IsRecursive() const; |
| 5457 virtual RawAbstractType* InstantiateFrom( | 5446 virtual RawAbstractType* InstantiateFrom( |
| 5458 const TypeArguments& instantiator_type_arguments, | 5447 const TypeArguments& instantiator_type_arguments, |
| 5459 Error* bound_error, | 5448 Error* bound_error, |
| 5460 GrowableObjectArray* trail = NULL) const; | 5449 TrailPtr trail = NULL) const; |
| 5461 virtual RawAbstractType* CloneUnfinalized() const; | 5450 virtual RawAbstractType* CloneUnfinalized() const; |
| 5462 virtual RawAbstractType* CloneUninstantiated( | 5451 virtual RawAbstractType* CloneUninstantiated( |
| 5463 const Class& new_owner, | 5452 const Class& new_owner, TrailPtr trail = NULL) const; |
| 5464 GrowableObjectArray* trail = NULL) const; | 5453 virtual RawAbstractType* Canonicalize(TrailPtr trail = NULL) const { |
| 5465 virtual RawAbstractType* Canonicalize( | |
| 5466 GrowableObjectArray* trail = NULL) const { | |
| 5467 return raw(); | 5454 return raw(); |
| 5468 } | 5455 } |
| 5469 | 5456 |
| 5470 virtual intptr_t Hash() const; | 5457 virtual intptr_t Hash() const; |
| 5471 | 5458 |
| 5472 static intptr_t InstanceSize() { | 5459 static intptr_t InstanceSize() { |
| 5473 return RoundedAllocationSize(sizeof(RawBoundedType)); | 5460 return RoundedAllocationSize(sizeof(RawBoundedType)); |
| 5474 } | 5461 } |
| 5475 | 5462 |
| 5476 static RawBoundedType* New(const AbstractType& type, | 5463 static RawBoundedType* New(const AbstractType& type, |
| (...skipping 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8048 | 8035 |
| 8049 | 8036 |
| 8050 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8037 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 8051 intptr_t index) { | 8038 intptr_t index) { |
| 8052 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8039 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 8053 } | 8040 } |
| 8054 | 8041 |
| 8055 } // namespace dart | 8042 } // namespace dart |
| 8056 | 8043 |
| 8057 #endif // VM_OBJECT_H_ | 8044 #endif // VM_OBJECT_H_ |
| OLD | NEW |