| 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 3771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3782 | 3782 |
| 3783 class LanguageError : public Error { | 3783 class LanguageError : public Error { |
| 3784 public: | 3784 public: |
| 3785 enum Kind { | 3785 enum Kind { |
| 3786 kWarning, | 3786 kWarning, |
| 3787 kError, | 3787 kError, |
| 3788 kMalformedType, | 3788 kMalformedType, |
| 3789 kMalboundedType, | 3789 kMalboundedType, |
| 3790 }; | 3790 }; |
| 3791 | 3791 |
| 3792 Kind kind() const { return static_cast<Kind>(raw_ptr()->kind_); } |
| 3793 |
| 3792 // Build, cache, and return formatted message. | 3794 // Build, cache, and return formatted message. |
| 3793 RawString* FormatMessage() const; | 3795 RawString* FormatMessage() const; |
| 3794 | 3796 |
| 3795 static intptr_t InstanceSize() { | 3797 static intptr_t InstanceSize() { |
| 3796 return RoundedAllocationSize(sizeof(RawLanguageError)); | 3798 return RoundedAllocationSize(sizeof(RawLanguageError)); |
| 3797 } | 3799 } |
| 3798 | 3800 |
| 3799 // A null script means no source and a negative token_pos means no position. | 3801 // A null script means no source and a negative token_pos means no position. |
| 3800 static RawLanguageError* NewFormatted(const Error& prev_error, | 3802 static RawLanguageError* NewFormatted(const Error& prev_error, |
| 3801 const Script& script, | 3803 const Script& script, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3822 return raw_ptr()->previous_error_; | 3824 return raw_ptr()->previous_error_; |
| 3823 } | 3825 } |
| 3824 void set_previous_error(const Error& value) const; | 3826 void set_previous_error(const Error& value) const; |
| 3825 | 3827 |
| 3826 RawScript* script() const { return raw_ptr()->script_; } | 3828 RawScript* script() const { return raw_ptr()->script_; } |
| 3827 void set_script(const Script& value) const; | 3829 void set_script(const Script& value) const; |
| 3828 | 3830 |
| 3829 intptr_t token_pos() const { return raw_ptr()->token_pos_; } | 3831 intptr_t token_pos() const { return raw_ptr()->token_pos_; } |
| 3830 void set_token_pos(intptr_t value) const; | 3832 void set_token_pos(intptr_t value) const; |
| 3831 | 3833 |
| 3832 Kind kind() const { return static_cast<Kind>(raw_ptr()->kind_); } | |
| 3833 void set_kind(uint8_t value) const; | 3834 void set_kind(uint8_t value) const; |
| 3834 | 3835 |
| 3835 RawString* message() const { return raw_ptr()->message_; } | 3836 RawString* message() const { return raw_ptr()->message_; } |
| 3836 void set_message(const String& value) const; | 3837 void set_message(const String& value) const; |
| 3837 | 3838 |
| 3838 RawString* formatted_message() const { return raw_ptr()->formatted_message_; } | 3839 RawString* formatted_message() const { return raw_ptr()->formatted_message_; } |
| 3839 void set_formatted_message(const String& value) const; | 3840 void set_formatted_message(const String& value) const; |
| 3840 | 3841 |
| 3841 static RawLanguageError* New(); | 3842 static RawLanguageError* New(); |
| 3842 | 3843 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3992 }; | 3993 }; |
| 3993 | 3994 |
| 3994 | 3995 |
| 3995 // AbstractType is an abstract superclass. | 3996 // AbstractType is an abstract superclass. |
| 3996 // Subclasses of AbstractType are Type and TypeParameter. | 3997 // Subclasses of AbstractType are Type and TypeParameter. |
| 3997 class AbstractType : public Instance { | 3998 class AbstractType : public Instance { |
| 3998 public: | 3999 public: |
| 3999 virtual bool IsFinalized() const; | 4000 virtual bool IsFinalized() const; |
| 4000 virtual bool IsBeingFinalized() const; | 4001 virtual bool IsBeingFinalized() const; |
| 4001 virtual bool IsMalformed() const; | 4002 virtual bool IsMalformed() const; |
| 4002 virtual bool IsMalbounded() const { return IsMalboundedWithError(NULL); } | 4003 virtual bool IsMalbounded() const; |
| 4003 virtual bool IsMalboundedWithError(Error* bound_error) const; | 4004 virtual bool IsMalformedOrMalbounded() const; |
| 4004 virtual RawError* malformed_error() const; | 4005 virtual RawLanguageError* error() const; |
| 4005 virtual void set_malformed_error(const Error& value) const; | 4006 virtual void set_error(const LanguageError& value) const; |
| 4006 virtual bool IsResolved() const; | 4007 virtual bool IsResolved() const; |
| 4007 virtual bool HasResolvedTypeClass() const; | 4008 virtual bool HasResolvedTypeClass() const; |
| 4008 virtual RawClass* type_class() const; | 4009 virtual RawClass* type_class() const; |
| 4009 virtual RawUnresolvedClass* unresolved_class() const; | 4010 virtual RawUnresolvedClass* unresolved_class() const; |
| 4010 virtual RawAbstractTypeArguments* arguments() const; | 4011 virtual RawAbstractTypeArguments* arguments() const; |
| 4011 virtual intptr_t token_pos() const; | 4012 virtual intptr_t token_pos() const; |
| 4012 virtual bool IsInstantiated() const; | 4013 virtual bool IsInstantiated() const; |
| 4013 virtual bool Equals(const Instance& other) const; | 4014 virtual bool Equals(const Instance& other) const; |
| 4014 | 4015 |
| 4015 // Instantiate this type using the given type argument vector. | 4016 // Instantiate this type using the given type argument vector. |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4136 (raw_ptr()->type_state_ == RawType::kFinalizedInstantiated) || | 4137 (raw_ptr()->type_state_ == RawType::kFinalizedInstantiated) || |
| 4137 (raw_ptr()->type_state_ == RawType::kFinalizedUninstantiated); | 4138 (raw_ptr()->type_state_ == RawType::kFinalizedUninstantiated); |
| 4138 } | 4139 } |
| 4139 void SetIsFinalized() const; | 4140 void SetIsFinalized() const; |
| 4140 void ResetIsFinalized() const; // Ignore current state and set again. | 4141 void ResetIsFinalized() const; // Ignore current state and set again. |
| 4141 virtual bool IsBeingFinalized() const { | 4142 virtual bool IsBeingFinalized() const { |
| 4142 return raw_ptr()->type_state_ == RawType::kBeingFinalized; | 4143 return raw_ptr()->type_state_ == RawType::kBeingFinalized; |
| 4143 } | 4144 } |
| 4144 void set_is_being_finalized() const; | 4145 void set_is_being_finalized() const; |
| 4145 virtual bool IsMalformed() const; | 4146 virtual bool IsMalformed() const; |
| 4146 virtual bool IsMalbounded() const { return IsMalboundedWithError(NULL); } | 4147 virtual bool IsMalbounded() const; |
| 4147 virtual bool IsMalboundedWithError(Error* bound_error) const; | 4148 virtual bool IsMalformedOrMalbounded() const; |
| 4148 virtual RawError* malformed_error() const; | 4149 virtual RawLanguageError* error() const { return raw_ptr()->error_; } |
| 4149 virtual void set_malformed_error(const Error& value) const; | 4150 virtual void set_error(const LanguageError& value) const; |
| 4150 virtual bool IsResolved() const; // Class and all arguments classes resolved. | 4151 virtual bool IsResolved() const; // Class and all arguments classes resolved. |
| 4151 virtual bool HasResolvedTypeClass() const; // Own type class resolved. | 4152 virtual bool HasResolvedTypeClass() const; // Own type class resolved. |
| 4152 virtual RawClass* type_class() const; | 4153 virtual RawClass* type_class() const; |
| 4153 void set_type_class(const Object& value) const; | 4154 void set_type_class(const Object& value) const; |
| 4154 virtual RawUnresolvedClass* unresolved_class() const; | 4155 virtual RawUnresolvedClass* unresolved_class() const; |
| 4155 RawString* TypeClassName() const; | 4156 RawString* TypeClassName() const; |
| 4156 virtual RawAbstractTypeArguments* arguments() const; | 4157 virtual RawAbstractTypeArguments* arguments() const; |
| 4157 void set_arguments(const AbstractTypeArguments& value) const; | 4158 void set_arguments(const AbstractTypeArguments& value) const; |
| 4158 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } | 4159 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } |
| 4159 virtual bool IsInstantiated() const; | 4160 virtual bool IsInstantiated() const; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4247 class TypeParameter : public AbstractType { | 4248 class TypeParameter : public AbstractType { |
| 4248 public: | 4249 public: |
| 4249 virtual bool IsFinalized() const { | 4250 virtual bool IsFinalized() const { |
| 4250 ASSERT(raw_ptr()->type_state_ != RawTypeParameter::kFinalizedInstantiated); | 4251 ASSERT(raw_ptr()->type_state_ != RawTypeParameter::kFinalizedInstantiated); |
| 4251 return raw_ptr()->type_state_ == RawTypeParameter::kFinalizedUninstantiated; | 4252 return raw_ptr()->type_state_ == RawTypeParameter::kFinalizedUninstantiated; |
| 4252 } | 4253 } |
| 4253 void set_is_finalized() const; | 4254 void set_is_finalized() const; |
| 4254 virtual bool IsBeingFinalized() const { return false; } | 4255 virtual bool IsBeingFinalized() const { return false; } |
| 4255 virtual bool IsMalformed() const { return false; } | 4256 virtual bool IsMalformed() const { return false; } |
| 4256 virtual bool IsMalbounded() const { return false; } | 4257 virtual bool IsMalbounded() const { return false; } |
| 4257 virtual bool IsMalboundedWithError(Error* bound_error) const { return false; } | 4258 virtual bool IsMalformedOrMalbounded() const { return false; } |
| 4258 virtual bool IsResolved() const { return true; } | 4259 virtual bool IsResolved() const { return true; } |
| 4259 virtual bool HasResolvedTypeClass() const { return false; } | 4260 virtual bool HasResolvedTypeClass() const { return false; } |
| 4260 RawClass* parameterized_class() const { | 4261 RawClass* parameterized_class() const { |
| 4261 return raw_ptr()->parameterized_class_; | 4262 return raw_ptr()->parameterized_class_; |
| 4262 } | 4263 } |
| 4263 RawString* name() const { return raw_ptr()->name_; } | 4264 RawString* name() const { return raw_ptr()->name_; } |
| 4264 intptr_t index() const { return raw_ptr()->index_; } | 4265 intptr_t index() const { return raw_ptr()->index_; } |
| 4265 void set_index(intptr_t value) const; | 4266 void set_index(intptr_t value) const; |
| 4266 RawAbstractType* bound() const { return raw_ptr()->bound_; } | 4267 RawAbstractType* bound() const { return raw_ptr()->bound_; } |
| 4267 void set_bound(const AbstractType& value) const; | 4268 void set_bound(const AbstractType& value) const; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4314 // mode is known to be checked mode. | 4315 // mode is known to be checked mode. |
| 4315 class BoundedType : public AbstractType { | 4316 class BoundedType : public AbstractType { |
| 4316 public: | 4317 public: |
| 4317 virtual bool IsFinalized() const { | 4318 virtual bool IsFinalized() const { |
| 4318 return AbstractType::Handle(type()).IsFinalized(); | 4319 return AbstractType::Handle(type()).IsFinalized(); |
| 4319 } | 4320 } |
| 4320 virtual bool IsBeingFinalized() const { | 4321 virtual bool IsBeingFinalized() const { |
| 4321 return AbstractType::Handle(type()).IsBeingFinalized(); | 4322 return AbstractType::Handle(type()).IsBeingFinalized(); |
| 4322 } | 4323 } |
| 4323 virtual bool IsMalformed() const; | 4324 virtual bool IsMalformed() const; |
| 4324 virtual bool IsMalbounded() const { return IsMalboundedWithError(NULL); } | 4325 virtual bool IsMalbounded() const; |
| 4325 virtual bool IsMalboundedWithError(Error* bound_error) const; | 4326 virtual bool IsMalformedOrMalbounded() const; |
| 4326 virtual RawError* malformed_error() const; | 4327 virtual RawLanguageError* error() const; |
| 4327 virtual bool IsResolved() const { return true; } | 4328 virtual bool IsResolved() const { return true; } |
| 4328 virtual bool HasResolvedTypeClass() const { | 4329 virtual bool HasResolvedTypeClass() const { |
| 4329 return AbstractType::Handle(type()).HasResolvedTypeClass(); | 4330 return AbstractType::Handle(type()).HasResolvedTypeClass(); |
| 4330 } | 4331 } |
| 4331 virtual RawClass* type_class() const { | 4332 virtual RawClass* type_class() const { |
| 4332 return AbstractType::Handle(type()).type_class(); | 4333 return AbstractType::Handle(type()).type_class(); |
| 4333 } | 4334 } |
| 4334 virtual RawUnresolvedClass* unresolved_class() const { | 4335 virtual RawUnresolvedClass* unresolved_class() const { |
| 4335 return AbstractType::Handle(type()).unresolved_class(); | 4336 return AbstractType::Handle(type()).unresolved_class(); |
| 4336 } | 4337 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4393 // The class finalizer creates synthesized classes S&M and S&M&N if they do not | 4394 // The class finalizer creates synthesized classes S&M and S&M&N if they do not |
| 4394 // yet exist in the library declaring the mixin application clause. | 4395 // yet exist in the library declaring the mixin application clause. |
| 4395 class MixinAppType : public AbstractType { | 4396 class MixinAppType : public AbstractType { |
| 4396 public: | 4397 public: |
| 4397 // A MixinAppType object is unfinalized by definition, since it is replaced at | 4398 // A MixinAppType object is unfinalized by definition, since it is replaced at |
| 4398 // class finalization time with a finalized Type or BoundedType object. | 4399 // class finalization time with a finalized Type or BoundedType object. |
| 4399 virtual bool IsFinalized() const { return false; } | 4400 virtual bool IsFinalized() const { return false; } |
| 4400 // TODO(regis): Handle malformed and malbounded MixinAppType. | 4401 // TODO(regis): Handle malformed and malbounded MixinAppType. |
| 4401 virtual bool IsMalformed() const { return false; } | 4402 virtual bool IsMalformed() const { return false; } |
| 4402 virtual bool IsMalbounded() const { return false; } | 4403 virtual bool IsMalbounded() const { return false; } |
| 4404 virtual bool IsMalformedOrMalbounded() const { return false; } |
| 4403 virtual bool IsResolved() const { return false; } | 4405 virtual bool IsResolved() const { return false; } |
| 4404 virtual bool HasResolvedTypeClass() const { return false; } | 4406 virtual bool HasResolvedTypeClass() const { return false; } |
| 4405 virtual RawString* Name() const; | 4407 virtual RawString* Name() const; |
| 4406 virtual intptr_t token_pos() const; | 4408 virtual intptr_t token_pos() const; |
| 4407 | 4409 |
| 4408 // Returns the mixin composition depth of this mixin application type. | 4410 // Returns the mixin composition depth of this mixin application type. |
| 4409 intptr_t Depth() const; | 4411 intptr_t Depth() const; |
| 4410 | 4412 |
| 4411 // Returns the declared super type of the mixin application, which will also | 4413 // Returns the declared super type of the mixin application, which will also |
| 4412 // be the super type of the first synthesized class, e.g. class "S&M" will | 4414 // be the super type of the first synthesized class, e.g. class "S&M" will |
| (...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6424 | 6426 |
| 6425 | 6427 |
| 6426 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6428 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6427 intptr_t index) { | 6429 intptr_t index) { |
| 6428 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6430 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6429 } | 6431 } |
| 6430 | 6432 |
| 6431 } // namespace dart | 6433 } // namespace dart |
| 6432 | 6434 |
| 6433 #endif // VM_OBJECT_H_ | 6435 #endif // VM_OBJECT_H_ |
| OLD | NEW |