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

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
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.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 3748 matching lines...) Expand 10 before | Expand all | Expand 10 after
3759 }; 3759 };
3760 3760
3761 3761
3762 // AbstractType is an abstract superclass. 3762 // AbstractType is an abstract superclass.
3763 // Subclasses of AbstractType are Type and TypeParameter. 3763 // Subclasses of AbstractType are Type and TypeParameter.
3764 class AbstractType : public Instance { 3764 class AbstractType : public Instance {
3765 public: 3765 public:
3766 virtual bool IsFinalized() const; 3766 virtual bool IsFinalized() const;
3767 virtual bool IsBeingFinalized() const; 3767 virtual bool IsBeingFinalized() const;
3768 virtual bool IsMalformed() const; 3768 virtual bool IsMalformed() const;
3769 virtual bool IsMalbounded() const { return IsMalboundedWithError(NULL); }
3770 virtual bool IsMalboundedWithError(Error* bound_error) const;
3769 virtual RawError* malformed_error() const; 3771 virtual RawError* malformed_error() const;
3770 virtual void set_malformed_error(const Error& value) const; 3772 virtual void set_malformed_error(const Error& value) const;
3771 virtual bool IsResolved() const; 3773 virtual bool IsResolved() const;
3772 virtual bool HasResolvedTypeClass() const; 3774 virtual bool HasResolvedTypeClass() const;
3773 virtual RawClass* type_class() const; 3775 virtual RawClass* type_class() const;
3774 virtual RawUnresolvedClass* unresolved_class() const; 3776 virtual RawUnresolvedClass* unresolved_class() const;
3775 virtual RawAbstractTypeArguments* arguments() const; 3777 virtual RawAbstractTypeArguments* arguments() const;
3776 virtual intptr_t token_pos() const; 3778 virtual intptr_t token_pos() const;
3777 virtual bool IsInstantiated() const; 3779 virtual bool IsInstantiated() const;
3778 virtual bool Equals(const Instance& other) const; 3780 virtual bool Equals(const Instance& other) const;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
3896 (raw_ptr()->type_state_ == RawType::kFinalizedInstantiated) || 3898 (raw_ptr()->type_state_ == RawType::kFinalizedInstantiated) ||
3897 (raw_ptr()->type_state_ == RawType::kFinalizedUninstantiated); 3899 (raw_ptr()->type_state_ == RawType::kFinalizedUninstantiated);
3898 } 3900 }
3899 void SetIsFinalized() const; 3901 void SetIsFinalized() const;
3900 void ResetIsFinalized() const; // Ignore current state and set again. 3902 void ResetIsFinalized() const; // Ignore current state and set again.
3901 virtual bool IsBeingFinalized() const { 3903 virtual bool IsBeingFinalized() const {
3902 return raw_ptr()->type_state_ == RawType::kBeingFinalized; 3904 return raw_ptr()->type_state_ == RawType::kBeingFinalized;
3903 } 3905 }
3904 void set_is_being_finalized() const; 3906 void set_is_being_finalized() const;
3905 virtual bool IsMalformed() const; 3907 virtual bool IsMalformed() const;
3908 virtual bool IsMalbounded() const { return IsMalboundedWithError(NULL); }
3909 virtual bool IsMalboundedWithError(Error* bound_error) const;
3906 virtual RawError* malformed_error() const; 3910 virtual RawError* malformed_error() const;
3907 virtual void set_malformed_error(const Error& value) const; 3911 virtual void set_malformed_error(const Error& value) const;
3908 virtual bool IsResolved() const; // Class and all arguments classes resolved. 3912 virtual bool IsResolved() const; // Class and all arguments classes resolved.
3909 virtual bool HasResolvedTypeClass() const; // Own type class resolved. 3913 virtual bool HasResolvedTypeClass() const; // Own type class resolved.
3910 virtual RawClass* type_class() const; 3914 virtual RawClass* type_class() const;
3911 void set_type_class(const Object& value) const; 3915 void set_type_class(const Object& value) const;
3912 virtual RawUnresolvedClass* unresolved_class() const; 3916 virtual RawUnresolvedClass* unresolved_class() const;
3913 RawString* TypeClassName() const; 3917 RawString* TypeClassName() const;
3914 virtual RawAbstractTypeArguments* arguments() const; 3918 virtual RawAbstractTypeArguments* arguments() const;
3915 void set_arguments(const AbstractTypeArguments& value) const; 3919 void set_arguments(const AbstractTypeArguments& value) const;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
4003 // to the ObjectType. 4007 // to the ObjectType.
4004 class TypeParameter : public AbstractType { 4008 class TypeParameter : public AbstractType {
4005 public: 4009 public:
4006 virtual bool IsFinalized() const { 4010 virtual bool IsFinalized() const {
4007 ASSERT(raw_ptr()->type_state_ != RawTypeParameter::kFinalizedInstantiated); 4011 ASSERT(raw_ptr()->type_state_ != RawTypeParameter::kFinalizedInstantiated);
4008 return raw_ptr()->type_state_ == RawTypeParameter::kFinalizedUninstantiated; 4012 return raw_ptr()->type_state_ == RawTypeParameter::kFinalizedUninstantiated;
4009 } 4013 }
4010 void set_is_finalized() const; 4014 void set_is_finalized() const;
4011 virtual bool IsBeingFinalized() const { return false; } 4015 virtual bool IsBeingFinalized() const { return false; }
4012 virtual bool IsMalformed() const { return false; } 4016 virtual bool IsMalformed() const { return false; }
4017 virtual bool IsMalbounded() const { return false; }
4018 virtual bool IsMalboundedWithError(Error* bound_error) const { return false; }
4013 virtual bool IsResolved() const { return true; } 4019 virtual bool IsResolved() const { return true; }
4014 virtual bool HasResolvedTypeClass() const { return false; } 4020 virtual bool HasResolvedTypeClass() const { return false; }
4015 RawClass* parameterized_class() const { 4021 RawClass* parameterized_class() const {
4016 return raw_ptr()->parameterized_class_; 4022 return raw_ptr()->parameterized_class_;
4017 } 4023 }
4018 RawString* name() const { return raw_ptr()->name_; } 4024 RawString* name() const { return raw_ptr()->name_; }
4019 intptr_t index() const { return raw_ptr()->index_; } 4025 intptr_t index() const { return raw_ptr()->index_; }
4020 void set_index(intptr_t value) const; 4026 void set_index(intptr_t value) const;
4021 RawAbstractType* bound() const { return raw_ptr()->bound_; } 4027 RawAbstractType* bound() const { return raw_ptr()->bound_; }
4022 void set_bound(const AbstractType& value) const; 4028 void set_bound(const AbstractType& value) const;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
4065 // mode is known to be checked mode. 4071 // mode is known to be checked mode.
4066 class BoundedType : public AbstractType { 4072 class BoundedType : public AbstractType {
4067 public: 4073 public:
4068 virtual bool IsFinalized() const { 4074 virtual bool IsFinalized() const {
4069 return AbstractType::Handle(type()).IsFinalized(); 4075 return AbstractType::Handle(type()).IsFinalized();
4070 } 4076 }
4071 virtual bool IsBeingFinalized() const { 4077 virtual bool IsBeingFinalized() const {
4072 return AbstractType::Handle(type()).IsBeingFinalized(); 4078 return AbstractType::Handle(type()).IsBeingFinalized();
4073 } 4079 }
4074 virtual bool IsMalformed() const; 4080 virtual bool IsMalformed() const;
4081 virtual bool IsMalbounded() const { return IsMalboundedWithError(NULL); }
4082 virtual bool IsMalboundedWithError(Error* bound_error) const;
4075 virtual RawError* malformed_error() const; 4083 virtual RawError* malformed_error() const;
4076 virtual bool IsResolved() const { return true; } 4084 virtual bool IsResolved() const { return true; }
4077 virtual bool HasResolvedTypeClass() const { 4085 virtual bool HasResolvedTypeClass() const {
4078 return AbstractType::Handle(type()).HasResolvedTypeClass(); 4086 return AbstractType::Handle(type()).HasResolvedTypeClass();
4079 } 4087 }
4080 virtual RawClass* type_class() const { 4088 virtual RawClass* type_class() const {
4081 return AbstractType::Handle(type()).type_class(); 4089 return AbstractType::Handle(type()).type_class();
4082 } 4090 }
4083 virtual RawUnresolvedClass* unresolved_class() const { 4091 virtual RawUnresolvedClass* unresolved_class() const {
4084 return AbstractType::Handle(type()).unresolved_class(); 4092 return AbstractType::Handle(type()).unresolved_class();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
4132 4140
4133 // A MixinAppType represents a mixin application clause, e.g. 4141 // A MixinAppType represents a mixin application clause, e.g.
4134 // "S<T> with M<U, N>". The class finalizer builds the type 4142 // "S<T> with M<U, N>". The class finalizer builds the type
4135 // parameters and arguments at finalization time. 4143 // parameters and arguments at finalization time.
4136 // MixinType objects do not survive finalization, so they do not 4144 // MixinType objects do not survive finalization, so they do not
4137 // need to be written to and read from snapshots. 4145 // need to be written to and read from snapshots.
4138 class MixinAppType : public AbstractType { 4146 class MixinAppType : public AbstractType {
4139 public: 4147 public:
4140 // MixinAppType objects are replaced with their actual finalized type. 4148 // MixinAppType objects are replaced with their actual finalized type.
4141 virtual bool IsFinalized() const { return false; } 4149 virtual bool IsFinalized() const { return false; }
4150 // TODO(regis): Handle malformed and malbounded MixinAppType.
4142 virtual bool IsMalformed() const { return false; } 4151 virtual bool IsMalformed() const { return false; }
4152 virtual bool IsMalbounded() const { return false; }
4143 virtual bool IsResolved() const { return false; } 4153 virtual bool IsResolved() const { return false; }
4144 virtual bool HasResolvedTypeClass() const { return false; } 4154 virtual bool HasResolvedTypeClass() const { return false; }
4145 virtual RawString* Name() const; 4155 virtual RawString* Name() const;
4146 4156
4147 virtual intptr_t token_pos() const { 4157 virtual intptr_t token_pos() const {
4148 return AbstractType::Handle(super_type()).token_pos(); 4158 return AbstractType::Handle(super_type()).token_pos();
4149 } 4159 }
4150 4160
4151 virtual RawAbstractTypeArguments* arguments() const { 4161 virtual RawAbstractTypeArguments* arguments() const {
4152 return AbstractTypeArguments::null(); 4162 return AbstractTypeArguments::null();
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
6121 6131
6122 6132
6123 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6133 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6124 intptr_t index) { 6134 intptr_t index) {
6125 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6135 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6126 } 6136 }
6127 6137
6128 } // namespace dart 6138 } // namespace dart
6129 6139
6130 #endif // VM_OBJECT_H_ 6140 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698