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