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 class EnqueueTask extends CompilerTask { | 5 class EnqueueTask extends CompilerTask { |
6 final Enqueuer codegen; | 6 final Enqueuer codegen; |
7 final Enqueuer resolution; | 7 final Enqueuer resolution; |
8 | 8 |
9 String get name => 'Enqueue'; | 9 String get name => 'Enqueue'; |
10 | 10 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } | 202 } |
203 } | 203 } |
204 | 204 |
205 void onRegisterInstantiatedClass(ClassElement cls) { | 205 void onRegisterInstantiatedClass(ClassElement cls) { |
206 task.measure(() { | 206 task.measure(() { |
207 // The class must be resolved to compute the set of all | 207 // The class must be resolved to compute the set of all |
208 // supertypes. | 208 // supertypes. |
209 cls.ensureResolved(compiler); | 209 cls.ensureResolved(compiler); |
210 | 210 |
211 for (Link<DartType> supertypes = cls.allSupertypesAndSelf; | 211 for (Link<DartType> supertypes = cls.allSupertypesAndSelf; |
212 !supertypes.isEmpty(); supertypes = supertypes.tail) { | 212 !supertypes.isEmpty; supertypes = supertypes.tail) { |
213 cls = supertypes.head.element; | 213 cls = supertypes.head.element; |
214 if (seenClasses.contains(cls)) continue; | 214 if (seenClasses.contains(cls)) continue; |
215 seenClasses.add(cls); | 215 seenClasses.add(cls); |
216 cls.ensureResolved(compiler); | 216 cls.ensureResolved(compiler); |
217 if (!cls.isInterface()) { | 217 if (!cls.isInterface()) { |
218 cls.implementation.forEachMember(processInstantiatedClassMember); | 218 cls.implementation.forEachMember(processInstantiatedClassMember); |
219 } | 219 } |
220 if (isResolutionQueue) { | 220 if (isResolutionQueue) { |
221 compiler.resolver.checkMembers(cls); | 221 compiler.resolver.checkMembers(cls); |
222 } | 222 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 task.measure(() { | 271 task.measure(() { |
272 registerNewSelector(setterName, selector, universe.invokedSetters); | 272 registerNewSelector(setterName, selector, universe.invokedSetters); |
273 }); | 273 }); |
274 } | 274 } |
275 | 275 |
276 processInstanceMembers(SourceString n, bool f(Element e)) { | 276 processInstanceMembers(SourceString n, bool f(Element e)) { |
277 String memberName = n.slowToString(); | 277 String memberName = n.slowToString(); |
278 Link<Element> members = instanceMembersByName[memberName]; | 278 Link<Element> members = instanceMembersByName[memberName]; |
279 if (members != null) { | 279 if (members != null) { |
280 LinkBuilder<Element> remaining = new LinkBuilder<Element>(); | 280 LinkBuilder<Element> remaining = new LinkBuilder<Element>(); |
281 for (; !members.isEmpty(); members = members.tail) { | 281 for (; !members.isEmpty; members = members.tail) { |
282 if (!f(members.head)) remaining.addLast(members.head); | 282 if (!f(members.head)) remaining.addLast(members.head); |
283 } | 283 } |
284 instanceMembersByName[memberName] = remaining.toLink(); | 284 instanceMembersByName[memberName] = remaining.toLink(); |
285 } | 285 } |
286 } | 286 } |
287 | 287 |
288 void handleUnseenSelector(SourceString methodName, Selector selector) { | 288 void handleUnseenSelector(SourceString methodName, Selector selector) { |
289 processInstanceMembers(methodName, (Element member) { | 289 processInstanceMembers(methodName, (Element member) { |
290 if (selector.applies(member, compiler)) { | 290 if (selector.applies(member, compiler)) { |
291 addToWorkList(member); | 291 addToWorkList(member); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 new TypedSelector(type, setter), | 348 new TypedSelector(type, setter), |
349 universe.fieldSetters); | 349 universe.fieldSetters); |
350 }); | 350 }); |
351 } | 351 } |
352 | 352 |
353 void registerIsCheck(DartType type) { | 353 void registerIsCheck(DartType type) { |
354 universe.isChecks.add(type); | 354 universe.isChecks.add(type); |
355 } | 355 } |
356 | 356 |
357 void forEach(f(WorkItem work)) { | 357 void forEach(f(WorkItem work)) { |
358 while (!queue.isEmpty()) { | 358 while (!queue.isEmpty) { |
359 f(queue.removeLast()); // TODO(kasperl): Why isn't this removeFirst? | 359 f(queue.removeLast()); // TODO(kasperl): Why isn't this removeFirst? |
360 } | 360 } |
361 } | 361 } |
362 | 362 |
363 String toString() => 'Enqueuer($name)'; | 363 String toString() => 'Enqueuer($name)'; |
364 | 364 |
365 registerUsedSelector(Selector selector) { | 365 registerUsedSelector(Selector selector) { |
366 Element interceptor = compiler.backend.getInterceptor(selector); | 366 Element interceptor = compiler.backend.getInterceptor(selector); |
367 if (interceptor != null) { | 367 if (interceptor != null) { |
368 registerStaticUse(interceptor); | 368 registerStaticUse(interceptor); |
369 } | 369 } |
370 } | 370 } |
371 } | 371 } |
OLD | NEW |