| 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 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1556 bool IsFinalized() const; | 1556 bool IsFinalized() const; |
| 1557 bool IsBounded() const; | 1557 bool IsBounded() const; |
| 1558 | 1558 |
| 1559 // Return true if this vector contains a recursive type argument. | 1559 // Return true if this vector contains a recursive type argument. |
| 1560 bool IsRecursive() const; | 1560 bool IsRecursive() const; |
| 1561 | 1561 |
| 1562 // Clone this type argument vector and clone all unfinalized type arguments. | 1562 // Clone this type argument vector and clone all unfinalized type arguments. |
| 1563 // Finalized type arguments are shared. | 1563 // Finalized type arguments are shared. |
| 1564 RawTypeArguments* CloneUnfinalized() const; | 1564 RawTypeArguments* CloneUnfinalized() const; |
| 1565 | 1565 |
| 1566 // Clone this type argument vector and clone all uninstantiated type | |
| 1567 // arguments, changing the class owner of type parameters. | |
| 1568 // Instantiated type arguments are shared. | |
| 1569 RawTypeArguments* CloneUninstantiated(const Class& new_owner) const; | |
| 1570 | |
| 1571 // Canonicalize only if instantiated, otherwise returns 'this'. | 1566 // Canonicalize only if instantiated, otherwise returns 'this'. |
| 1572 RawTypeArguments* Canonicalize(GrowableObjectArray* trail = NULL) const; | 1567 RawTypeArguments* Canonicalize(GrowableObjectArray* trail = NULL) const; |
| 1573 | 1568 |
| 1574 // Return 'this' if this type argument vector is instantiated, i.e. if it does | 1569 // Return 'this' if this type argument vector is instantiated, i.e. if it does |
| 1575 // not refer to type parameters. Otherwise, return a new type argument vector | 1570 // not refer to type parameters. Otherwise, return a new type argument vector |
| 1576 // where each reference to a type parameter is replaced with the corresponding | 1571 // where each reference to a type parameter is replaced with the corresponding |
| 1577 // type of the instantiator type argument vector. | 1572 // type of the instantiator type argument vector. |
| 1578 // If bound_error is not NULL, it may be set to reflect a bound error. | 1573 // If bound_error is not NULL, it may be set to reflect a bound error. |
| 1579 RawTypeArguments* InstantiateFrom( | 1574 RawTypeArguments* InstantiateFrom( |
| 1580 const TypeArguments& instantiator_type_arguments, | 1575 const TypeArguments& instantiator_type_arguments, |
| (...skipping 3081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4662 virtual RawAbstractType* InstantiateFrom( | 4657 virtual RawAbstractType* InstantiateFrom( |
| 4663 const TypeArguments& instantiator_type_arguments, | 4658 const TypeArguments& instantiator_type_arguments, |
| 4664 Error* bound_error, | 4659 Error* bound_error, |
| 4665 GrowableObjectArray* trail = NULL) const; | 4660 GrowableObjectArray* trail = NULL) const; |
| 4666 | 4661 |
| 4667 // Return a clone of this unfinalized type or the type itself if it is | 4662 // Return a clone of this unfinalized type or the type itself if it is |
| 4668 // already finalized. Apply recursively to type arguments, i.e. finalized | 4663 // already finalized. Apply recursively to type arguments, i.e. finalized |
| 4669 // type arguments of an unfinalized type are not cloned, but shared. | 4664 // type arguments of an unfinalized type are not cloned, but shared. |
| 4670 virtual RawAbstractType* CloneUnfinalized() const; | 4665 virtual RawAbstractType* CloneUnfinalized() const; |
| 4671 | 4666 |
| 4672 // Return a clone of this uninstantiated type where all references to type | |
| 4673 // parameters are replaced with references to type parameters of the same name | |
| 4674 // but belonging to the new owner class. | |
| 4675 // Apply recursively to type arguments, i.e. instantiated type arguments of | |
| 4676 // an uninstantiated type are not cloned, but shared. | |
| 4677 virtual RawAbstractType* CloneUninstantiated(const Class& new_owner) const; | |
| 4678 | |
| 4679 virtual RawInstance* CheckAndCanonicalize(const char** error_str) const { | 4667 virtual RawInstance* CheckAndCanonicalize(const char** error_str) const { |
| 4680 return Canonicalize(); | 4668 return Canonicalize(); |
| 4681 } | 4669 } |
| 4682 | 4670 |
| 4683 // Return the canonical version of this type. | 4671 // Return the canonical version of this type. |
| 4684 virtual RawAbstractType* Canonicalize( | 4672 virtual RawAbstractType* Canonicalize( |
| 4685 GrowableObjectArray* trail = NULL) const; | 4673 GrowableObjectArray* trail = NULL) const; |
| 4686 | 4674 |
| 4687 // Return the object associated with the receiver in the trail or | 4675 // Return the object associated with the receiver in the trail or |
| 4688 // Object::null() if the receiver is not contained in the trail. | 4676 // Object::null() if the receiver is not contained in the trail. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4829 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } | 4817 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } |
| 4830 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const; | 4818 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const; |
| 4831 virtual bool IsEquivalent(const Instance& other, | 4819 virtual bool IsEquivalent(const Instance& other, |
| 4832 GrowableObjectArray* trail = NULL) const; | 4820 GrowableObjectArray* trail = NULL) const; |
| 4833 virtual bool IsRecursive() const; | 4821 virtual bool IsRecursive() const; |
| 4834 virtual RawAbstractType* InstantiateFrom( | 4822 virtual RawAbstractType* InstantiateFrom( |
| 4835 const TypeArguments& instantiator_type_arguments, | 4823 const TypeArguments& instantiator_type_arguments, |
| 4836 Error* malformed_error, | 4824 Error* malformed_error, |
| 4837 GrowableObjectArray* trail = NULL) const; | 4825 GrowableObjectArray* trail = NULL) const; |
| 4838 virtual RawAbstractType* CloneUnfinalized() const; | 4826 virtual RawAbstractType* CloneUnfinalized() const; |
| 4839 virtual RawAbstractType* CloneUninstantiated(const Class& new_owner) const; | |
| 4840 virtual RawAbstractType* Canonicalize( | 4827 virtual RawAbstractType* Canonicalize( |
| 4841 GrowableObjectArray* trail = NULL) const; | 4828 GrowableObjectArray* trail = NULL) const; |
| 4842 | 4829 |
| 4843 virtual intptr_t Hash() const; | 4830 virtual intptr_t Hash() const; |
| 4844 | 4831 |
| 4845 static intptr_t InstanceSize() { | 4832 static intptr_t InstanceSize() { |
| 4846 return RoundedAllocationSize(sizeof(RawType)); | 4833 return RoundedAllocationSize(sizeof(RawType)); |
| 4847 } | 4834 } |
| 4848 | 4835 |
| 4849 // The type of the literal 'null'. | 4836 // The type of the literal 'null'. |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5029 return false; | 5016 return false; |
| 5030 } | 5017 } |
| 5031 virtual bool IsEquivalent(const Instance& other, | 5018 virtual bool IsEquivalent(const Instance& other, |
| 5032 GrowableObjectArray* trail = NULL) const; | 5019 GrowableObjectArray* trail = NULL) const; |
| 5033 virtual bool IsRecursive() const { return false; } | 5020 virtual bool IsRecursive() const { return false; } |
| 5034 virtual RawAbstractType* InstantiateFrom( | 5021 virtual RawAbstractType* InstantiateFrom( |
| 5035 const TypeArguments& instantiator_type_arguments, | 5022 const TypeArguments& instantiator_type_arguments, |
| 5036 Error* bound_error, | 5023 Error* bound_error, |
| 5037 GrowableObjectArray* trail = NULL) const; | 5024 GrowableObjectArray* trail = NULL) const; |
| 5038 virtual RawAbstractType* CloneUnfinalized() const; | 5025 virtual RawAbstractType* CloneUnfinalized() const; |
| 5039 virtual RawAbstractType* CloneUninstantiated(const Class& new_owner) const; | |
| 5040 virtual RawAbstractType* Canonicalize( | 5026 virtual RawAbstractType* Canonicalize( |
| 5041 GrowableObjectArray* trail = NULL) const { | 5027 GrowableObjectArray* trail = NULL) const { |
| 5042 return raw(); | 5028 return raw(); |
| 5043 } | 5029 } |
| 5044 | 5030 |
| 5045 virtual intptr_t Hash() const; | 5031 virtual intptr_t Hash() const; |
| 5046 | 5032 |
| 5047 static intptr_t InstanceSize() { | 5033 static intptr_t InstanceSize() { |
| 5048 return RoundedAllocationSize(sizeof(RawTypeParameter)); | 5034 return RoundedAllocationSize(sizeof(RawTypeParameter)); |
| 5049 } | 5035 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5114 return AbstractType::Handle(type()).IsInstantiated(); | 5100 return AbstractType::Handle(type()).IsInstantiated(); |
| 5115 } | 5101 } |
| 5116 virtual bool IsEquivalent(const Instance& other, | 5102 virtual bool IsEquivalent(const Instance& other, |
| 5117 GrowableObjectArray* trail = NULL) const; | 5103 GrowableObjectArray* trail = NULL) const; |
| 5118 virtual bool IsRecursive() const; | 5104 virtual bool IsRecursive() const; |
| 5119 virtual RawAbstractType* InstantiateFrom( | 5105 virtual RawAbstractType* InstantiateFrom( |
| 5120 const TypeArguments& instantiator_type_arguments, | 5106 const TypeArguments& instantiator_type_arguments, |
| 5121 Error* bound_error, | 5107 Error* bound_error, |
| 5122 GrowableObjectArray* trail = NULL) const; | 5108 GrowableObjectArray* trail = NULL) const; |
| 5123 virtual RawAbstractType* CloneUnfinalized() const; | 5109 virtual RawAbstractType* CloneUnfinalized() const; |
| 5124 virtual RawAbstractType* CloneUninstantiated(const Class& new_owner) const; | |
| 5125 virtual RawAbstractType* Canonicalize( | 5110 virtual RawAbstractType* Canonicalize( |
| 5126 GrowableObjectArray* trail = NULL) const { | 5111 GrowableObjectArray* trail = NULL) const { |
| 5127 return raw(); | 5112 return raw(); |
| 5128 } | 5113 } |
| 5129 | 5114 |
| 5130 virtual intptr_t Hash() const; | 5115 virtual intptr_t Hash() const; |
| 5131 | 5116 |
| 5132 static intptr_t InstanceSize() { | 5117 static intptr_t InstanceSize() { |
| 5133 return RoundedAllocationSize(sizeof(RawBoundedType)); | 5118 return RoundedAllocationSize(sizeof(RawBoundedType)); |
| 5134 } | 5119 } |
| (...skipping 2430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7565 | 7550 |
| 7566 | 7551 |
| 7567 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7552 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 7568 intptr_t index) { | 7553 intptr_t index) { |
| 7569 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7554 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 7570 } | 7555 } |
| 7571 | 7556 |
| 7572 } // namespace dart | 7557 } // namespace dart |
| 7573 | 7558 |
| 7574 #endif // VM_OBJECT_H_ | 7559 #endif // VM_OBJECT_H_ |
| OLD | NEW |