| OLD | NEW | 
|     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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   380  |   380  | 
|   381   // The static values below are singletons shared between the different |   381   // The static values below are singletons shared between the different | 
|   382   // isolates. They are all allocated in the non-GC'd Dart::vm_isolate_. |   382   // isolates. They are all allocated in the non-GC'd Dart::vm_isolate_. | 
|   383   static RawObject* null_; |   383   static RawObject* null_; | 
|   384   static RawArray* empty_array_; |   384   static RawArray* empty_array_; | 
|   385   static RawInstance* sentinel_; |   385   static RawInstance* sentinel_; | 
|   386   static RawInstance* transition_sentinel_; |   386   static RawInstance* transition_sentinel_; | 
|   387  |   387  | 
|   388   static RawClass* class_class_;  // Class of the Class vm object. |   388   static RawClass* class_class_;  // Class of the Class vm object. | 
|   389   static RawClass* null_class_;  // Class of the null object. |   389   static RawClass* null_class_;  // Class of the null object. | 
|   390   static RawClass* dynamic_class_;  // Class of the 'Dynamic' type. |   390   static RawClass* dynamic_class_;  // Class of the 'dynamic' type. | 
|   391   static RawClass* void_class_;  // Class of the 'void' type. |   391   static RawClass* void_class_;  // Class of the 'void' type. | 
|   392   static RawClass* unresolved_class_class_;  // Class of UnresolvedClass. |   392   static RawClass* unresolved_class_class_;  // Class of UnresolvedClass. | 
|   393   // Class of the TypeArguments vm object. |   393   // Class of the TypeArguments vm object. | 
|   394   static RawClass* type_arguments_class_; |   394   static RawClass* type_arguments_class_; | 
|   395   static RawClass* instantiated_type_arguments_class_;  // Class of Inst..ments. |   395   static RawClass* instantiated_type_arguments_class_;  // Class of Inst..ments. | 
|   396   static RawClass* patch_class_class_;  // Class of the PatchClass vm object. |   396   static RawClass* patch_class_class_;  // Class of the PatchClass vm object. | 
|   397   static RawClass* function_class_;  // Class of the Function vm object. |   397   static RawClass* function_class_;  // Class of the Function vm object. | 
|   398   static RawClass* closure_data_class_;  // Class of ClosureData vm obj. |   398   static RawClass* closure_data_class_;  // Class of ClosureData vm obj. | 
|   399   static RawClass* redirection_data_class_;  // Class of RedirectionData vm obj. |   399   static RawClass* redirection_data_class_;  // Class of RedirectionData vm obj. | 
|   400   static RawClass* field_class_;  // Class of the Field vm object. |   400   static RawClass* field_class_;  // Class of the Field vm object. | 
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   568   // Returns the list of classes having this class as direct superclass. |   568   // Returns the list of classes having this class as direct superclass. | 
|   569   RawGrowableObjectArray* direct_subclasses() const { |   569   RawGrowableObjectArray* direct_subclasses() const { | 
|   570     return raw_ptr()->direct_subclasses_; |   570     return raw_ptr()->direct_subclasses_; | 
|   571   } |   571   } | 
|   572   void AddDirectSubclass(const Class& subclass) const; |   572   void AddDirectSubclass(const Class& subclass) const; | 
|   573   // TODO(regis): Implement RemoveDirectSubclass for class unloading support. |   573   // TODO(regis): Implement RemoveDirectSubclass for class unloading support. | 
|   574  |   574  | 
|   575   // Check if this class represents the class of null. |   575   // Check if this class represents the class of null. | 
|   576   bool IsNullClass() const { return id() == kNullCid; } |   576   bool IsNullClass() const { return id() == kNullCid; } | 
|   577  |   577  | 
|   578   // Check if this class represents the 'Dynamic' class. |   578   // Check if this class represents the 'dynamic' class. | 
|   579   bool IsDynamicClass() const { return id() == kDynamicCid; } |   579   bool IsDynamicClass() const { return id() == kDynamicCid; } | 
|   580  |   580  | 
|   581   // Check if this class represents the 'void' class. |   581   // Check if this class represents the 'void' class. | 
|   582   bool IsVoidClass() const { return id() == kVoidCid; } |   582   bool IsVoidClass() const { return id() == kVoidCid; } | 
|   583  |   583  | 
|   584   // Check if this class represents the 'Object' class. |   584   // Check if this class represents the 'Object' class. | 
|   585   bool IsObjectClass() const { return id() == kInstanceCid; } |   585   bool IsObjectClass() const { return id() == kInstanceCid; } | 
|   586  |   586  | 
|   587   // Check if this class represents a signature class. |   587   // Check if this class represents a signature class. | 
|   588   bool IsSignatureClass() const { |   588   bool IsSignatureClass() const { | 
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   839   // Return 'this' if this type argument vector is instantiated, i.e. if it does |   839   // Return 'this' if this type argument vector is instantiated, i.e. if it does | 
|   840   // not refer to type parameters. Otherwise, return a new type argument vector |   840   // not refer to type parameters. Otherwise, return a new type argument vector | 
|   841   // where each reference to a type parameter is replaced with the corresponding |   841   // where each reference to a type parameter is replaced with the corresponding | 
|   842   // type of the instantiator type argument vector. |   842   // type of the instantiator type argument vector. | 
|   843   virtual RawAbstractTypeArguments* InstantiateFrom( |   843   virtual RawAbstractTypeArguments* InstantiateFrom( | 
|   844       const AbstractTypeArguments& instantiator_type_arguments) const; |   844       const AbstractTypeArguments& instantiator_type_arguments) const; | 
|   845  |   845  | 
|   846   // Do not canonicalize InstantiatedTypeArguments or NULL objects |   846   // Do not canonicalize InstantiatedTypeArguments or NULL objects | 
|   847   virtual RawAbstractTypeArguments* Canonicalize() const { return this->raw(); } |   847   virtual RawAbstractTypeArguments* Canonicalize() const { return this->raw(); } | 
|   848  |   848  | 
|   849   // The name of this type argument vector, e.g. "<T, Dynamic, List<T>, Smi>". |   849   // The name of this type argument vector, e.g. "<T, dynamic, List<T>, Smi>". | 
|   850   virtual RawString* Name() const { |   850   virtual RawString* Name() const { | 
|   851     return SubvectorName(0, Length(), kInternalName); |   851     return SubvectorName(0, Length(), kInternalName); | 
|   852   } |   852   } | 
|   853  |   853  | 
|   854   // The name of this type argument vector, e.g. "<T, Dynamic, List<T>, int>". |   854   // The name of this type argument vector, e.g. "<T, dynamic, List<T>, int>". | 
|   855   // Names of internal classes are mapped to their public interfaces. |   855   // Names of internal classes are mapped to their public interfaces. | 
|   856   virtual RawString* UserVisibleName() const { |   856   virtual RawString* UserVisibleName() const { | 
|   857     return SubvectorName(0, Length(), kUserVisibleName); |   857     return SubvectorName(0, Length(), kUserVisibleName); | 
|   858   } |   858   } | 
|   859  |   859  | 
|   860   // Check if this type argument vector consists solely of DynamicType, |   860   // Check if this type argument vector consists solely of DynamicType, | 
|   861   // considering only a prefix of length 'len'. |   861   // considering only a prefix of length 'len'. | 
|   862   bool IsRaw(intptr_t len) const { |   862   bool IsRaw(intptr_t len) const { | 
|   863     return IsDynamicTypes(false, len); |   863     return IsDynamicTypes(false, len); | 
|   864   } |   864   } | 
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   910   bool IsDynamicTypes(bool raw_instantiated, intptr_t len) const; |   910   bool IsDynamicTypes(bool raw_instantiated, intptr_t len) const; | 
|   911  |   911  | 
|   912   // Check the subtype or 'more specific' relationship, considering only a |   912   // Check the subtype or 'more specific' relationship, considering only a | 
|   913   // prefix of length 'len'. |   913   // prefix of length 'len'. | 
|   914   bool TypeTest(TypeTestKind test_kind, |   914   bool TypeTest(TypeTestKind test_kind, | 
|   915                 const AbstractTypeArguments& other, |   915                 const AbstractTypeArguments& other, | 
|   916                 intptr_t len, |   916                 intptr_t len, | 
|   917                 Error* malformed_error) const; |   917                 Error* malformed_error) const; | 
|   918  |   918  | 
|   919   // Return the internal or public name of a subvector of this type argument |   919   // Return the internal or public name of a subvector of this type argument | 
|   920   // vector, e.g. "<T, Dynamic, List<T>, int>". |   920   // vector, e.g. "<T, dynamic, List<T>, int>". | 
|   921   RawString* SubvectorName(intptr_t from_index, |   921   RawString* SubvectorName(intptr_t from_index, | 
|   922                            intptr_t len, |   922                            intptr_t len, | 
|   923                            NameVisibility name_visibility) const; |   923                            NameVisibility name_visibility) const; | 
|   924  |   924  | 
|   925  protected: |   925  protected: | 
|   926   HEAP_OBJECT_IMPLEMENTATION(AbstractTypeArguments, Object); |   926   HEAP_OBJECT_IMPLEMENTATION(AbstractTypeArguments, Object); | 
|   927   friend class AbstractType; |   927   friend class AbstractType; | 
|   928   friend class Class; |   928   friend class Class; | 
|   929 }; |   929 }; | 
|   930  |   930  | 
| (...skipping 2151 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3082   // The name of this type, including the names of its type arguments, if any. |  3082   // The name of this type, including the names of its type arguments, if any. | 
|  3083   // Names of internal classes are mapped to their public interfaces. |  3083   // Names of internal classes are mapped to their public interfaces. | 
|  3084   virtual RawString* UserVisibleName() const { |  3084   virtual RawString* UserVisibleName() const { | 
|  3085     return BuildName(kUserVisibleName); |  3085     return BuildName(kUserVisibleName); | 
|  3086   } |  3086   } | 
|  3087  |  3087  | 
|  3088   // The name of this type's class, i.e. without the type argument names of this |  3088   // The name of this type's class, i.e. without the type argument names of this | 
|  3089   // type. |  3089   // type. | 
|  3090   RawString* ClassName() const; |  3090   RawString* ClassName() const; | 
|  3091  |  3091  | 
|  3092   // Check if this type represents the 'Dynamic' type. |  3092   // Check if this type represents the 'dynamic' type. | 
|  3093   bool IsDynamicType() const { |  3093   bool IsDynamicType() const { | 
|  3094     return HasResolvedTypeClass() && (type_class() == Object::dynamic_class()); |  3094     return HasResolvedTypeClass() && (type_class() == Object::dynamic_class()); | 
|  3095   } |  3095   } | 
|  3096  |  3096  | 
|  3097   // Check if this type represents the 'Null' type. |  3097   // Check if this type represents the 'Null' type. | 
|  3098   bool IsNullType() const { |  3098   bool IsNullType() const { | 
|  3099     return HasResolvedTypeClass() && (type_class() == Object::null_class()); |  3099     return HasResolvedTypeClass() && (type_class() == Object::null_class()); | 
|  3100   } |  3100   } | 
|  3101  |  3101  | 
|  3102   // Check if this type represents the 'void' type. |  3102   // Check if this type represents the 'void' type. | 
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3211       const AbstractTypeArguments& instantiator_type_arguments) const; |  3211       const AbstractTypeArguments& instantiator_type_arguments) const; | 
|  3212   virtual RawAbstractType* Canonicalize() const; |  3212   virtual RawAbstractType* Canonicalize() const; | 
|  3213  |  3213  | 
|  3214   static intptr_t InstanceSize() { |  3214   static intptr_t InstanceSize() { | 
|  3215     return RoundedAllocationSize(sizeof(RawType)); |  3215     return RoundedAllocationSize(sizeof(RawType)); | 
|  3216   } |  3216   } | 
|  3217  |  3217  | 
|  3218   // The type of the literal 'null'. |  3218   // The type of the literal 'null'. | 
|  3219   static RawType* NullType(); |  3219   static RawType* NullType(); | 
|  3220  |  3220  | 
|  3221   // The 'Dynamic' type. |  3221   // The 'dynamic' type. | 
|  3222   static RawType* DynamicType(); |  3222   static RawType* DynamicType(); | 
|  3223  |  3223  | 
|  3224   // The 'void' type. |  3224   // The 'void' type. | 
|  3225   static RawType* VoidType(); |  3225   static RawType* VoidType(); | 
|  3226  |  3226  | 
|  3227   // The 'Object' type. |  3227   // The 'Object' type. | 
|  3228   static RawType* ObjectType(); |  3228   static RawType* ObjectType(); | 
|  3229  |  3229  | 
|  3230   // The 'bool' type. |  3230   // The 'bool' type. | 
|  3231   static RawType* BoolType(); |  3231   static RawType* BoolType(); | 
| (...skipping 2540 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  5772     if (this->CharAt(i) != str.CharAt(begin_index + i)) { |  5772     if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 
|  5773       return false; |  5773       return false; | 
|  5774     } |  5774     } | 
|  5775   } |  5775   } | 
|  5776   return true; |  5776   return true; | 
|  5777 } |  5777 } | 
|  5778  |  5778  | 
|  5779 }  // namespace dart |  5779 }  // namespace dart | 
|  5780  |  5780  | 
|  5781 #endif  // VM_OBJECT_H_ |  5781 #endif  // VM_OBJECT_H_ | 
| OLD | NEW |