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

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, 2 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 4267 matching lines...) Expand 10 before | Expand all | Expand 10 after
4278 } 4278 }
4279 void set_is_being_checked(bool value) const; 4279 void set_is_being_checked(bool value) const;
4280 4280
4281 static RawBoundedType* New(); 4281 static RawBoundedType* New();
4282 4282
4283 FINAL_HEAP_OBJECT_IMPLEMENTATION(BoundedType, AbstractType); 4283 FINAL_HEAP_OBJECT_IMPLEMENTATION(BoundedType, AbstractType);
4284 friend class Class; 4284 friend class Class;
4285 }; 4285 };
4286 4286
4287 4287
4288 // A MixinAppType represents a mixin application clause, e.g. 4288 // A MixinAppType represents a parsed mixin application clause, e.g.
4289 // "S<T> with M<U>, N<V>". The class finalizer builds the type 4289 // "S<T> with M<U>, N<V>".
4290 // parameters and arguments at finalization time.
4291 // MixinAppType objects do not survive finalization, so they do not 4290 // MixinAppType objects do not survive finalization, so they do not
4292 // 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 then do not
siva 2013/10/25 16:55:53 if they
hausner 2013/10/25 17:11:49 then->they
regis 2013/10/25 18:34:25 Done.
regis 2013/10/25 18:34:25 Done.
4293 // yet exist in the library declaring the mixin application clause.
4293 class MixinAppType : public AbstractType { 4294 class MixinAppType : public AbstractType {
4294 public: 4295 public:
4295 // A MixinAppType object is replaced at class finalization time with a 4296 // A MixinAppType object is unfinalized by definition, since it is replaced at
4296 // finalized Type or BoundedType object. 4297 // class finalization time with a finalized Type or BoundedType object.
4297 virtual bool IsFinalized() const { return false; } 4298 virtual bool IsFinalized() const { return false; }
4298 // TODO(regis): Handle malformed and malbounded MixinAppType. 4299 // TODO(regis): Handle malformed and malbounded MixinAppType.
4299 virtual bool IsMalformed() const { return false; } 4300 virtual bool IsMalformed() const { return false; }
4300 virtual bool IsMalbounded() const { return false; } 4301 virtual bool IsMalbounded() const { return false; }
4301 virtual bool IsResolved() const { return false; } 4302 virtual bool IsResolved() const { return false; }
4302 virtual bool HasResolvedTypeClass() const { return false; } 4303 virtual bool HasResolvedTypeClass() const { return false; }
4303 virtual RawString* Name() const; 4304 virtual RawString* Name() const;
4304 virtual intptr_t token_pos() const; 4305 virtual intptr_t token_pos() const;
4305 4306
4306 // Returns the mixin composition depth of this mixin application type. 4307 // Returns the mixin composition depth of this mixin application type.
4307 intptr_t Depth() const; 4308 intptr_t Depth() const;
4308 4309
4309 // 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
4310 // 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
4311 // super type "S<T>". 4312 // refer to super type "S<T>".
4312 RawAbstractType* SuperType() const; 4313 RawAbstractType* super_type() const { return raw_ptr()->super_type_; }
4313 4314
4314 // 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
4315 // the given mixin composition depth, e.g. class "S&M" at depth 0, class 4316 // depth 0 and M<U> at depth 1.
4316 // "S&M&N" at depth 1. 4317 RawAbstractType* MixinTypeAt(intptr_t depth) const;
4317 // Each class refers to its mixin type, e.g. "S&M" refers to mixin type "M<U>"
4318 // and "S&M&N" refers to mixin type "N<V>".
4319 RawClass* MixinAppAt(intptr_t depth) const;
4320 4318
4321 static intptr_t InstanceSize() { 4319 static intptr_t InstanceSize() {
4322 return RoundedAllocationSize(sizeof(RawMixinAppType)); 4320 return RoundedAllocationSize(sizeof(RawMixinAppType));
4323 } 4321 }
4324 4322
4325 static RawMixinAppType* New(const Array& mixins); 4323 static RawMixinAppType* New(const AbstractType& super_type,
4324 const Array& mixin_types);
4326 4325
4327 private: 4326 private:
4328 RawArray* mixins() const { return raw_ptr()->mixins_; } 4327 void set_super_type(const AbstractType& value) const;
4329 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;
4330 4331
4331 static RawMixinAppType* New(); 4332 static RawMixinAppType* New();
4332 4333
4333 FINAL_HEAP_OBJECT_IMPLEMENTATION(MixinAppType, AbstractType); 4334 FINAL_HEAP_OBJECT_IMPLEMENTATION(MixinAppType, AbstractType);
4334 friend class Class; 4335 friend class Class;
4335 }; 4336 };
4336 4337
4337 4338
4338 class Number : public Instance { 4339 class Number : public Instance {
4339 public: 4340 public:
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after
6295 6296
6296 6297
6297 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6298 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6298 intptr_t index) { 6299 intptr_t index) {
6299 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6300 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6300 } 6301 }
6301 6302
6302 } // namespace dart 6303 } // namespace dart
6303 6304
6304 #endif // VM_OBJECT_H_ 6305 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698