| 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 library dart2js.enqueue; | 5 library dart2js.enqueue; |
| 6 | 6 |
| 7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
| 8 | 8 |
| 9 import 'cache_strategy.dart'; | 9 import 'cache_strategy.dart'; |
| 10 import 'common/backend_api.dart' show Backend; | 10 import 'common/backend_api.dart' show Backend; |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 _universe.closuresWithFreeTypeVariables.add(element); | 538 _universe.closuresWithFreeTypeVariables.add(element); |
| 539 } | 539 } |
| 540 applyImpact(backend.registerBoundClosure()); | 540 applyImpact(backend.registerBoundClosure()); |
| 541 _universe.closurizedMembers.add(element); | 541 _universe.closurizedMembers.add(element); |
| 542 } | 542 } |
| 543 | 543 |
| 544 void forEach(void f(WorkItem work)) { | 544 void forEach(void f(WorkItem work)) { |
| 545 do { | 545 do { |
| 546 while (queue.isNotEmpty) { | 546 while (queue.isNotEmpty) { |
| 547 // TODO(johnniwinther): Find an optimal process order. | 547 // TODO(johnniwinther): Find an optimal process order. |
| 548 strategy.processWorkItem(f, queue.removeLast()); | 548 WorkItem work = queue.removeLast(); |
| 549 if (!isProcessed(work.element)) { |
| 550 strategy.processWorkItem(f, work); |
| 551 registerProcessedElement(work.element); |
| 552 } |
| 549 } | 553 } |
| 550 List recents = recentClasses.toList(growable: false); | 554 List recents = recentClasses.toList(growable: false); |
| 551 recentClasses.clear(); | 555 recentClasses.clear(); |
| 552 if (!onQueueEmpty(recents)) recentClasses.addAll(recents); | 556 if (!onQueueEmpty(recents)) recentClasses.addAll(recents); |
| 553 } while (queue.isNotEmpty || recentClasses.isNotEmpty); | 557 } while (queue.isNotEmpty || recentClasses.isNotEmpty); |
| 554 } | 558 } |
| 555 | 559 |
| 556 void logSummary(log(message)) { | 560 void logSummary(log(message)) { |
| 557 log('Resolved ${processedElements.length} elements.'); | 561 log('Resolved ${processedElements.length} elements.'); |
| 558 nativeEnqueuer.logSummary(log); | 562 nativeEnqueuer.logSummary(log); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 } | 807 } |
| 804 | 808 |
| 805 typedef void _DeferredActionFunction(); | 809 typedef void _DeferredActionFunction(); |
| 806 | 810 |
| 807 class _DeferredAction { | 811 class _DeferredAction { |
| 808 final Element element; | 812 final Element element; |
| 809 final _DeferredActionFunction action; | 813 final _DeferredActionFunction action; |
| 810 | 814 |
| 811 _DeferredAction(this.element, this.action); | 815 _DeferredAction(this.element, this.action); |
| 812 } | 816 } |
| OLD | NEW |