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

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

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

Powered by Google App Engine
This is Rietveld 408576698