| 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 4144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4155 virtual bool IsMalformed() const; | 4155 virtual bool IsMalformed() const; |
| 4156 virtual bool IsMalbounded() const; | 4156 virtual bool IsMalbounded() const; |
| 4157 virtual bool IsMalformedOrMalbounded() const; | 4157 virtual bool IsMalformedOrMalbounded() const; |
| 4158 virtual RawLanguageError* error() const { return raw_ptr()->error_; } | 4158 virtual RawLanguageError* error() const { return raw_ptr()->error_; } |
| 4159 virtual void set_error(const LanguageError& value) const; | 4159 virtual void set_error(const LanguageError& value) const; |
| 4160 virtual bool IsResolved() const; // Class and all arguments classes resolved. | 4160 virtual bool IsResolved() const; // Class and all arguments classes resolved. |
| 4161 virtual bool HasResolvedTypeClass() const; // Own type class resolved. | 4161 virtual bool HasResolvedTypeClass() const; // Own type class resolved. |
| 4162 virtual RawClass* type_class() const; | 4162 virtual RawClass* type_class() const; |
| 4163 void set_type_class(const Object& value) const; | 4163 void set_type_class(const Object& value) const; |
| 4164 virtual RawUnresolvedClass* unresolved_class() const; | 4164 virtual RawUnresolvedClass* unresolved_class() const; |
| 4165 RawString* TypeClassName() const; | |
| 4166 virtual RawAbstractTypeArguments* arguments() const; | 4165 virtual RawAbstractTypeArguments* arguments() const; |
| 4167 void set_arguments(const AbstractTypeArguments& value) const; | 4166 void set_arguments(const AbstractTypeArguments& value) const; |
| 4168 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } | 4167 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } |
| 4169 virtual bool IsInstantiated() const; | 4168 virtual bool IsInstantiated() const; |
| 4170 virtual bool Equals(const Instance& other) const; | 4169 virtual bool Equals(const Instance& other) const; |
| 4171 virtual RawAbstractType* InstantiateFrom( | 4170 virtual RawAbstractType* InstantiateFrom( |
| 4172 const AbstractTypeArguments& instantiator_type_arguments, | 4171 const AbstractTypeArguments& instantiator_type_arguments, |
| 4173 Error* malformed_error) const; | 4172 Error* malformed_error) const; |
| 4174 virtual RawAbstractType* CloneUnfinalized() const; | 4173 virtual RawAbstractType* CloneUnfinalized() const; |
| 4175 virtual RawAbstractType* Canonicalize() const; | 4174 virtual RawAbstractType* Canonicalize() const; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4237 void set_token_pos(intptr_t token_pos) const; | 4236 void set_token_pos(intptr_t token_pos) const; |
| 4238 void set_type_state(int8_t state) const; | 4237 void set_type_state(int8_t state) const; |
| 4239 | 4238 |
| 4240 static RawType* New(Heap::Space space = Heap::kOld); | 4239 static RawType* New(Heap::Space space = Heap::kOld); |
| 4241 | 4240 |
| 4242 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType); | 4241 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType); |
| 4243 friend class Class; | 4242 friend class Class; |
| 4244 }; | 4243 }; |
| 4245 | 4244 |
| 4246 | 4245 |
| 4246 // A TypeRef is used to break cycles in the representation of recursive types. |
| 4247 // Its only field is the recursive AbstractType it refers to. |
| 4248 // Note that the cycle always involves type arguments. |
| 4249 class TypeRef : public AbstractType { |
| 4250 public: |
| 4251 virtual bool IsFinalized() const { |
| 4252 return AbstractType::Handle(type()).IsFinalized(); |
| 4253 } |
| 4254 virtual bool IsBeingFinalized() const { |
| 4255 return AbstractType::Handle(type()).IsBeingFinalized(); |
| 4256 } |
| 4257 virtual bool IsMalformed() const { |
| 4258 return AbstractType::Handle(type()).IsMalformed(); |
| 4259 } |
| 4260 virtual bool IsMalbounded() const { |
| 4261 return AbstractType::Handle(type()).IsMalbounded(); |
| 4262 } |
| 4263 virtual bool IsMalformedOrMalbounded() const { |
| 4264 return AbstractType::Handle(type()).IsMalformedOrMalbounded(); |
| 4265 } |
| 4266 virtual bool IsResolved() const { return true; } |
| 4267 virtual bool HasResolvedTypeClass() const { return true; } |
| 4268 RawAbstractType* type() const { return raw_ptr()->type_; } |
| 4269 void set_type(const AbstractType& value) const; |
| 4270 virtual RawClass* type_class() const { |
| 4271 return AbstractType::Handle(type()).type_class(); |
| 4272 } |
| 4273 virtual RawAbstractTypeArguments* arguments() const { |
| 4274 return AbstractType::Handle(type()).arguments(); |
| 4275 } |
| 4276 virtual intptr_t token_pos() const { |
| 4277 return AbstractType::Handle(type()).token_pos(); |
| 4278 } |
| 4279 virtual bool IsInstantiated() const; |
| 4280 virtual bool Equals(const Instance& other) const; |
| 4281 virtual RawAbstractType* InstantiateFrom( |
| 4282 const AbstractTypeArguments& instantiator_type_arguments, |
| 4283 Error* bound_error) const; |
| 4284 virtual RawAbstractType* Canonicalize() const; |
| 4285 |
| 4286 virtual intptr_t Hash() const; |
| 4287 |
| 4288 static intptr_t InstanceSize() { |
| 4289 return RoundedAllocationSize(sizeof(RawTypeRef)); |
| 4290 } |
| 4291 |
| 4292 static RawTypeRef* New(const AbstractType& type); |
| 4293 |
| 4294 private: |
| 4295 bool is_being_checked() const { |
| 4296 return raw_ptr()->is_being_checked_; |
| 4297 } |
| 4298 void set_is_being_checked(bool value) const; |
| 4299 |
| 4300 static RawTypeRef* New(); |
| 4301 |
| 4302 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeRef, AbstractType); |
| 4303 friend class Class; |
| 4304 }; |
| 4305 |
| 4306 |
| 4247 // A TypeParameter represents a type parameter of a parameterized class. | 4307 // A TypeParameter represents a type parameter of a parameterized class. |
| 4248 // It specifies its index (and its name for debugging purposes), as well as its | 4308 // It specifies its index (and its name for debugging purposes), as well as its |
| 4249 // upper bound. | 4309 // upper bound. |
| 4250 // For example, the type parameter 'V' is specified as index 1 in the context of | 4310 // For example, the type parameter 'V' is specified as index 1 in the context of |
| 4251 // the class HashMap<K, V>. At compile time, the TypeParameter is not | 4311 // the class HashMap<K, V>. At compile time, the TypeParameter is not |
| 4252 // instantiated yet, i.e. it is only a place holder. | 4312 // instantiated yet, i.e. it is only a place holder. |
| 4253 // Upon finalization, the TypeParameter index is changed to reflect its position | 4313 // Upon finalization, the TypeParameter index is changed to reflect its position |
| 4254 // as type argument (rather than type parameter) of the parameterized class. | 4314 // as type argument (rather than type parameter) of the parameterized class. |
| 4255 // If the type parameter is declared without an extends clause, its bound is set | 4315 // If the type parameter is declared without an extends clause, its bound is set |
| 4256 // to the ObjectType. | 4316 // to the ObjectType. |
| (...skipping 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6447 | 6507 |
| 6448 | 6508 |
| 6449 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6509 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6450 intptr_t index) { | 6510 intptr_t index) { |
| 6451 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6511 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6452 } | 6512 } |
| 6453 | 6513 |
| 6454 } // namespace dart | 6514 } // namespace dart |
| 6455 | 6515 |
| 6456 #endif // VM_OBJECT_H_ | 6516 #endif // VM_OBJECT_H_ |
| OLD | NEW |