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

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

Issue 23190035: Distinguish between malformed and malbounded types (fix issues 12552 and 12554). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 months 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
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 3743 matching lines...) Expand 10 before | Expand all | Expand 10 after
3754 }; 3754 };
3755 3755
3756 3756
3757 // AbstractType is an abstract superclass. 3757 // AbstractType is an abstract superclass.
3758 // Subclasses of AbstractType are Type and TypeParameter. 3758 // Subclasses of AbstractType are Type and TypeParameter.
3759 class AbstractType : public Instance { 3759 class AbstractType : public Instance {
3760 public: 3760 public:
3761 virtual bool IsFinalized() const; 3761 virtual bool IsFinalized() const;
3762 virtual bool IsBeingFinalized() const; 3762 virtual bool IsBeingFinalized() const;
3763 virtual bool IsMalformed() const; 3763 virtual bool IsMalformed() const;
3764 virtual bool IsMalbounded(Error* bound_error) const;
srdjan 2013/08/23 23:47:02 I think it would be better to have tow methods: -
regis 2013/08/26 17:44:57 Done.
3764 virtual RawError* malformed_error() const; 3765 virtual RawError* malformed_error() const;
3765 virtual void set_malformed_error(const Error& value) const; 3766 virtual void set_malformed_error(const Error& value) const;
3766 virtual bool IsResolved() const; 3767 virtual bool IsResolved() const;
3767 virtual bool HasResolvedTypeClass() const; 3768 virtual bool HasResolvedTypeClass() const;
3768 virtual RawClass* type_class() const; 3769 virtual RawClass* type_class() const;
3769 virtual RawUnresolvedClass* unresolved_class() const; 3770 virtual RawUnresolvedClass* unresolved_class() const;
3770 virtual RawAbstractTypeArguments* arguments() const; 3771 virtual RawAbstractTypeArguments* arguments() const;
3771 virtual intptr_t token_pos() const; 3772 virtual intptr_t token_pos() const;
3772 virtual bool IsInstantiated() const; 3773 virtual bool IsInstantiated() const;
3773 virtual bool Equals(const Instance& other) const; 3774 virtual bool Equals(const Instance& other) const;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
3891 (raw_ptr()->type_state_ == RawType::kFinalizedInstantiated) || 3892 (raw_ptr()->type_state_ == RawType::kFinalizedInstantiated) ||
3892 (raw_ptr()->type_state_ == RawType::kFinalizedUninstantiated); 3893 (raw_ptr()->type_state_ == RawType::kFinalizedUninstantiated);
3893 } 3894 }
3894 void SetIsFinalized() const; 3895 void SetIsFinalized() const;
3895 void ResetIsFinalized() const; // Ignore current state and set again. 3896 void ResetIsFinalized() const; // Ignore current state and set again.
3896 virtual bool IsBeingFinalized() const { 3897 virtual bool IsBeingFinalized() const {
3897 return raw_ptr()->type_state_ == RawType::kBeingFinalized; 3898 return raw_ptr()->type_state_ == RawType::kBeingFinalized;
3898 } 3899 }
3899 void set_is_being_finalized() const; 3900 void set_is_being_finalized() const;
3900 virtual bool IsMalformed() const; 3901 virtual bool IsMalformed() const;
3902 virtual bool IsMalbounded(Error* bound_error) const;
3901 virtual RawError* malformed_error() const; 3903 virtual RawError* malformed_error() const;
3902 virtual void set_malformed_error(const Error& value) const; 3904 virtual void set_malformed_error(const Error& value) const;
3903 virtual bool IsResolved() const; // Class and all arguments classes resolved. 3905 virtual bool IsResolved() const; // Class and all arguments classes resolved.
3904 virtual bool HasResolvedTypeClass() const; // Own type class resolved. 3906 virtual bool HasResolvedTypeClass() const; // Own type class resolved.
3905 virtual RawClass* type_class() const; 3907 virtual RawClass* type_class() const;
3906 void set_type_class(const Object& value) const; 3908 void set_type_class(const Object& value) const;
3907 virtual RawUnresolvedClass* unresolved_class() const; 3909 virtual RawUnresolvedClass* unresolved_class() const;
3908 RawString* TypeClassName() const; 3910 RawString* TypeClassName() const;
3909 virtual RawAbstractTypeArguments* arguments() const; 3911 virtual RawAbstractTypeArguments* arguments() const;
3910 void set_arguments(const AbstractTypeArguments& value) const; 3912 void set_arguments(const AbstractTypeArguments& value) const;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
3998 // to the ObjectType. 4000 // to the ObjectType.
3999 class TypeParameter : public AbstractType { 4001 class TypeParameter : public AbstractType {
4000 public: 4002 public:
4001 virtual bool IsFinalized() const { 4003 virtual bool IsFinalized() const {
4002 ASSERT(raw_ptr()->type_state_ != RawTypeParameter::kFinalizedInstantiated); 4004 ASSERT(raw_ptr()->type_state_ != RawTypeParameter::kFinalizedInstantiated);
4003 return raw_ptr()->type_state_ == RawTypeParameter::kFinalizedUninstantiated; 4005 return raw_ptr()->type_state_ == RawTypeParameter::kFinalizedUninstantiated;
4004 } 4006 }
4005 void set_is_finalized() const; 4007 void set_is_finalized() const;
4006 virtual bool IsBeingFinalized() const { return false; } 4008 virtual bool IsBeingFinalized() const { return false; }
4007 virtual bool IsMalformed() const { return false; } 4009 virtual bool IsMalformed() const { return false; }
4010 virtual bool IsMalbounded(Error* bound_error) const { return false; }
4008 virtual bool IsResolved() const { return true; } 4011 virtual bool IsResolved() const { return true; }
4009 virtual bool HasResolvedTypeClass() const { return false; } 4012 virtual bool HasResolvedTypeClass() const { return false; }
4010 RawClass* parameterized_class() const { 4013 RawClass* parameterized_class() const {
4011 return raw_ptr()->parameterized_class_; 4014 return raw_ptr()->parameterized_class_;
4012 } 4015 }
4013 RawString* name() const { return raw_ptr()->name_; } 4016 RawString* name() const { return raw_ptr()->name_; }
4014 intptr_t index() const { return raw_ptr()->index_; } 4017 intptr_t index() const { return raw_ptr()->index_; }
4015 void set_index(intptr_t value) const; 4018 void set_index(intptr_t value) const;
4016 RawAbstractType* bound() const { return raw_ptr()->bound_; } 4019 RawAbstractType* bound() const { return raw_ptr()->bound_; }
4017 void set_bound(const AbstractType& value) const; 4020 void set_bound(const AbstractType& value) const;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
4060 // mode is known to be checked mode. 4063 // mode is known to be checked mode.
4061 class BoundedType : public AbstractType { 4064 class BoundedType : public AbstractType {
4062 public: 4065 public:
4063 virtual bool IsFinalized() const { 4066 virtual bool IsFinalized() const {
4064 return AbstractType::Handle(type()).IsFinalized(); 4067 return AbstractType::Handle(type()).IsFinalized();
4065 } 4068 }
4066 virtual bool IsBeingFinalized() const { 4069 virtual bool IsBeingFinalized() const {
4067 return AbstractType::Handle(type()).IsBeingFinalized(); 4070 return AbstractType::Handle(type()).IsBeingFinalized();
4068 } 4071 }
4069 virtual bool IsMalformed() const; 4072 virtual bool IsMalformed() const;
4073 virtual bool IsMalbounded(Error* bound_error) const;
4070 virtual RawError* malformed_error() const; 4074 virtual RawError* malformed_error() const;
4071 virtual bool IsResolved() const { return true; } 4075 virtual bool IsResolved() const { return true; }
4072 virtual bool HasResolvedTypeClass() const { 4076 virtual bool HasResolvedTypeClass() const {
4073 return AbstractType::Handle(type()).HasResolvedTypeClass(); 4077 return AbstractType::Handle(type()).HasResolvedTypeClass();
4074 } 4078 }
4075 virtual RawClass* type_class() const { 4079 virtual RawClass* type_class() const {
4076 return AbstractType::Handle(type()).type_class(); 4080 return AbstractType::Handle(type()).type_class();
4077 } 4081 }
4078 virtual RawUnresolvedClass* unresolved_class() const { 4082 virtual RawUnresolvedClass* unresolved_class() const {
4079 return AbstractType::Handle(type()).unresolved_class(); 4083 return AbstractType::Handle(type()).unresolved_class();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
4127 4131
4128 // A MixinAppType represents a mixin application clause, e.g. 4132 // A MixinAppType represents a mixin application clause, e.g.
4129 // "S<T> with M<U, N>". The class finalizer builds the type 4133 // "S<T> with M<U, N>". The class finalizer builds the type
4130 // parameters and arguments at finalization time. 4134 // parameters and arguments at finalization time.
4131 // MixinType objects do not survive finalization, so they do not 4135 // MixinType objects do not survive finalization, so they do not
4132 // need to be written to and read from snapshots. 4136 // need to be written to and read from snapshots.
4133 class MixinAppType : public AbstractType { 4137 class MixinAppType : public AbstractType {
4134 public: 4138 public:
4135 // MixinAppType objects are replaced with their actual finalized type. 4139 // MixinAppType objects are replaced with their actual finalized type.
4136 virtual bool IsFinalized() const { return false; } 4140 virtual bool IsFinalized() const { return false; }
4141 // TODO(regis): Handle malformed and malbounded MixinAppType.
4137 virtual bool IsMalformed() const { return false; } 4142 virtual bool IsMalformed() const { return false; }
4143 virtual bool IsMalbounded(Error* bound_error) const { return false; }
4138 virtual bool IsResolved() const { return false; } 4144 virtual bool IsResolved() const { return false; }
4139 virtual bool HasResolvedTypeClass() const { return false; } 4145 virtual bool HasResolvedTypeClass() const { return false; }
4140 virtual RawString* Name() const; 4146 virtual RawString* Name() const;
4141 4147
4142 virtual intptr_t token_pos() const { 4148 virtual intptr_t token_pos() const {
4143 return AbstractType::Handle(super_type()).token_pos(); 4149 return AbstractType::Handle(super_type()).token_pos();
4144 } 4150 }
4145 4151
4146 virtual RawAbstractTypeArguments* arguments() const { 4152 virtual RawAbstractTypeArguments* arguments() const {
4147 return AbstractTypeArguments::null(); 4153 return AbstractTypeArguments::null();
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
6116 6122
6117 6123
6118 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6124 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6119 intptr_t index) { 6125 intptr_t index) {
6120 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6126 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6121 } 6127 }
6122 6128
6123 } // namespace dart 6129 } // namespace dart
6124 6130
6125 #endif // VM_OBJECT_H_ 6131 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698