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

Side by Side Diff: runtime/vm/cha.cc

Issue 1867913004: Specialize instance calls when the call receiver is the method receiver and the method class has a … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « runtime/vm/cha.h ('k') | runtime/vm/flow_graph.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 30 matching lines...) Expand all
41 } 41 }
42 42
43 43
44 bool CHA::HasSubclasses(intptr_t cid) const { 44 bool CHA::HasSubclasses(intptr_t cid) const {
45 const ClassTable& class_table = *thread_->isolate()->class_table(); 45 const ClassTable& class_table = *thread_->isolate()->class_table();
46 Class& cls = Class::Handle(thread_->zone(), class_table.At(cid)); 46 Class& cls = Class::Handle(thread_->zone(), class_table.At(cid));
47 return HasSubclasses(cls); 47 return HasSubclasses(cls);
48 } 48 }
49 49
50 50
51 bool CHA::ConcreteSubclasses(const Class& cls,
52 GrowableArray<intptr_t> *class_ids) {
53 if (cls.InVMHeap()) return false;
54 if (cls.IsObjectClass()) return false;
55
56 if (!cls.is_abstract()) {
57 class_ids->Add(cls.id());
58 }
59
60 const GrowableObjectArray& direct_subclasses =
61 GrowableObjectArray::Handle(cls.direct_subclasses());
62 if (direct_subclasses.IsNull()) {
63 return true;
64 }
65 Class& subclass = Class::Handle();
66 for (intptr_t i = 0; i < direct_subclasses.Length(); i++) {
67 subclass ^= direct_subclasses.At(i);
68 if (!ConcreteSubclasses(subclass, class_ids)) {
69 return false;
70 }
71 }
72 return true;
73 }
74
75
51 bool CHA::IsImplemented(const Class& cls) { 76 bool CHA::IsImplemented(const Class& cls) {
52 // Function type aliases have different type checking rules. 77 // Function type aliases have different type checking rules.
53 ASSERT(!cls.IsTypedefClass()); 78 ASSERT(!cls.IsTypedefClass());
54 // Can't track dependencies for classes on the VM heap since those are 79 // Can't track dependencies for classes on the VM heap since those are
55 // read-only. 80 // read-only.
56 // TODO(fschneider): Enable tracking of CHA dependent code for VM heap 81 // TODO(fschneider): Enable tracking of CHA dependent code for VM heap
57 // classes. 82 // classes.
58 if (cls.InVMHeap()) return true; 83 if (cls.InVMHeap()) return true;
59 84
60 return cls.is_implemented(); 85 return cls.is_implemented();
(...skipping 29 matching lines...) Expand all
90 return true; 115 return true;
91 } 116 }
92 if (HasOverride(direct_subclass, function_name)) { 117 if (HasOverride(direct_subclass, function_name)) {
93 return true; 118 return true;
94 } 119 }
95 } 120 }
96 return false; 121 return false;
97 } 122 }
98 123
99 } // namespace dart 124 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/cha.h ('k') | runtime/vm/flow_graph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698