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

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

Issue 8247014: Changes to handle unresolved qualified identifiers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/assert.h" 8 #include "vm/assert.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/handles.h" 10 #include "vm/handles.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 public: 112 public:
113 // Index for Singleton internal VM classes, 113 // Index for Singleton internal VM classes,
114 // this index is used in snapshots to refer to these classes directly. 114 // this index is used in snapshots to refer to these classes directly.
115 enum { 115 enum {
116 kNullObject = 0, 116 kNullObject = 0,
117 kSentinelObject, 117 kSentinelObject,
118 kClassClass, 118 kClassClass,
119 kNullClass, 119 kNullClass,
120 kVarClass, 120 kVarClass,
121 kVoidClass, 121 kVoidClass,
122 kUnresolvedClassClass,
122 kParameterizedTypeClass, 123 kParameterizedTypeClass,
123 kTypeParameterClass, 124 kTypeParameterClass,
124 kInstantiatedTypeClass, 125 kInstantiatedTypeClass,
125 kTypeArgumentsClass, 126 kTypeArgumentsClass,
126 kTypeArrayClass, 127 kTypeArrayClass,
127 kInstantiatedTypeArgumentsClass, 128 kInstantiatedTypeArgumentsClass,
128 kFunctionClass, 129 kFunctionClass,
129 kFieldClass, 130 kFieldClass,
130 kTokenStreamClass, 131 kTokenStreamClass,
131 kScriptClass, 132 kScriptClass,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // "uninitialized" fields. 203 // "uninitialized" fields.
203 static RawInstance* sentinel() { return sentinel_; } 204 static RawInstance* sentinel() { return sentinel_; }
204 // Value marking that we are transitioning from sentinel, e.g., computing 205 // Value marking that we are transitioning from sentinel, e.g., computing
205 // a field value. Used to detect circular initialization. 206 // a field value. Used to detect circular initialization.
206 static RawInstance* transition_sentinel() { return transition_sentinel_; } 207 static RawInstance* transition_sentinel() { return transition_sentinel_; }
207 208
208 static RawClass* class_class() { return class_class_; } 209 static RawClass* class_class() { return class_class_; }
209 static RawClass* null_class() { return null_class_; } 210 static RawClass* null_class() { return null_class_; }
210 static RawClass* var_class() { return var_class_; } 211 static RawClass* var_class() { return var_class_; }
211 static RawClass* void_class() { return void_class_; } 212 static RawClass* void_class() { return void_class_; }
213 static RawClass* unresolved_class_class() { return unresolved_class_class_; }
212 static RawClass* parameterized_type_class() { 214 static RawClass* parameterized_type_class() {
213 return parameterized_type_class_; 215 return parameterized_type_class_;
214 } 216 }
215 static RawClass* type_parameter_class() { return type_parameter_class_; } 217 static RawClass* type_parameter_class() { return type_parameter_class_; }
216 static RawClass* instantiated_type_class() { 218 static RawClass* instantiated_type_class() {
217 return instantiated_type_class_; 219 return instantiated_type_class_;
218 } 220 }
219 static RawClass* type_arguments_class() { return type_arguments_class_; } 221 static RawClass* type_arguments_class() { return type_arguments_class_; }
220 static RawClass* type_array_class() { return type_array_class_; } 222 static RawClass* type_array_class() { return type_array_class_; }
221 static RawClass* instantiated_type_arguments_class() { 223 static RawClass* instantiated_type_arguments_class() {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // The static values below are singletons shared between the different 307 // The static values below are singletons shared between the different
306 // isolates. They are all allocated in the non-GC'd Dart::vm_isolate_. 308 // isolates. They are all allocated in the non-GC'd Dart::vm_isolate_.
307 static RawObject* null_; 309 static RawObject* null_;
308 static RawInstance* sentinel_; 310 static RawInstance* sentinel_;
309 static RawInstance* transition_sentinel_; 311 static RawInstance* transition_sentinel_;
310 312
311 static RawClass* class_class_; // Class of the Class vm object. 313 static RawClass* class_class_; // Class of the Class vm object.
312 static RawClass* null_class_; // Class of the null object. 314 static RawClass* null_class_; // Class of the null object.
313 static RawClass* var_class_; // Class of the 'var' type. 315 static RawClass* var_class_; // Class of the 'var' type.
314 static RawClass* void_class_; // Class of the 'void' type. 316 static RawClass* void_class_; // Class of the 'void' type.
317 static RawClass* unresolved_class_class_; // Class of UnresolvedClass.
315 static RawClass* parameterized_type_class_; // Class of ParameterizedType. 318 static RawClass* parameterized_type_class_; // Class of ParameterizedType.
316 static RawClass* type_parameter_class_; // Class of TypeParameter vm object. 319 static RawClass* type_parameter_class_; // Class of TypeParameter vm object.
317 static RawClass* instantiated_type_class_; // Class of InstantiatedType. 320 static RawClass* instantiated_type_class_; // Class of InstantiatedType.
318 static RawClass* type_arguments_class_; // Class of TypeArguments vm object. 321 static RawClass* type_arguments_class_; // Class of TypeArguments vm object.
319 static RawClass* type_array_class_; // Class of the TypeArray vm object. 322 static RawClass* type_array_class_; // Class of the TypeArray vm object.
320 static RawClass* instantiated_type_arguments_class_; // Class of Inst..ments. 323 static RawClass* instantiated_type_arguments_class_; // Class of Inst..ments.
321 static RawClass* function_class_; // Class of the Function vm object. 324 static RawClass* function_class_; // Class of the Function vm object.
322 static RawClass* field_class_; // Class of the Field vm object. 325 static RawClass* field_class_; // Class of the Field vm object.
323 static RawClass* token_stream_class_; // Class of the TokenStream vm object. 326 static RawClass* token_stream_class_; // Class of the TokenStream vm object.
324 static RawClass* script_class_; // Class of the Script vm object. 327 static RawClass* script_class_; // Class of the Script vm object.
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 611
609 // Assigns empty array to all raw class array fields. 612 // Assigns empty array to all raw class array fields.
610 void InitEmptyFields(); 613 void InitEmptyFields();
611 614
612 HEAP_OBJECT_IMPLEMENTATION(Class, Object); 615 HEAP_OBJECT_IMPLEMENTATION(Class, Object);
613 friend class Object; 616 friend class Object;
614 friend class Instance; 617 friend class Instance;
615 }; 618 };
616 619
617 620
621 // Unresolved class is used for storing unresolved names which will be resolved
622 // to a class after all classes have been loaded and finalized.
623 class UnresolvedClass : public Object {
624 public:
625 RawString* qualifier() const { return raw_ptr()->qualifier_; }
626 RawString* ident() const { return raw_ptr()->ident_; }
627 intptr_t token_index() const { return raw_ptr()->token_index_; }
628
629 RawString* Name() const;
630
631 static intptr_t InstanceSize() {
632 return RoundedAllocationSize(sizeof(RawUnresolvedClass));
633 }
634 static RawUnresolvedClass* New(intptr_t token_index,
635 const String& qualifier,
636 const String& ident);
637
638 private:
639 void set_token_index(intptr_t token_index) const;
640 void set_ident(const String& ident) const;
641 void set_qualifier(const String& qualifier) const;
642
643 static RawUnresolvedClass* New();
644
645 HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object);
646 friend class Class;
647 };
648
649
618 // Type is an abstract superclass. 650 // Type is an abstract superclass.
619 // Subclasses of Type are ParameterizedType, TypeParameter, and 651 // Subclasses of Type are ParameterizedType, TypeParameter, and
620 // InstantiatedType. 652 // InstantiatedType.
621 // 653 //
622 // Caution: 'RawType*' denotes a 'raw' pointer to a VM object of class Type, 654 // Caution: 'RawType*' denotes a 'raw' pointer to a VM object of class Type,
623 // as opposed to 'Type' denoting a 'handle' to the same object. 'RawType' does 655 // as opposed to 'Type' denoting a 'handle' to the same object. 'RawType' does
624 // not relate to a 'raw type', as opposed to a 'cooked type' or 'rare type'. 656 // not relate to a 'raw type', as opposed to a 'cooked type' or 'rare type'.
625 class Type : public Object { 657 class Type : public Object {
626 public: 658 public:
627 virtual bool IsFinalized() const; 659 virtual bool IsFinalized() const;
628 virtual bool IsResolved() const; 660 virtual bool IsResolved() const;
629 virtual bool HasResolvedTypeClass() const; 661 virtual bool HasResolvedTypeClass() const;
630 virtual RawClass* type_class() const; 662 virtual RawClass* type_class() const;
631 virtual RawString* unresolved_type_class() const; 663 virtual RawUnresolvedClass* unresolved_class() const;
632 virtual RawTypeArguments* arguments() const; 664 virtual RawTypeArguments* arguments() const;
633 virtual bool IsInstantiated() const; 665 virtual bool IsInstantiated() const;
634 666
635 // Instantiate this type using the given type argument vector starting at the 667 // Instantiate this type using the given type argument vector starting at the
636 // given offset. 668 // given offset.
637 // Return a new type, or return 'this' if it is already instantiated. 669 // Return a new type, or return 'this' if it is already instantiated.
638 virtual RawType* InstantiateFrom( 670 virtual RawType* InstantiateFrom(
639 const TypeArguments& instantiator_type_arguments, 671 const TypeArguments& instantiator_type_arguments,
640 intptr_t offset) const; 672 intptr_t offset) const;
641 673
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 } 802 }
771 void set_is_finalized() const; 803 void set_is_finalized() const;
772 bool is_being_finalized() const { 804 bool is_being_finalized() const {
773 return raw_ptr()->type_state_ == RawParameterizedType::kBeingFinalized; 805 return raw_ptr()->type_state_ == RawParameterizedType::kBeingFinalized;
774 } 806 }
775 void set_is_being_finalized() const; 807 void set_is_being_finalized() const;
776 virtual bool IsResolved() const; // Class and all arguments classes resolved. 808 virtual bool IsResolved() const; // Class and all arguments classes resolved.
777 virtual bool HasResolvedTypeClass() const; // Own type class resolved. 809 virtual bool HasResolvedTypeClass() const; // Own type class resolved.
778 virtual RawClass* type_class() const; 810 virtual RawClass* type_class() const;
779 void set_type_class(const Object& value) const; 811 void set_type_class(const Object& value) const;
780 virtual RawString* unresolved_type_class() const; 812 virtual RawUnresolvedClass* unresolved_class() const;
781 virtual RawTypeArguments* arguments() const; 813 virtual RawTypeArguments* arguments() const;
782 void set_arguments(const TypeArguments& value) const; 814 void set_arguments(const TypeArguments& value) const;
783 virtual bool IsInstantiated() const; 815 virtual bool IsInstantiated() const;
784 virtual RawType* InstantiateFrom( 816 virtual RawType* InstantiateFrom(
785 const TypeArguments& instantiator_type_arguments, 817 const TypeArguments& instantiator_type_arguments,
786 intptr_t offset) const; 818 intptr_t offset) const;
787 819
788 static intptr_t InstanceSize() { 820 static intptr_t InstanceSize() {
789 return RoundedAllocationSize(sizeof(RawParameterizedType)); 821 return RoundedAllocationSize(sizeof(RawParameterizedType));
790 } 822 }
(...skipping 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after
2809 } 2841 }
2810 2842
2811 2843
2812 void Context::SetAt(intptr_t index, const Instance& value) const { 2844 void Context::SetAt(intptr_t index, const Instance& value) const {
2813 StorePointer(InstanceAddr(index), value.raw()); 2845 StorePointer(InstanceAddr(index), value.raw());
2814 } 2846 }
2815 2847
2816 } // namespace dart 2848 } // namespace dart
2817 2849
2818 #endif // VM_OBJECT_H_ 2850 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698