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

Side by Side Diff: pkg/compiler/lib/src/native/enqueue.dart

Issue 2668233002: Remove code supporting incremental compilation in dart2js (Closed)
Patch Set: Created 3 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
« no previous file with comments | « pkg/compiler/lib/src/kernel/element_adapter.dart ('k') | pkg/compiler/lib/src/options.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 import 'dart:collection' show Queue; 5 import 'dart:collection' show Queue;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/backend_api.dart' show ForeignResolver; 8 import '../common/backend_api.dart' show ForeignResolver;
9 import '../common/resolution.dart' show Resolution; 9 import '../common/resolution.dart' show Resolution;
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 abstract class NativeEnqueuerBase implements NativeEnqueuer { 68 abstract class NativeEnqueuerBase implements NativeEnqueuer {
69 static final RegExp _identifier = new RegExp(r'^[a-zA-Z_$][a-zA-Z0-9_$]*$'); 69 static final RegExp _identifier = new RegExp(r'^[a-zA-Z_$][a-zA-Z0-9_$]*$');
70 70
71 /// The set of all native classes. Each native class is in [nativeClasses] 71 /// The set of all native classes. Each native class is in [nativeClasses]
72 /// and exactly one of [unusedClasses] and [registeredClasses]. 72 /// and exactly one of [unusedClasses] and [registeredClasses].
73 final Set<ClassElement> _nativeClasses = new Set<ClassElement>(); 73 final Set<ClassElement> _nativeClasses = new Set<ClassElement>();
74 74
75 final Set<ClassElement> _registeredClasses = new Set<ClassElement>(); 75 final Set<ClassElement> _registeredClasses = new Set<ClassElement>();
76 final Set<ClassElement> _unusedClasses = new Set<ClassElement>(); 76 final Set<ClassElement> _unusedClasses = new Set<ClassElement>();
77 77
78 final Set<LibraryElement> processedLibraries;
79
80 bool get hasInstantiatedNativeClasses => !_registeredClasses.isEmpty; 78 bool get hasInstantiatedNativeClasses => !_registeredClasses.isEmpty;
81 79
82 final Set<ClassElement> nativeClassesAndSubclasses = new Set<ClassElement>(); 80 final Set<ClassElement> nativeClassesAndSubclasses = new Set<ClassElement>();
83 81
84 final Compiler compiler; 82 final Compiler compiler;
85 final bool enableLiveTypeAnalysis; 83 final bool enableLiveTypeAnalysis;
86 84
87 ClassElement _annotationCreatesClass; 85 ClassElement _annotationCreatesClass;
88 ClassElement _annotationReturnsClass; 86 ClassElement _annotationReturnsClass;
89 ClassElement _annotationJsNameClass; 87 ClassElement _annotationJsNameClass;
90 88
91 /// Subclasses of [NativeEnqueuerBase] are constructed by the backend. 89 /// Subclasses of [NativeEnqueuerBase] are constructed by the backend.
92 NativeEnqueuerBase(Compiler compiler, this.enableLiveTypeAnalysis) 90 NativeEnqueuerBase(Compiler compiler, this.enableLiveTypeAnalysis)
93 : this.compiler = compiler, 91 : this.compiler = compiler;
94 processedLibraries = compiler.cacheStrategy.newSet();
95 92
96 JavaScriptBackend get backend => compiler.backend; 93 JavaScriptBackend get backend => compiler.backend;
97 BackendHelpers get helpers => backend.helpers; 94 BackendHelpers get helpers => backend.helpers;
98 Resolution get resolution => compiler.resolution; 95 Resolution get resolution => compiler.resolution;
99 96
100 DiagnosticReporter get reporter => compiler.reporter; 97 DiagnosticReporter get reporter => compiler.reporter;
101 CommonElements get commonElements => compiler.commonElements; 98 CommonElements get commonElements => compiler.commonElements;
102 99
103 void onInstantiatedType(ResolutionInterfaceType type) { 100 void onInstantiatedType(ResolutionInterfaceType type) {
104 if (_unusedClasses.remove(type.element)) { 101 if (_unusedClasses.remove(type.element)) {
105 _registeredClasses.add(type.element); 102 _registeredClasses.add(type.element);
106 } 103 }
107 } 104 }
108 105
109 WorldImpact processNativeClasses(Iterable<LibraryElement> libraries) { 106 WorldImpact processNativeClasses(Iterable<LibraryElement> libraries) {
110 WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl(); 107 WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
111 _processNativeClasses(impactBuilder, libraries); 108 _processNativeClasses(impactBuilder, libraries);
112 return impactBuilder; 109 return impactBuilder;
113 } 110 }
114 111
115 void _processNativeClasses( 112 void _processNativeClasses(
116 WorldImpactBuilder impactBuilder, Iterable<LibraryElement> libraries) { 113 WorldImpactBuilder impactBuilder, Iterable<LibraryElement> libraries) {
117 if (compiler.options.hasIncrementalSupport) {
118 // Since [Set.add] returns bool if an element was added, this restricts
119 // [libraries] to ones that haven't already been processed. This saves
120 // time during incremental compiles.
121 libraries = libraries.where(processedLibraries.add);
122 }
123 libraries.forEach(processNativeClassesInLibrary); 114 libraries.forEach(processNativeClassesInLibrary);
124 if (helpers.isolateHelperLibrary != null) { 115 if (helpers.isolateHelperLibrary != null) {
125 processNativeClassesInLibrary(helpers.isolateHelperLibrary); 116 processNativeClassesInLibrary(helpers.isolateHelperLibrary);
126 } 117 }
127 processSubclassesOfNativeClasses(libraries); 118 processSubclassesOfNativeClasses(libraries);
128 if (!enableLiveTypeAnalysis) { 119 if (!enableLiveTypeAnalysis) {
129 _registerTypeUses(impactBuilder, _nativeClasses, 'forced'); 120 _registerTypeUses(impactBuilder, _nativeClasses, 'forced');
130 } 121 }
131 } 122 }
132 123
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 List<ClassEntity> directSubtypes = 639 List<ClassEntity> directSubtypes =
649 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassEntity>[]); 640 emitter.directSubtypes.putIfAbsent(superclass, () => <ClassEntity>[]);
650 directSubtypes.add(cls); 641 directSubtypes.add(cls);
651 } 642 }
652 643
653 void logSummary(log(message)) { 644 void logSummary(log(message)) {
654 log('Compiled ${_registeredClasses.length} native classes, ' 645 log('Compiled ${_registeredClasses.length} native classes, '
655 '${_unusedClasses.length} native classes omitted.'); 646 '${_unusedClasses.length} native classes omitted.');
656 } 647 }
657 } 648 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/element_adapter.dart ('k') | pkg/compiler/lib/src/options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698