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: sdk/lib/_internal/compiler/implementation/enqueue.dart

Issue 142193005: Fix JS-backend when MirrorsUsed target a static field, but there is no mirrors usage. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update copyright year. Created 6 years, 10 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 part of dart2js; 5 part of dart2js;
6 6
7 typedef ItemCompilationContext ItemCompilationContextCreator(); 7 typedef ItemCompilationContext ItemCompilationContextCreator();
8 8
9 class EnqueueTask extends CompilerTask { 9 class EnqueueTask extends CompilerTask {
10 final ResolutionEnqueuer resolution; 10 final ResolutionEnqueuer resolution;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 = new Map<String, Link<Element>>(); 78 = new Map<String, Link<Element>>();
79 final Map<String, Link<Element>> instanceFunctionsByName 79 final Map<String, Link<Element>> instanceFunctionsByName
80 = new Map<String, Link<Element>>(); 80 = new Map<String, Link<Element>>();
81 final Set<ClassElement> seenClasses = new Set<ClassElement>(); 81 final Set<ClassElement> seenClasses = new Set<ClassElement>();
82 final Universe universe = new Universe(); 82 final Universe universe = new Universe();
83 83
84 bool queueIsClosed = false; 84 bool queueIsClosed = false;
85 EnqueueTask task; 85 EnqueueTask task;
86 native.NativeEnqueuer nativeEnqueuer; // Set by EnqueueTask 86 native.NativeEnqueuer nativeEnqueuer; // Set by EnqueueTask
87 87
88 bool hasEnqueuedEverything = false; 88 bool hasEnqueuedReflectiveElements = false;
89 89
90 Enqueuer(this.name, this.compiler, this.itemCompilationContextCreator); 90 Enqueuer(this.name, this.compiler, this.itemCompilationContextCreator);
91 91
92 Queue<WorkItem> get queue; 92 Queue<WorkItem> get queue;
93 93
94 /// Returns [:true:] if this enqueuer is the resolution enqueuer. 94 /// Returns [:true:] if this enqueuer is the resolution enqueuer.
95 bool get isResolutionQueue => false; 95 bool get isResolutionQueue => false;
96 96
97 /// Returns [:true:] if [member] has been processed by this enqueuer. 97 /// Returns [:true:] if [member] has been processed by this enqueuer.
98 bool isProcessed(Element member); 98 bool isProcessed(Element member);
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 } 352 }
353 } 353 }
354 } 354 }
355 355
356 /// Called when [:new Symbol(...):] is seen. 356 /// Called when [:new Symbol(...):] is seen.
357 void registerNewSymbol(TreeElements elements) { 357 void registerNewSymbol(TreeElements elements) {
358 compiler.backend.registerNewSymbol(elements); 358 compiler.backend.registerNewSymbol(elements);
359 } 359 }
360 360
361 void enqueueEverything() { 361 void enqueueEverything() {
362 if (hasEnqueuedEverything) return; 362 if (hasEnqueuedReflectiveElements) return;
363 compiler.log('Enqueuing everything'); 363 compiler.log('Enqueuing everything');
364 task.ensureAllElementsByName(); 364 task.ensureAllElementsByName();
365 for (Link link in task.allElementsByName.values) { 365 for (Link link in task.allElementsByName.values) {
366 for (Element element in link) { 366 for (Element element in link) {
367 pretendElementWasUsed(element, compiler.globalDependencies); 367 pretendElementWasUsed(element, compiler.globalDependencies);
368 } 368 }
369 } 369 }
370 hasEnqueuedEverything = true; 370 hasEnqueuedReflectiveElements = true;
371 }
372
373 /// Enqueue the static fields that have been marked as used by reflective
374 /// usage through `MirrorsUsed`.
375 void enqueueReflectiveStaticFields(Iterable<Element> elements) {
376 if (hasEnqueuedReflectiveElements) return;
377 hasEnqueuedReflectiveElements = true;
378 for (Element element in elements) {
379 pretendElementWasUsed(element, compiler.globalDependencies);
380 }
371 } 381 }
372 382
373 processLink(Map<String, Link<Element>> map, 383 processLink(Map<String, Link<Element>> map,
374 String memberName, 384 String memberName,
375 bool f(Element e)) { 385 bool f(Element e)) {
376 Link<Element> members = map[memberName]; 386 Link<Element> members = map[memberName];
377 if (members != null) { 387 if (members != null) {
378 // [f] might add elements to [: map[memberName] :] during the loop below 388 // [f] might add elements to [: map[memberName] :] during the loop below
379 // so we create a new list for [: map[memberName] :] and prepend the 389 // so we create a new list for [: map[memberName] :] and prepend the
380 // [remaining] members after the loop. 390 // [remaining] members after the loop.
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 } 762 }
753 CodegenWorkItem workItem = new CodegenWorkItem( 763 CodegenWorkItem workItem = new CodegenWorkItem(
754 element, itemCompilationContextCreator()); 764 element, itemCompilationContextCreator());
755 queue.add(workItem); 765 queue.add(workItem);
756 } 766 }
757 767
758 void _logSpecificSummary(log(message)) { 768 void _logSpecificSummary(log(message)) {
759 log('Compiled ${generatedCode.length} methods.'); 769 log('Compiled ${generatedCode.length} methods.');
760 } 770 }
761 } 771 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698