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

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

Issue 23619026: Simplify VM internal representation of a mixin application clause (MixinAppType (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/class_finalizer.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 4143 matching lines...) Expand 10 before | Expand all | Expand 10 after
4154 void set_is_being_checked(bool value) const; 4154 void set_is_being_checked(bool value) const;
4155 4155
4156 static RawBoundedType* New(); 4156 static RawBoundedType* New();
4157 4157
4158 FINAL_HEAP_OBJECT_IMPLEMENTATION(BoundedType, AbstractType); 4158 FINAL_HEAP_OBJECT_IMPLEMENTATION(BoundedType, AbstractType);
4159 friend class Class; 4159 friend class Class;
4160 }; 4160 };
4161 4161
4162 4162
4163 // A MixinAppType represents a mixin application clause, e.g. 4163 // A MixinAppType represents a mixin application clause, e.g.
4164 // "S<T> with M<U, N>". The class finalizer builds the type 4164 // "S<T> with M<U>, N<V>". The class finalizer builds the type
4165 // parameters and arguments at finalization time. 4165 // parameters and arguments at finalization time.
4166 // MixinType objects do not survive finalization, so they do not 4166 // MixinAppType objects do not survive finalization, so they do not
4167 // need to be written to and read from snapshots. 4167 // need to be written to and read from snapshots.
4168 class MixinAppType : public AbstractType { 4168 class MixinAppType : public AbstractType {
4169 public: 4169 public:
4170 // MixinAppType objects are replaced with their actual finalized type. 4170 // A MixinAppType object is replaced at class finalization time with a
4171 // finalized Type or BoundedType object.
4171 virtual bool IsFinalized() const { return false; } 4172 virtual bool IsFinalized() const { return false; }
4172 // TODO(regis): Handle malformed and malbounded MixinAppType. 4173 // TODO(regis): Handle malformed and malbounded MixinAppType.
4173 virtual bool IsMalformed() const { return false; } 4174 virtual bool IsMalformed() const { return false; }
4174 virtual bool IsMalbounded() const { return false; } 4175 virtual bool IsMalbounded() const { return false; }
4175 virtual bool IsResolved() const { return false; } 4176 virtual bool IsResolved() const { return false; }
4176 virtual bool HasResolvedTypeClass() const { return false; } 4177 virtual bool HasResolvedTypeClass() const { return false; }
4177 virtual RawString* Name() const; 4178 virtual RawString* Name() const;
4179 virtual intptr_t token_pos() const;
4178 4180
4179 virtual intptr_t token_pos() const { 4181 // Returns the mixin composition depth of this mixin application type.
4180 return AbstractType::Handle(super_type()).token_pos(); 4182 intptr_t Depth() const;
4181 }
4182 4183
4183 virtual RawAbstractTypeArguments* arguments() const { 4184 // Returns the declared super type of the mixin application, which is also
4184 return AbstractTypeArguments::null(); 4185 // the super type of the first synthesized class, e.g. "S&M" refers to
4185 } 4186 // super type "S<T>".
4187 RawAbstractType* SuperType() const;
4186 4188
4187 RawAbstractType* super_type() const { return raw_ptr()->super_type_; } 4189 // Returns the synthesized class representing the mixin application at
4188 RawArray* mixin_types() const { return raw_ptr()->mixin_types_; } 4190 // the given mixin composition depth, e.g. class "S&M" at depth 0, class
4191 // "S&M&N" at depth 1.
4192 // Each class refers to its mixin type, e.g. "S&M" refers to mixin type "M<U>"
4193 // and "S&M&N" refers to mixin type "N<V>".
4194 RawClass* MixinAppAt(intptr_t depth) const;
4189 4195
4190 static intptr_t InstanceSize() { 4196 static intptr_t InstanceSize() {
4191 return RoundedAllocationSize(sizeof(RawMixinAppType)); 4197 return RoundedAllocationSize(sizeof(RawMixinAppType));
4192 } 4198 }
4193 4199
4194 static RawMixinAppType* New(const AbstractType& super_type, 4200 static RawMixinAppType* New(const Array& mixins);
4195 const Array& mixin_types);
4196 4201
4197 private: 4202 private:
4198 void set_super_type(const AbstractType& value) const; 4203 RawArray* mixins() const { return raw_ptr()->mixins_; }
4199 void set_mixin_types(const Array& value) const; 4204 void set_mixins(const Array& value) const;
4200 4205
4201 static RawMixinAppType* New(); 4206 static RawMixinAppType* New();
4202 4207
4203 FINAL_HEAP_OBJECT_IMPLEMENTATION(MixinAppType, AbstractType); 4208 FINAL_HEAP_OBJECT_IMPLEMENTATION(MixinAppType, AbstractType);
4204 friend class Class; 4209 friend class Class;
4205 }; 4210 };
4206 4211
4207 4212
4208 class Number : public Instance { 4213 class Number : public Instance {
4209 public: 4214 public:
(...skipping 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after
6148 6153
6149 6154
6150 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6155 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6151 intptr_t index) { 6156 intptr_t index) {
6152 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6157 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6153 } 6158 }
6154 6159
6155 } // namespace dart 6160 } // namespace dart
6156 6161
6157 #endif // VM_OBJECT_H_ 6162 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698