| 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/cha.h" | 5 #include "vm/cha.h" |
| 6 #include "vm/class_table.h" | 6 #include "vm/class_table.h" |
| 7 #include "vm/flags.h" | 7 #include "vm/flags.h" |
| 8 #include "vm/freelist.h" | 8 #include "vm/freelist.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/raw_object.h" | 10 #include "vm/raw_object.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // Subclasses of Object are not tracked by CHA. Safely assume that overrides | 76 // Subclasses of Object are not tracked by CHA. Safely assume that overrides |
| 77 // exist. | 77 // exist. |
| 78 if (cls.IsObjectClass()) return true; | 78 if (cls.IsObjectClass()) return true; |
| 79 | 79 |
| 80 if (cls_direct_subclasses.IsNull()) { | 80 if (cls_direct_subclasses.IsNull()) { |
| 81 return false; | 81 return false; |
| 82 } | 82 } |
| 83 Class& direct_subclass = Class::Handle(); | 83 Class& direct_subclass = Class::Handle(); |
| 84 for (intptr_t i = 0; i < cls_direct_subclasses.Length(); i++) { | 84 for (intptr_t i = 0; i < cls_direct_subclasses.Length(); i++) { |
| 85 direct_subclass ^= cls_direct_subclasses.At(i); | 85 direct_subclass ^= cls_direct_subclasses.At(i); |
| 86 if (direct_subclass.LookupDynamicFunction(function_name) != | 86 // Unfinalized classes are treated as non-existent for CHA purposes, |
| 87 Function::null()) { | 87 // as that means that no instance of that class exists at runtime. |
| 88 if (direct_subclass.is_finalized() && |
| 89 (direct_subclass.LookupDynamicFunction(function_name) != |
| 90 Function::null())) { |
| 88 return true; | 91 return true; |
| 89 } | 92 } |
| 90 if (HasOverride(direct_subclass, function_name)) { | 93 if (HasOverride(direct_subclass, function_name)) { |
| 91 return true; | 94 return true; |
| 92 } | 95 } |
| 93 } | 96 } |
| 94 return false; | 97 return false; |
| 95 } | 98 } |
| 96 | 99 |
| 97 | 100 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 120 ASSERT(!function.IsNull()); | 123 ASSERT(!function.IsNull()); |
| 121 ASSERT(function.IsDynamicFunction()); | 124 ASSERT(function.IsDynamicFunction()); |
| 122 const Class& function_owner = Class::Handle(function.Owner()); | 125 const Class& function_owner = Class::Handle(function.Owner()); |
| 123 const String& function_name = String::Handle(function.name()); | 126 const String& function_name = String::Handle(function.name()); |
| 124 ZoneGrowableArray<intptr_t>* cids = new ZoneGrowableArray<intptr_t>(); | 127 ZoneGrowableArray<intptr_t>* cids = new ZoneGrowableArray<intptr_t>(); |
| 125 CollectSubclassIds(cids, function_owner); | 128 CollectSubclassIds(cids, function_owner); |
| 126 return GetNamedInstanceFunctionsOf(*cids, function_name); | 129 return GetNamedInstanceFunctionsOf(*cids, function_name); |
| 127 } | 130 } |
| 128 | 131 |
| 129 } // namespace dart | 132 } // namespace dart |
| OLD | NEW |