| 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_CHA_H_ | 5 #ifndef VM_CHA_H_ |
| 6 #define VM_CHA_H_ | 6 #define VM_CHA_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 class Class; | 12 class Class; |
| 13 class Function; | 13 class Function; |
| 14 template <typename T> class ZoneGrowableArray; | 14 template <typename T> class ZoneGrowableArray; |
| 15 class String; | 15 class String; |
| 16 | 16 |
| 17 class CHA : public AllStatic { | 17 class CHA : public AllStatic { |
| 18 public: | 18 public: |
| 19 // Returns true if the class given by its cid has subclasses. | 19 // Returns true if the class given by its cid has subclasses. |
| 20 static bool HasSubclasses(intptr_t cid); | 20 static bool HasSubclasses(intptr_t cid); |
| 21 | 21 |
| 22 // Use only on known private classes that can never be subclassed by lazy |
| 23 // class finalization. Does not affect Isolate::use_cha flag. |
| 24 static bool HasSubclassesSafe(intptr_t cid); |
| 25 |
| 22 // Returns an array containing the cids of the direct and indirect subclasses | 26 // Returns an array containing the cids of the direct and indirect subclasses |
| 23 // of the class given by its cid. | 27 // of the class given by its cid. |
| 24 // Must not be called for kInstanceCid. | 28 // Must not be called for kInstanceCid. |
| 25 static ZoneGrowableArray<intptr_t>* GetSubclassIdsOf(intptr_t cid); | 29 static ZoneGrowableArray<intptr_t>* GetSubclassIdsOf(intptr_t cid); |
| 26 | 30 |
| 27 // Returns an array containing instance functions of the given name and | 31 // Returns an array containing instance functions of the given name and |
| 28 // belonging to the classes given by their cids. | 32 // belonging to the classes given by their cids. |
| 29 // Cids must not contain kInstanceCid. | 33 // Cids must not contain kInstanceCid. |
| 30 static ZoneGrowableArray<Function*>* GetNamedInstanceFunctionsOf( | 34 static ZoneGrowableArray<Function*>* GetNamedInstanceFunctionsOf( |
| 31 const ZoneGrowableArray<intptr_t>& cids, | 35 const ZoneGrowableArray<intptr_t>& cids, |
| 32 const String& function_name); | 36 const String& function_name); |
| 33 | 37 |
| 34 // Returns an array of functions overriding the given function. | 38 // Returns an array of functions overriding the given function. |
| 35 // Must not be called for a function of class Object. | 39 // Must not be called for a function of class Object. |
| 36 static ZoneGrowableArray<Function*>* GetOverridesOf(const Function& function); | 40 static ZoneGrowableArray<Function*>* GetOverridesOf(const Function& function); |
| 37 | 41 |
| 38 // Returns true if any subclass of 'cls' contains the function. | 42 // Returns true if any subclass of 'cls' contains the function. |
| 39 static bool HasOverride(const Class& cls, const String& function_name); | 43 static bool HasOverride(const Class& cls, const String& function_name); |
| 40 }; | 44 }; |
| 41 | 45 |
| 42 } // namespace dart | 46 } // namespace dart |
| 43 | 47 |
| 44 #endif // VM_CHA_H_ | 48 #endif // VM_CHA_H_ |
| OLD | NEW |