OLD | NEW |
1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Fletch 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library fletchc.fletch_enqueuer; | 5 library fletchc.fletch_enqueuer; |
6 | 6 |
7 import 'dart:collection' show | 7 import 'dart:collection' show |
8 Queue; | 8 Queue; |
9 | 9 |
10 import 'package:compiler/src/common/tasks.dart' show | 10 import 'package:compiler/src/common/tasks.dart' show |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 import 'dynamic_call_enqueuer.dart' show | 62 import 'dynamic_call_enqueuer.dart' show |
63 Closurization, | 63 Closurization, |
64 DynamicCallEnqueuer, | 64 DynamicCallEnqueuer, |
65 UsageRecorder; | 65 UsageRecorder; |
66 | 66 |
67 import 'fletch_registry.dart' show | 67 import 'fletch_registry.dart' show |
68 ClosureKind, | 68 ClosureKind, |
69 FletchRegistry, | 69 FletchRegistry, |
70 FletchRegistry; | 70 FletchRegistry; |
71 | 71 |
72 import 'dart:developer'; | 72 import 'package:compiler/src/enqueue.dart' show |
73 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; | 73 EnqueuerStrategy, |
| 74 ItemCompilationContextCreator; |
74 | 75 |
75 import 'package:compiler/src/universe/use.dart' show | 76 import 'enqueuer_mixin.dart' show |
76 DynamicUse, | 77 EnqueuerMixin; |
77 StaticUse; | |
78 | |
79 import 'package:compiler/src/universe/use.dart'; | |
80 import 'package:compiler/src/common/work.dart'; | |
81 import 'package:compiler/src/common/resolution.dart'; | |
82 import 'package:compiler/src/enqueue.dart'; | |
83 | |
84 part 'enqueuer_mixin.dart'; | |
85 | 78 |
86 /// True if enqueuing of system libraries should be reported in verbose mode. | 79 /// True if enqueuing of system libraries should be reported in verbose mode. |
87 const bool logSystemLibraries = | 80 const bool logSystemLibraries = |
88 const bool.fromEnvironment("fletchc.logSystemLibraries"); | 81 const bool.fromEnvironment("fletchc.logSystemLibraries"); |
89 | 82 |
90 /// Returns true if enqueuing of [element] should be reported in verbose | 83 /// Returns true if enqueuing of [element] should be reported in verbose |
91 /// mode. See [logSystemLibraries]. | 84 /// mode. See [logSystemLibraries]. |
92 bool shouldReportEnqueuingOfElement(Compiler compiler, Element element) { | 85 bool shouldReportEnqueuingOfElement(Compiler compiler, Element element) { |
93 if (logSystemLibraries) return true; | 86 if (logSystemLibraries) return true; |
94 return compiler.inUserCode(element); | 87 return compiler.inUserCode(element); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 dynamicCallEnqueuer.forgetElement(element); | 171 dynamicCallEnqueuer.forgetElement(element); |
179 } | 172 } |
180 | 173 |
181 void registerInstantiatedType( | 174 void registerInstantiatedType( |
182 InterfaceType type, | 175 InterfaceType type, |
183 {bool mirrorUsage: false}) { | 176 {bool mirrorUsage: false}) { |
184 dynamicCallEnqueuer.registerInstantiatedType(type); | 177 dynamicCallEnqueuer.registerInstantiatedType(type); |
185 } | 178 } |
186 | 179 |
187 // TODO(ahe): Remove this method. | 180 // TODO(ahe): Remove this method. |
188 void registerStaticUse(StaticUse staticUse) { | 181 void registerStaticInvocation(FunctionElement function) { |
189 _enqueueElement(staticUse.element, null, null); | 182 _enqueueElement(function, null, null); |
190 } | 183 } |
191 | 184 |
192 // TODO(ahe): Remove this method. | 185 // TODO(ahe): Remove this method. |
193 void addToWorkList(Element element) { | 186 void addToWorkList(Element element) { |
194 _enqueueElement(element, null, null); | 187 _enqueueElement(element, null, null); |
195 } | 188 } |
196 | 189 |
197 // TODO(ahe): Remove this method. | 190 // TODO(ahe): Remove this method. |
198 void forEach(_) { | 191 void forEach(_) { |
199 processQueue(); | 192 processQueue(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 227 |
235 bool checkNoEnqueuedInvokedInstanceMethods() { | 228 bool checkNoEnqueuedInvokedInstanceMethods() { |
236 // TODO(ahe): Implement | 229 // TODO(ahe): Implement |
237 return true; | 230 return true; |
238 } | 231 } |
239 | 232 |
240 void logSummary(log(message)) { | 233 void logSummary(log(message)) { |
241 // TODO(ahe): Implement this. | 234 // TODO(ahe): Implement this. |
242 } | 235 } |
243 | 236 |
244 void registerDynamicUse(DynamicUse use) { | 237 void registerDynamicSelector(Selector selector) { |
245 dynamicCallEnqueuer.enqueueSelector(use); | 238 dynamicCallEnqueuer.enqueueSelector(selector); |
246 } | 239 } |
247 | 240 |
248 void applyImpact(Element element, WorldImpact worldImpact) { | 241 void applyImpact(Element element, WorldImpact worldImpact) { |
249 assert(worldImpact == null); | 242 assert(worldImpact == null); |
250 } | 243 } |
251 | 244 |
252 void registerIsCheck(DartType type) { | 245 void registerIsCheck(DartType type) { |
253 dynamicCallEnqueuer.enqueueTypeTest(type); | 246 dynamicCallEnqueuer.enqueueTypeTest(type); |
254 } | 247 } |
255 | 248 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 324 |
332 TypeTest(ClassElement element, InterfaceType type) | 325 TypeTest(ClassElement element, InterfaceType type) |
333 : element = element, | 326 : element = element, |
334 type = type, | 327 type = type, |
335 hashCode = Hashing.mixHashCodeBits(element.hashCode, type.hashCode); | 328 hashCode = Hashing.mixHashCodeBits(element.hashCode, type.hashCode); |
336 | 329 |
337 bool operator ==(other) { | 330 bool operator ==(other) { |
338 return other is TypeTest && element == other.element && type == other.type; | 331 return other is TypeTest && element == other.element && type == other.type; |
339 } | 332 } |
340 } | 333 } |
OLD | NEW |