Chromium Code Reviews| 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 #include "vm/class_table.h" | 5 #include "vm/class_table.h" |
| 6 #include "vm/flags.h" | 6 #include "vm/flags.h" |
| 7 #include "vm/freelist.h" | 7 #include "vm/freelist.h" |
| 8 #include "vm/object.h" | 8 #include "vm/object.h" |
| 9 #include "vm/raw_object.h" | 9 #include "vm/raw_object.h" |
| 10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 for (intptr_t i = 1; i < top_; i++) { | 90 for (intptr_t i = 1; i < top_; i++) { |
| 91 cls = At(i); | 91 cls = At(i); |
| 92 if (cls.raw() != reinterpret_cast<RawClass*>(0)) { | 92 if (cls.raw() != reinterpret_cast<RawClass*>(0)) { |
| 93 name = cls.Name(); | 93 name = cls.Name(); |
| 94 OS::Print("%d: %s\n", i, name.ToCString()); | 94 OS::Print("%d: %s\n", i, name.ToCString()); |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 | 99 |
| 100 bool ClassTable::HasSubclasses(intptr_t cid) const { | |
|
Ivan Posva
2012/08/21 03:01:27
This API has nothing to do with ClassTable, please
| |
| 101 const Class& cls = Class::Handle(At(cid)); | |
| 102 ASSERT(!cls.IsNull()); | |
| 103 // TODO(regis): Replace assert below with ASSERT(cid > kDartObjectCid). | |
| 104 ASSERT(!cls.IsObjectClass()); | |
| 105 const GrowableObjectArray& cls_direct_subclasses = | |
| 106 GrowableObjectArray::Handle(cls.direct_subclasses()); | |
| 107 return | |
| 108 !cls_direct_subclasses.IsNull() && (cls_direct_subclasses.Length() > 0); | |
| 109 } | |
| 110 | |
| 111 | |
| 100 // Returns true if the given array of cids contains the given cid. | 112 // Returns true if the given array of cids contains the given cid. |
| 101 static bool ContainsCid(ZoneGrowableArray<intptr_t>* cids, intptr_t cid) { | 113 static bool ContainsCid(ZoneGrowableArray<intptr_t>* cids, intptr_t cid) { |
| 102 for (intptr_t i = 0; i < cids->length(); i++) { | 114 for (intptr_t i = 0; i < cids->length(); i++) { |
| 103 if ((*cids)[i] == cid) { | 115 if ((*cids)[i] == cid) { |
| 104 return true; | 116 return true; |
| 105 } | 117 } |
| 106 } | 118 } |
| 107 return false; | 119 return false; |
| 108 } | 120 } |
| 109 | 121 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 ASSERT(!function.IsNull()); | 177 ASSERT(!function.IsNull()); |
| 166 ASSERT(function.IsDynamicFunction()); | 178 ASSERT(function.IsDynamicFunction()); |
| 167 const Class& function_owner = Class::Handle(function.Owner()); | 179 const Class& function_owner = Class::Handle(function.Owner()); |
| 168 const String& function_name = String::Handle(function.name()); | 180 const String& function_name = String::Handle(function.name()); |
| 169 ZoneGrowableArray<intptr_t>* cids = new ZoneGrowableArray<intptr_t>(); | 181 ZoneGrowableArray<intptr_t>* cids = new ZoneGrowableArray<intptr_t>(); |
| 170 CollectSubclassIds(cids, function_owner); | 182 CollectSubclassIds(cids, function_owner); |
| 171 return GetNamedInstanceFunctionsOf(*cids, function_name); | 183 return GetNamedInstanceFunctionsOf(*cids, function_name); |
| 172 } | 184 } |
| 173 | 185 |
| 174 } // namespace dart | 186 } // namespace dart |
| OLD | NEW |