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

Side by Side Diff: dart/lib/compiler/implementation/enqueue.dart

Issue 10876008: Remove most superfluous getter arguments from dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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 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
11 EnqueueTask(Compiler compiler) 11 EnqueueTask(Compiler compiler)
12 : codegen = new Enqueuer(compiler, 12 : codegen = new Enqueuer(compiler,
13 compiler.backend.createItemCompilationContext), 13 compiler.backend.createItemCompilationContext),
14 resolution = new Enqueuer(compiler, 14 resolution = new Enqueuer(compiler,
15 compiler.backend.createItemCompilationContext), 15 compiler.backend.createItemCompilationContext),
16 super(compiler) { 16 super(compiler) {
17 codegen.task = this; 17 codegen.task = this;
18 resolution.task = this; 18 resolution.task = this;
19 } 19 }
20 } 20 }
21 21
22 class RecompilationQueue { 22 class RecompilationQueue {
23 final Function itemCompilationContextCreator; 23 final Function itemCompilationContextCreator;
24 final Queue<WorkItem> queue; 24 final Queue<WorkItem> queue;
25 final Set<Element> queueElements; 25 final Set<Element> queueElements;
26 int processed = 0; 26 int processed = 0;
27 27
28 RecompilationQueue(ItemCompilationContext itemCompilationContextCreator()) 28 RecompilationQueue(ItemCompilationContext itemCompilationContextCreator())
29 : this.itemCompilationContextCreator = itemCompilationContextCreator, 29 : this.itemCompilationContextCreator = itemCompilationContextCreator,
30 queue = new Queue<WorkItem>(), 30 queue = new Queue<WorkItem>(),
31 queueElements = new Set<Element>(); 31 queueElements = new Set<Element>();
32 32
33 void add(Element element, TreeElements elements) { 33 void add(Element element, TreeElements elements) {
34 if (queueElements.contains(element)) return; 34 if (queueElements.contains(element)) return;
35 queueElements.add(element); 35 queueElements.add(element);
36 queue.add(new WorkItem(element, elements, itemCompilationContextCreator())); 36 queue.add(new WorkItem(element, elements, itemCompilationContextCreator()));
37 } 37 }
38 38
39 int get length() => queue.length; 39 int get length => queue.length;
40 40
41 bool isEmpty() => queue.isEmpty(); 41 bool isEmpty() => queue.isEmpty();
42 42
43 WorkItem next() { 43 WorkItem next() {
44 WorkItem item = queue.removeLast(); 44 WorkItem item = queue.removeLast();
45 queueElements.remove(item.element); 45 queueElements.remove(item.element);
46 processed++; 46 processed++;
47 return item; 47 return item;
48 } 48 }
49 } 49 }
(...skipping 15 matching lines...) Expand all
65 ItemCompilationContext itemCompilationContextCreator()) 65 ItemCompilationContext itemCompilationContextCreator())
66 : this.itemCompilationContextCreator = itemCompilationContextCreator, 66 : this.itemCompilationContextCreator = itemCompilationContextCreator,
67 instanceMembersByName = new Map<String, Link<Element>>(), 67 instanceMembersByName = new Map<String, Link<Element>>(),
68 seenClasses = new Set<ClassElement>(), 68 seenClasses = new Set<ClassElement>(),
69 universe = new Universe(), 69 universe = new Universe(),
70 queue = new Queue<WorkItem>(), 70 queue = new Queue<WorkItem>(),
71 resolvedElements = new Map<Element, TreeElements>(), 71 resolvedElements = new Map<Element, TreeElements>(),
72 recompilationCandidates = 72 recompilationCandidates =
73 new RecompilationQueue(itemCompilationContextCreator); 73 new RecompilationQueue(itemCompilationContextCreator);
74 74
75 bool get isResolutionQueue() => compiler.enqueuer.resolution === this; 75 bool get isResolutionQueue => compiler.enqueuer.resolution === this;
76 76
77 TreeElements getCachedElements(Element element) { 77 TreeElements getCachedElements(Element element) {
78 Element owner = element.getOutermostEnclosingMemberOrTopLevel(); 78 Element owner = element.getOutermostEnclosingMemberOrTopLevel();
79 return compiler.enqueuer.resolution.resolvedElements[owner]; 79 return compiler.enqueuer.resolution.resolvedElements[owner];
80 } 80 }
81 81
82 String lookupCode(Element element) => 82 String lookupCode(Element element) =>
83 universe.generatedCode[element].toString(); 83 universe.generatedCode[element].toString();
84 84
85 void addToWorkList(Element element, [TreeElements elements]) { 85 void addToWorkList(Element element, [TreeElements elements]) {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 void registerIsCheck(Element element) { 329 void registerIsCheck(Element element) {
330 universe.isChecks.add(element); 330 universe.isChecks.add(element);
331 } 331 }
332 332
333 void forEach(f(WorkItem work)) { 333 void forEach(f(WorkItem work)) {
334 while (!queue.isEmpty()) { 334 while (!queue.isEmpty()) {
335 f(queue.removeLast()); // TODO(kasperl): Why isn't this removeFirst? 335 f(queue.removeLast()); // TODO(kasperl): Why isn't this removeFirst?
336 } 336 }
337 } 337 }
338 } 338 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/elements/elements.dart ('k') | dart/lib/compiler/implementation/js/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698