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

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

Issue 10537129: Address review comments from https://chromiumcodereview.appspot.com/10542073/ (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 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
(...skipping 16 matching lines...) Expand all
27 bool queueIsClosed = false; 27 bool queueIsClosed = false;
28 EnqueueTask task; 28 EnqueueTask task;
29 29
30 Enqueuer(this.compiler) 30 Enqueuer(this.compiler)
31 : instanceMembersByName = new Map<String, Link<Element>>(), 31 : instanceMembersByName = new Map<String, Link<Element>>(),
32 seenClasses = new Set<ClassElement>(), 32 seenClasses = new Set<ClassElement>(),
33 universe = new Universe(), 33 universe = new Universe(),
34 queue = new Queue<WorkItem>(), 34 queue = new Queue<WorkItem>(),
35 resolvedElements = new Map<Element, TreeElements>(); 35 resolvedElements = new Map<Element, TreeElements>();
36 36
37 bool get isFirstQueue() => compiler.enqueuer.resolution === this; 37 bool get isResolutionQueue() => compiler.enqueuer.resolution === this;
38 38
39 TreeElements getCachedElements(Element element) { 39 TreeElements getCachedElements(Element element) {
40 Element owner = element.getOutermostEnclosingMemberOrTopLevel(); 40 Element owner = element.getOutermostEnclosingMemberOrTopLevel();
41 return compiler.enqueuer.resolution.resolvedElements[owner]; 41 return compiler.enqueuer.resolution.resolvedElements[owner];
42 } 42 }
43 43
44 void addToWorkList(Element element, [TreeElements elements]) { 44 void addToWorkList(Element element, [TreeElements elements]) {
45 if (element.isForeign()) return; 45 if (element.isForeign()) return;
46 if (queueIsClosed) { 46 if (queueIsClosed) {
47 if (isFirstQueue && getCachedElements(element) !== null) return; 47 if (isResolutionQueue && getCachedElements(element) !== null) return;
48 compiler.internalErrorOnElement(element, "Work list is closed."); 48 compiler.internalErrorOnElement(element, "Work list is closed.");
49 } 49 }
50 if (!isFirstQueue && element.kind === ElementKind.GENERATIVE_CONSTRUCTOR) { 50 if (!isResolutionQueue &&
51 element.kind === ElementKind.GENERATIVE_CONSTRUCTOR) {
51 registerInstantiatedClass(element.enclosingElement); 52 registerInstantiatedClass(element.enclosingElement);
52 } 53 }
53 if (elements === null) { 54 if (elements === null) {
54 elements = getCachedElements(element); 55 elements = getCachedElements(element);
55 } 56 }
56 queue.add(new WorkItem(element, elements)); 57 queue.add(new WorkItem(element, elements));
57 } 58 }
58 59
59 void registerInstantiatedClass(ClassElement cls) { 60 void registerInstantiatedClass(ClassElement cls) {
60 if (cls.isInterface()) { 61 if (cls.isInterface()) {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 void registerIsCheck(Element element) { 265 void registerIsCheck(Element element) {
265 universe.isChecks.add(element); 266 universe.isChecks.add(element);
266 } 267 }
267 268
268 void forEach(f(WorkItem work)) { 269 void forEach(f(WorkItem work)) {
269 while (!queue.isEmpty()) { 270 while (!queue.isEmpty()) {
270 f(queue.removeLast()); 271 f(queue.removeLast());
271 } 272 }
272 } 273 }
273 } 274 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/compiler.dart ('k') | dart/lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698