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

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

Issue 12086031: Make Type, TypeParameter, TypeArguments and InstantiatedTypeArguments final heap objects. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 | « no previous file | no next file » | 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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 return RoundedAllocationSize( 1069 return RoundedAllocationSize(
1070 sizeof(RawTypeArguments) + (len * kBytesPerElement)); 1070 sizeof(RawTypeArguments) + (len * kBytesPerElement));
1071 } 1071 }
1072 1072
1073 static RawTypeArguments* New(intptr_t len, Heap::Space space = Heap::kOld); 1073 static RawTypeArguments* New(intptr_t len, Heap::Space space = Heap::kOld);
1074 1074
1075 private: 1075 private:
1076 RawAbstractType** TypeAddr(intptr_t index) const; 1076 RawAbstractType** TypeAddr(intptr_t index) const;
1077 void SetLength(intptr_t value) const; 1077 void SetLength(intptr_t value) const;
1078 1078
1079 HEAP_OBJECT_IMPLEMENTATION(TypeArguments, AbstractTypeArguments); 1079 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeArguments, AbstractTypeArguments);
1080 friend class Class; 1080 friend class Class;
1081 }; 1081 };
1082 1082
1083 1083
1084 // An instance of InstantiatedTypeArguments is never encountered at compile 1084 // An instance of InstantiatedTypeArguments is never encountered at compile
1085 // time, but only at run time, when type parameters can be matched to actual 1085 // time, but only at run time, when type parameters can be matched to actual
1086 // types. 1086 // types.
1087 // An instance of InstantiatedTypeArguments consists of a pair of 1087 // An instance of InstantiatedTypeArguments consists of a pair of
1088 // AbstractTypeArguments objects. The first type argument vector is 1088 // AbstractTypeArguments objects. The first type argument vector is
1089 // uninstantiated, because it contains type expressions referring to at least 1089 // uninstantiated, because it contains type expressions referring to at least
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 const AbstractTypeArguments& uninstantiated_type_arguments, 1124 const AbstractTypeArguments& uninstantiated_type_arguments,
1125 const AbstractTypeArguments& instantiator_type_arguments); 1125 const AbstractTypeArguments& instantiator_type_arguments);
1126 1126
1127 private: 1127 private:
1128 void set_uninstantiated_type_arguments( 1128 void set_uninstantiated_type_arguments(
1129 const AbstractTypeArguments& value) const; 1129 const AbstractTypeArguments& value) const;
1130 void set_instantiator_type_arguments( 1130 void set_instantiator_type_arguments(
1131 const AbstractTypeArguments& value) const; 1131 const AbstractTypeArguments& value) const;
1132 static RawInstantiatedTypeArguments* New(); 1132 static RawInstantiatedTypeArguments* New();
1133 1133
1134 HEAP_OBJECT_IMPLEMENTATION(InstantiatedTypeArguments, AbstractTypeArguments); 1134 FINAL_HEAP_OBJECT_IMPLEMENTATION(InstantiatedTypeArguments,
1135 AbstractTypeArguments);
1135 friend class Class; 1136 friend class Class;
1136 }; 1137 };
1137 1138
1138 1139
1139 class PatchClass : public Object { 1140 class PatchClass : public Object {
1140 public: 1141 public:
1141 RawClass* patched_class() const { return raw_ptr()->patched_class_; } 1142 RawClass* patched_class() const { return raw_ptr()->patched_class_; }
1142 RawScript* script() const { return raw_ptr()->script_; } 1143 RawScript* script() const { return raw_ptr()->script_; }
1143 1144
1144 static intptr_t InstanceSize() { 1145 static intptr_t InstanceSize() {
(...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after
3551 const AbstractTypeArguments& arguments, 3552 const AbstractTypeArguments& arguments,
3552 intptr_t token_pos, 3553 intptr_t token_pos,
3553 Heap::Space space = Heap::kOld); 3554 Heap::Space space = Heap::kOld);
3554 3555
3555 private: 3556 private:
3556 void set_token_pos(intptr_t token_pos) const; 3557 void set_token_pos(intptr_t token_pos) const;
3557 void set_type_state(int8_t state) const; 3558 void set_type_state(int8_t state) const;
3558 3559
3559 static RawType* New(Heap::Space space = Heap::kOld); 3560 static RawType* New(Heap::Space space = Heap::kOld);
3560 3561
3561 HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType); 3562 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType);
3562 friend class Class; 3563 friend class Class;
3563 }; 3564 };
3564 3565
3565 3566
3566 // A TypeParameter represents a type parameter of a parameterized class. 3567 // A TypeParameter represents a type parameter of a parameterized class.
3567 // It specifies its index (and its name for debugging purposes), as well as its 3568 // It specifies its index (and its name for debugging purposes), as well as its
3568 // upper bound. 3569 // upper bound.
3569 // For example, the type parameter 'V' is specified as index 1 in the context of 3570 // For example, the type parameter 'V' is specified as index 1 in the context of
3570 // the class HashMap<K, V>. At compile time, the TypeParameter is not 3571 // the class HashMap<K, V>. At compile time, the TypeParameter is not
3571 // instantiated yet, i.e. it is only a place holder. 3572 // instantiated yet, i.e. it is only a place holder.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3611 const AbstractType& bound, 3612 const AbstractType& bound,
3612 intptr_t token_pos); 3613 intptr_t token_pos);
3613 3614
3614 private: 3615 private:
3615 void set_parameterized_class(const Class& value) const; 3616 void set_parameterized_class(const Class& value) const;
3616 void set_name(const String& value) const; 3617 void set_name(const String& value) const;
3617 void set_token_pos(intptr_t token_pos) const; 3618 void set_token_pos(intptr_t token_pos) const;
3618 void set_type_state(int8_t state) const; 3619 void set_type_state(int8_t state) const;
3619 static RawTypeParameter* New(); 3620 static RawTypeParameter* New();
3620 3621
3621 HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType); 3622 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType);
3622 friend class Class; 3623 friend class Class;
3623 }; 3624 };
3624 3625
3625 3626
3626 class Number : public Instance { 3627 class Number : public Instance {
3627 public: 3628 public:
3628 // TODO(iposva): Fill in a useful Number interface. 3629 // TODO(iposva): Fill in a useful Number interface.
3629 virtual bool IsZero() const { 3630 virtual bool IsZero() const {
3630 // Number is an abstract class. 3631 // Number is an abstract class.
3631 UNREACHABLE(); 3632 UNREACHABLE();
(...skipping 2689 matching lines...) Expand 10 before | Expand all | Expand 10 after
6321 6322
6322 6323
6323 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6324 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6324 intptr_t index) { 6325 intptr_t index) {
6325 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6326 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6326 } 6327 }
6327 6328
6328 } // namespace dart 6329 } // namespace dart
6329 6330
6330 #endif // VM_OBJECT_H_ 6331 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698