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 RUNTIME_VM_OBJECT_H_ | 5 #ifndef RUNTIME_VM_OBJECT_H_ |
6 #define RUNTIME_VM_OBJECT_H_ | 6 #define RUNTIME_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 6026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6037 static RawType* New(Heap::Space space = Heap::kOld); | 6037 static RawType* New(Heap::Space space = Heap::kOld); |
6038 | 6038 |
6039 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType); | 6039 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType); |
6040 friend class Class; | 6040 friend class Class; |
6041 friend class TypeArguments; | 6041 friend class TypeArguments; |
6042 friend class ClearTypeHashVisitor; | 6042 friend class ClearTypeHashVisitor; |
6043 }; | 6043 }; |
6044 | 6044 |
6045 | 6045 |
6046 // A TypeRef is used to break cycles in the representation of recursive types. | 6046 // A TypeRef is used to break cycles in the representation of recursive types. |
6047 // Its only field is the recursive AbstractType it refers to. | 6047 // Its only field is the recursive AbstractType it refers to, which can |
| 6048 // temporarily be null during finalization. |
6048 // Note that the cycle always involves type arguments. | 6049 // Note that the cycle always involves type arguments. |
6049 class TypeRef : public AbstractType { | 6050 class TypeRef : public AbstractType { |
6050 public: | 6051 public: |
6051 virtual bool IsFinalized() const { | 6052 virtual bool IsFinalized() const { |
6052 return AbstractType::Handle(type()).IsFinalized(); | 6053 const AbstractType& ref_type = AbstractType::Handle(type()); |
| 6054 return !ref_type.IsNull() && ref_type.IsFinalized(); |
6053 } | 6055 } |
6054 virtual bool IsBeingFinalized() const { | 6056 virtual bool IsBeingFinalized() const { |
6055 return AbstractType::Handle(type()).IsBeingFinalized(); | 6057 const AbstractType& ref_type = AbstractType::Handle(type()); |
| 6058 return ref_type.IsNull() || ref_type.IsBeingFinalized(); |
6056 } | 6059 } |
6057 virtual bool IsMalformed() const { | 6060 virtual bool IsMalformed() const { |
6058 return AbstractType::Handle(type()).IsMalformed(); | 6061 return AbstractType::Handle(type()).IsMalformed(); |
6059 } | 6062 } |
6060 virtual bool IsMalbounded() const { | 6063 virtual bool IsMalbounded() const { |
6061 return AbstractType::Handle(type()).IsMalbounded(); | 6064 return AbstractType::Handle(type()).IsMalbounded(); |
6062 } | 6065 } |
6063 virtual bool IsMalformedOrMalbounded() const { | 6066 virtual bool IsMalformedOrMalbounded() const { |
6064 return AbstractType::Handle(type()).IsMalformedOrMalbounded(); | 6067 return AbstractType::Handle(type()).IsMalformedOrMalbounded(); |
6065 } | 6068 } |
(...skipping 2923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8989 | 8992 |
8990 inline void TypeArguments::SetHash(intptr_t value) const { | 8993 inline void TypeArguments::SetHash(intptr_t value) const { |
8991 // This is only safe because we create a new Smi, which does not cause | 8994 // This is only safe because we create a new Smi, which does not cause |
8992 // heap allocation. | 8995 // heap allocation. |
8993 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8996 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
8994 } | 8997 } |
8995 | 8998 |
8996 } // namespace dart | 8999 } // namespace dart |
8997 | 9000 |
8998 #endif // RUNTIME_VM_OBJECT_H_ | 9001 #endif // RUNTIME_VM_OBJECT_H_ |
OLD | NEW |