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

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

Issue 42723003: Register synthesized mixin application classes in the library and reuse them (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 return OFFSET_OF(RawClass, super_type_); 778 return OFFSET_OF(RawClass, super_type_);
779 } 779 }
780 780
781 // Asserts that the class of the super type has been resolved. 781 // Asserts that the class of the super type has been resolved.
782 RawClass* SuperClass() const; 782 RawClass* SuperClass() const;
783 783
784 RawType* mixin() const { return raw_ptr()->mixin_; } 784 RawType* mixin() const { return raw_ptr()->mixin_; }
785 void set_mixin(const Type& value) const; 785 void set_mixin(const Type& value) const;
786 786
787 bool IsMixinApplication() const; 787 bool IsMixinApplication() const;
788 bool IsAnonymousMixinApplication() const;
788 789
789 RawClass* patch_class() const { 790 RawClass* patch_class() const {
790 return raw_ptr()->patch_class_; 791 return raw_ptr()->patch_class_;
791 } 792 }
792 void set_patch_class(const Class& patch_class) const; 793 void set_patch_class(const Class& patch_class) const;
793 794
794 // Interfaces is an array of Types. 795 // Interfaces is an array of Types.
795 RawArray* interfaces() const { return raw_ptr()->interfaces_; } 796 RawArray* interfaces() const { return raw_ptr()->interfaces_; }
796 void set_interfaces(const Array& value) const; 797 void set_interfaces(const Array& value) const;
797 static intptr_t interfaces_offset() { 798 static intptr_t interfaces_offset() {
(...skipping 3479 matching lines...) Expand 10 before | Expand all | Expand 10 after
4277 } 4278 }
4278 void set_is_being_checked(bool value) const; 4279 void set_is_being_checked(bool value) const;
4279 4280
4280 static RawBoundedType* New(); 4281 static RawBoundedType* New();
4281 4282
4282 FINAL_HEAP_OBJECT_IMPLEMENTATION(BoundedType, AbstractType); 4283 FINAL_HEAP_OBJECT_IMPLEMENTATION(BoundedType, AbstractType);
4283 friend class Class; 4284 friend class Class;
4284 }; 4285 };
4285 4286
4286 4287
4287 // A MixinAppType represents a mixin application clause, e.g. 4288 // A MixinAppType represents a parsed mixin application clause, e.g.
4288 // "S<T> with M<U>, N<V>". The class finalizer builds the type 4289 // "S<T> with M<U>, N<V>".
4289 // parameters and arguments at finalization time.
4290 // MixinAppType objects do not survive finalization, so they do not 4290 // MixinAppType objects do not survive finalization, so they do not
4291 // need to be written to and read from snapshots. 4291 // need to be written to and read from snapshots.
4292 // The class finalizer creates synthesized classes S&M and S&M&N if they do not
4293 // yet exist in the library declaring the mixin application clause.
4292 class MixinAppType : public AbstractType { 4294 class MixinAppType : public AbstractType {
4293 public: 4295 public:
4294 // A MixinAppType object is replaced at class finalization time with a 4296 // A MixinAppType object is unfinalized by definition, since it is replaced at
4295 // finalized Type or BoundedType object. 4297 // class finalization time with a finalized Type or BoundedType object.
4296 virtual bool IsFinalized() const { return false; } 4298 virtual bool IsFinalized() const { return false; }
4297 // TODO(regis): Handle malformed and malbounded MixinAppType. 4299 // TODO(regis): Handle malformed and malbounded MixinAppType.
4298 virtual bool IsMalformed() const { return false; } 4300 virtual bool IsMalformed() const { return false; }
4299 virtual bool IsMalbounded() const { return false; } 4301 virtual bool IsMalbounded() const { return false; }
4300 virtual bool IsResolved() const { return false; } 4302 virtual bool IsResolved() const { return false; }
4301 virtual bool HasResolvedTypeClass() const { return false; } 4303 virtual bool HasResolvedTypeClass() const { return false; }
4302 virtual RawString* Name() const; 4304 virtual RawString* Name() const;
4303 virtual intptr_t token_pos() const; 4305 virtual intptr_t token_pos() const;
4304 4306
4305 // Returns the mixin composition depth of this mixin application type. 4307 // Returns the mixin composition depth of this mixin application type.
4306 intptr_t Depth() const; 4308 intptr_t Depth() const;
4307 4309
4308 // Returns the declared super type of the mixin application, which is also 4310 // Returns the declared super type of the mixin application, which will also
4309 // the super type of the first synthesized class, e.g. "S&M" refers to 4311 // be the super type of the first synthesized class, e.g. class "S&M" will
4310 // super type "S<T>". 4312 // refer to super type "S<T>".
4311 RawAbstractType* SuperType() const; 4313 RawAbstractType* super_type() const { return raw_ptr()->super_type_; }
4312 4314
4313 // Returns the synthesized class representing the mixin application at 4315 // Returns the mixin type at the given mixin composition depth, e.g. N<V> at
4314 // the given mixin composition depth, e.g. class "S&M" at depth 0, class 4316 // depth 0 and M<U> at depth 1.
4315 // "S&M&N" at depth 1. 4317 RawAbstractType* MixinTypeAt(intptr_t depth) const;
4316 // Each class refers to its mixin type, e.g. "S&M" refers to mixin type "M<U>"
4317 // and "S&M&N" refers to mixin type "N<V>".
4318 RawClass* MixinAppAt(intptr_t depth) const;
4319 4318
4320 static intptr_t InstanceSize() { 4319 static intptr_t InstanceSize() {
4321 return RoundedAllocationSize(sizeof(RawMixinAppType)); 4320 return RoundedAllocationSize(sizeof(RawMixinAppType));
4322 } 4321 }
4323 4322
4324 static RawMixinAppType* New(const Array& mixins); 4323 static RawMixinAppType* New(const AbstractType& super_type,
4324 const Array& mixin_types);
4325 4325
4326 private: 4326 private:
4327 RawArray* mixins() const { return raw_ptr()->mixins_; } 4327 void set_super_type(const AbstractType& value) const;
4328 void set_mixins(const Array& value) const; 4328
4329 RawArray* mixin_types() const { return raw_ptr()->mixin_types_; }
4330 void set_mixin_types(const Array& value) const;
4329 4331
4330 static RawMixinAppType* New(); 4332 static RawMixinAppType* New();
4331 4333
4332 FINAL_HEAP_OBJECT_IMPLEMENTATION(MixinAppType, AbstractType); 4334 FINAL_HEAP_OBJECT_IMPLEMENTATION(MixinAppType, AbstractType);
4333 friend class Class; 4335 friend class Class;
4334 }; 4336 };
4335 4337
4336 4338
4337 class Number : public Instance { 4339 class Number : public Instance {
4338 public: 4340 public:
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after
6294 6296
6295 6297
6296 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6298 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6297 intptr_t index) { 6299 intptr_t index) {
6298 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6300 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6299 } 6301 }
6300 6302
6301 } // namespace dart 6303 } // namespace dart
6302 6304
6303 #endif // VM_OBJECT_H_ 6305 #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