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

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

Issue 11304021: Add NativeEnqueuer to work with the Enqueuer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 part of dart2js; 5 part of dart2js;
6 6
7 class EnqueueTask extends CompilerTask { 7 class EnqueueTask extends CompilerTask {
8 final Enqueuer codegen; 8 final Enqueuer codegen;
9 final Enqueuer resolution; 9 final Enqueuer resolution;
10 10
(...skipping 23 matching lines...) Expand all
34 * Map from declaration elements to the [TreeElements] object holding the 34 * Map from declaration elements to the [TreeElements] object holding the
35 * resolution mapping for the element implementation. 35 * resolution mapping for the element implementation.
36 * 36 *
37 * Invariant: Key elements are declaration elements. 37 * Invariant: Key elements are declaration elements.
38 */ 38 */
39 final Map<Element, TreeElements> resolvedElements; 39 final Map<Element, TreeElements> resolvedElements;
40 40
41 bool queueIsClosed = false; 41 bool queueIsClosed = false;
42 EnqueueTask task; 42 EnqueueTask task;
43 43
44 NativeEnqueuer nativeEnqueuer; // Set by compiler.
45
44 Enqueuer(this.name, this.compiler, 46 Enqueuer(this.name, this.compiler,
45 ItemCompilationContext itemCompilationContextCreator()) 47 ItemCompilationContext itemCompilationContextCreator())
46 : this.itemCompilationContextCreator = itemCompilationContextCreator, 48 : this.itemCompilationContextCreator = itemCompilationContextCreator,
47 instanceMembersByName = new Map<String, Link<Element>>(), 49 instanceMembersByName = new Map<String, Link<Element>>(),
48 seenClasses = new Set<ClassElement>(), 50 seenClasses = new Set<ClassElement>(),
49 universe = new Universe(), 51 universe = new Universe(),
50 queue = new Queue<WorkItem>(), 52 queue = new Queue<WorkItem>(),
51 resolvedElements = new Map<Element, TreeElements>(); 53 resolvedElements = new Map<Element, TreeElements>();
52 54
53 bool get isResolutionQueue => identical(compiler.enqueuer.resolution, this); 55 bool get isResolutionQueue => identical(compiler.enqueuer.resolution, this);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 compiler.enabledFunctionApply = true; 109 compiler.enabledFunctionApply = true;
108 } 110 }
109 111
110 // Enable isolate support if we start using something from the 112 // Enable isolate support if we start using something from the
111 // isolate library. 113 // isolate library.
112 LibraryElement library = element.getLibrary(); 114 LibraryElement library = element.getLibrary();
113 if (!compiler.hasIsolateSupport() 115 if (!compiler.hasIsolateSupport()
114 && library.uri.toString() == 'dart:isolate') { 116 && library.uri.toString() == 'dart:isolate') {
115 compiler.enableIsolateSupport(library); 117 compiler.enableIsolateSupport(library);
116 } 118 }
119
120 nativeEnqueuer.registerElement(element);
117 } 121 }
118 122
119 /** 123 /**
120 * Documentation wanted -- johnniwinther 124 * Documentation wanted -- johnniwinther
121 * 125 *
122 * Invariant: [element] must be a declaration element. 126 * Invariant: [element] must be a declaration element.
123 */ 127 */
124 void eagerRecompile(Element element) { 128 void eagerRecompile(Element element) {
125 assert(invariant(element, element.isDeclaration)); 129 assert(invariant(element, element.isDeclaration));
126 universe.generatedCode.remove(element); 130 universe.generatedCode.remove(element);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 292 }
289 293
290 void handleUnseenSelector(SourceString methodName, Selector selector) { 294 void handleUnseenSelector(SourceString methodName, Selector selector) {
291 processInstanceMembers(methodName, (Element member) { 295 processInstanceMembers(methodName, (Element member) {
292 if (selector.applies(member, compiler)) { 296 if (selector.applies(member, compiler)) {
293 addToWorkList(member); 297 addToWorkList(member);
294 return true; 298 return true;
295 } 299 }
296 return false; 300 return false;
297 }); 301 });
302 // TODO(sra):
303 // getter selectors on native fields call nativeEnqueuer.registerFieldLoad,
304 // setter selector on native fields call nativeEnqueuer.registerFieldStore.
298 } 305 }
299 306
300 /** 307 /**
301 * Documentation wanted -- johnniwinther 308 * Documentation wanted -- johnniwinther
302 * 309 *
303 * Invariant: [element] must be a declaration element. 310 * Invariant: [element] must be a declaration element.
304 */ 311 */
305 void registerStaticUse(Element element) { 312 void registerStaticUse(Element element) {
306 if (element == null) return; 313 if (element == null) return;
307 assert(invariant(element, element.isDeclaration)); 314 assert(invariant(element, element.isDeclaration));
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 371
365 String toString() => 'Enqueuer($name)'; 372 String toString() => 'Enqueuer($name)';
366 373
367 registerUsedSelector(Selector selector) { 374 registerUsedSelector(Selector selector) {
368 Element interceptor = compiler.backend.getInterceptor(selector); 375 Element interceptor = compiler.backend.getInterceptor(selector);
369 if (interceptor != null) { 376 if (interceptor != null) {
370 registerStaticUse(interceptor); 377 registerStaticUse(interceptor);
371 } 378 }
372 } 379 }
373 } 380 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698