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

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

Issue 10205006: Mark types as instantiated or uninstantiated upon finalization. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 878
879 // A Type consists of a class, possibly parameterized with type 879 // A Type consists of a class, possibly parameterized with type
880 // arguments. Example: C<T1, T2>. 880 // arguments. Example: C<T1, T2>.
881 // An unresolved class is a String specifying the class name. 881 // An unresolved class is a String specifying the class name.
882 class Type : public AbstractType { 882 class Type : public AbstractType {
883 public: 883 public:
884 static intptr_t type_class_offset() { 884 static intptr_t type_class_offset() {
885 return OFFSET_OF(RawType, type_class_); 885 return OFFSET_OF(RawType, type_class_);
886 } 886 }
887 virtual bool IsFinalized() const { 887 virtual bool IsFinalized() const {
888 return raw_ptr()->type_state_ == RawType::kFinalized; 888 return
889 (raw_ptr()->type_state_ == RawType::kFinalizedInstantiated) ||
890 (raw_ptr()->type_state_ == RawType::kFinalizedUninstantiated);
889 } 891 }
890 void set_is_finalized() const; 892 void set_is_finalized_instantiated() const;
893 void set_is_finalized_uninstantiated() const;
891 virtual bool IsBeingFinalized() const { 894 virtual bool IsBeingFinalized() const {
892 return raw_ptr()->type_state_ == RawType::kBeingFinalized; 895 return raw_ptr()->type_state_ == RawType::kBeingFinalized;
893 } 896 }
894 void set_is_being_finalized() const; 897 void set_is_being_finalized() const;
895 virtual bool IsMalformed() const; 898 virtual bool IsMalformed() const;
896 virtual RawError* malformed_error() const; 899 virtual RawError* malformed_error() const;
897 virtual void set_malformed_error(const Error& value) const; 900 virtual void set_malformed_error(const Error& value) const;
898 virtual bool IsResolved() const; // Class and all arguments classes resolved. 901 virtual bool IsResolved() const; // Class and all arguments classes resolved.
899 virtual bool HasResolvedTypeClass() const; // Own type class resolved. 902 virtual bool HasResolvedTypeClass() const; // Own type class resolved.
900 virtual RawClass* type_class() const; 903 virtual RawClass* type_class() const;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 // A TypeParameter represents a type parameter of a parameterized class. 972 // A TypeParameter represents a type parameter of a parameterized class.
970 // It specifies its index (and its name for debugging purposes). 973 // It specifies its index (and its name for debugging purposes).
971 // For example, the type parameter 'V' is specified as index 1 in the context of 974 // For example, the type parameter 'V' is specified as index 1 in the context of
972 // the class HashMap<K, V>. At compile time, the TypeParameter is not 975 // the class HashMap<K, V>. At compile time, the TypeParameter is not
973 // instantiated yet, i.e. it is only a place holder. 976 // instantiated yet, i.e. it is only a place holder.
974 // Upon finalization, the TypeParameter index is changed to reflect its position 977 // Upon finalization, the TypeParameter index is changed to reflect its position
975 // as type argument (rather than type parameter) of the parameterized class. 978 // as type argument (rather than type parameter) of the parameterized class.
976 class TypeParameter : public AbstractType { 979 class TypeParameter : public AbstractType {
977 public: 980 public:
978 virtual bool IsFinalized() const { 981 virtual bool IsFinalized() const {
979 return raw_ptr()->type_state_ == RawTypeParameter::kFinalized; 982 return raw_ptr()->type_state_ == RawTypeParameter::kFinalizedUninstantiated;
srdjan 2012/04/24 00:56:28 Assert somewhere that is is not kFinalizedInstanti
regis 2012/04/24 16:06:58 Done.
980 } 983 }
981 void set_is_finalized() const; 984 void set_is_finalized() const;
982 virtual bool IsBeingFinalized() const { return false; } 985 virtual bool IsBeingFinalized() const { return false; }
983 virtual bool IsMalformed() const { return false; } 986 virtual bool IsMalformed() const { return false; }
984 virtual bool IsResolved() const { return true; } 987 virtual bool IsResolved() const { return true; }
985 virtual bool HasResolvedTypeClass() const { return false; } 988 virtual bool HasResolvedTypeClass() const { return false; }
986 RawClass* parameterized_class() const { 989 RawClass* parameterized_class() const {
987 return raw_ptr()->parameterized_class_; 990 return raw_ptr()->parameterized_class_;
988 } 991 }
989 virtual RawString* Name() const { return raw_ptr()->name_; } 992 virtual RawString* Name() const { return raw_ptr()->name_; }
(...skipping 3006 matching lines...) Expand 10 before | Expand all | Expand 10 after
3996 } 3999 }
3997 4000
3998 4001
3999 intptr_t Stackmap::SizeInBits() const { 4002 intptr_t Stackmap::SizeInBits() const {
4000 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); 4003 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte);
4001 } 4004 }
4002 4005
4003 } // namespace dart 4006 } // namespace dart
4004 4007
4005 #endif // VM_OBJECT_H_ 4008 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698