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

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

Issue 1410733006: More general CHA-based inlining and devirtualization for precompiled code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comments, fixed type propagation assertion failure Created 5 years, 2 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 | « no previous file | runtime/vm/flow_graph_compiler.cc » ('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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // read-only. 55 // read-only.
56 // TODO(fschneider): Enable tracking of CHA dependent code for VM heap 56 // TODO(fschneider): Enable tracking of CHA dependent code for VM heap
57 // classes. 57 // classes.
58 if (cls.InVMHeap()) return true; 58 if (cls.InVMHeap()) return true;
59 59
60 return cls.is_implemented(); 60 return cls.is_implemented();
61 } 61 }
62 62
63 63
64 bool CHA::HasOverride(const Class& cls, const String& function_name) { 64 bool CHA::HasOverride(const Class& cls, const String& function_name) {
65 const GrowableObjectArray& cls_direct_subclasses = 65 // Can't track dependencies for classes on the VM heap since those are
66 GrowableObjectArray::Handle(thread_->zone(), cls.direct_subclasses()); 66 // read-only.
67 // TODO(fschneider): Enable tracking of CHA dependent code for VM heap
68 // classes.
69 if (cls.InVMHeap()) return true;
70
67 // Subclasses of Object are not tracked by CHA. Safely assume that overrides 71 // Subclasses of Object are not tracked by CHA. Safely assume that overrides
68 // exist. 72 // exist.
69 if (cls.IsObjectClass()) { 73 if (cls.IsObjectClass()) {
70 return true; 74 return true;
71 } 75 }
72 76
77 const GrowableObjectArray& cls_direct_subclasses =
78 GrowableObjectArray::Handle(thread_->zone(), cls.direct_subclasses());
73 if (cls_direct_subclasses.IsNull()) { 79 if (cls_direct_subclasses.IsNull()) {
74 return false; 80 return false;
75 } 81 }
76 Class& direct_subclass = Class::Handle(thread_->zone()); 82 Class& direct_subclass = Class::Handle(thread_->zone());
77 for (intptr_t i = 0; i < cls_direct_subclasses.Length(); i++) { 83 for (intptr_t i = 0; i < cls_direct_subclasses.Length(); i++) {
78 direct_subclass ^= cls_direct_subclasses.At(i); 84 direct_subclass ^= cls_direct_subclasses.At(i);
79 // Unfinalized classes are treated as non-existent for CHA purposes, 85 // Unfinalized classes are treated as non-existent for CHA purposes,
80 // as that means that no instance of that class exists at runtime. 86 // as that means that no instance of that class exists at runtime.
81 if (direct_subclass.is_finalized() && 87 if (direct_subclass.is_finalized() &&
82 (direct_subclass.LookupDynamicFunction(function_name) != 88 (direct_subclass.LookupDynamicFunction(function_name) !=
83 Function::null())) { 89 Function::null())) {
84 return true; 90 return true;
85 } 91 }
86 if (HasOverride(direct_subclass, function_name)) { 92 if (HasOverride(direct_subclass, function_name)) {
87 return true; 93 return true;
88 } 94 }
89 } 95 }
90 return false; 96 return false;
91 } 97 }
92 98
93 } // namespace dart 99 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698