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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 12525007: Record dependency information to implement first version of dependency (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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 /** 7 /**
8 * If true, print a warning for each method that was resolved, but not 8 * If true, print a warning for each method that was resolved, but not
9 * compiled. 9 * compiled.
10 */ 10 */
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 // TODO(ahe,karlklose): rename this? 129 // TODO(ahe,karlklose): rename this?
130 void dumpInferredTypes() {} 130 void dumpInferredTypes() {}
131 131
132 ItemCompilationContext createItemCompilationContext() { 132 ItemCompilationContext createItemCompilationContext() {
133 return new ItemCompilationContext(); 133 return new ItemCompilationContext();
134 } 134 }
135 135
136 // The following methods are hooks for the backend to register its 136 // The following methods are hooks for the backend to register its
137 // helper methods. 137 // helper methods.
138 void registerInstantiatedClass(ClassElement cls, Enqueuer enqueuer) {} 138 void registerInstantiatedClass(ClassElement cls,
139 void registerStringInterpolation() {} 139 Enqueuer enqueuer,
140 void registerCatchStatement() {} 140 TreeElements elements) {}
141 void registerThrow() {} 141 void registerStringInterpolation(TreeElements elements) {}
142 void registerLazyField() {} 142 void registerCatchStatement(TreeElements elements) {}
143 void registerTypeLiteral() {} 143 void registerThrow(TreeElements elements) {}
144 void registerStackTraceInCatch() {} 144 void registerLazyField(TreeElements elements) {}
145 void registerIsCheck(DartType type, Enqueuer enqueuer) {} 145 void registerTypeLiteral(TreeElements elements) {}
146 void registerAsCheck(DartType type) {} 146 void registerStackTraceInCatch(TreeElements elements) {}
147 void registerThrowNoSuchMethod() {} 147 void registerIsCheck(DartType type,
148 void registerThrowRuntimeError() {} 148 Enqueuer enqueuer,
149 void registerAbstractClassInstantiation() {} 149 TreeElements elements) {}
150 void registerFallThroughError() {} 150 void registerAsCheck(DartType type, TreeElements elements) {}
151 void registerSuperNoSuchMethod() {} 151 void registerThrowNoSuchMethod(TreeElements elements) {}
152 void registerConstantMap() {} 152 void registerThrowRuntimeError(TreeElements elements) {}
153 void registerRuntimeType() {} 153 void registerAbstractClassInstantiation(TreeElements elements) {}
154 void registerFallThroughError(TreeElements elements) {}
155 void registerSuperNoSuchMethod(TreeElements elements) {}
156 void registerConstantMap(TreeElements elements) {}
157 void registerRuntimeType(TreeElements elements) {}
154 } 158 }
155 159
156 /** 160 /**
157 * Key class used in [TokenMap] in which the hash code for a token is based 161 * Key class used in [TokenMap] in which the hash code for a token is based
158 * on the [charOffset]. 162 * on the [charOffset].
159 */ 163 */
160 class TokenKey { 164 class TokenKey {
161 final Token token; 165 final Token token;
162 TokenKey(this.token); 166 TokenKey(this.token);
163 int get hashCode => token.charOffset; 167 int get hashCode => token.charOffset;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 int nextFreeClassId = 0; 202 int nextFreeClassId = 0;
199 World world; 203 World world;
200 String assembledCode; 204 String assembledCode;
201 Types types; 205 Types types;
202 206
203 /** 207 /**
204 * Map from token to the first preceeding comment token. 208 * Map from token to the first preceeding comment token.
205 */ 209 */
206 final TokenMap commentMap = new TokenMap(); 210 final TokenMap commentMap = new TokenMap();
207 211
212 /**
213 * Records global dependencies, that is, dependencies that don't
214 * correspond to a particular element.
215 *
216 * We should get rid of this and ensure that all dependencies are
217 * associated with a particular element.
218 */
219 final TreeElements globalDependencies = new TreeElementMapping(null);
220
208 final bool enableMinification; 221 final bool enableMinification;
209 final bool enableTypeAssertions; 222 final bool enableTypeAssertions;
210 final bool enableUserAssertions; 223 final bool enableUserAssertions;
211 final bool enableConcreteTypeInference; 224 final bool enableConcreteTypeInference;
212 /** 225 /**
213 * The maximum size of a concrete type before it widens to dynamic during 226 * The maximum size of a concrete type before it widens to dynamic during
214 * concrete type inference. 227 * concrete type inference.
215 */ 228 */
216 final int maxConcreteTypeSize; 229 final int maxConcreteTypeSize;
217 final bool analyzeAll; 230 final bool analyzeAll;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 reportFatalError('main is not a function', main); 670 reportFatalError('main is not a function', main);
658 } 671 }
659 FunctionElement mainMethod = main; 672 FunctionElement mainMethod = main;
660 FunctionSignature parameters = mainMethod.computeSignature(this); 673 FunctionSignature parameters = mainMethod.computeSignature(this);
661 parameters.forEachParameter((Element parameter) { 674 parameters.forEachParameter((Element parameter) {
662 reportFatalError('main cannot have parameters', parameter); 675 reportFatalError('main cannot have parameters', parameter);
663 }); 676 });
664 } 677 }
665 } 678 }
666 679
667 deferredLoadTask.registerMainApp(mainApp);
668
669 log('Resolving...'); 680 log('Resolving...');
670 phase = PHASE_RESOLVING; 681 phase = PHASE_RESOLVING;
671 if (analyzeAll) { 682 if (analyzeAll) {
672 libraries.forEach((_, lib) => fullyEnqueueLibrary(lib)); 683 libraries.forEach((_, lib) => fullyEnqueueLibrary(lib));
673 } 684 }
674 backend.enqueueHelpers(enqueuer.resolution); 685 backend.enqueueHelpers(enqueuer.resolution);
675 processQueue(enqueuer.resolution, main); 686 processQueue(enqueuer.resolution, main);
676 enqueuer.resolution.logSummary(log); 687 enqueuer.resolution.logSummary(log);
677 688
678 if (compilationFailed) return; 689 if (compilationFailed) return;
679 if (analyzeOnly) return; 690 if (analyzeOnly) return;
680 assert(main != null); 691 assert(main != null);
681 692
682 // TODO(ahe): Remove this line. Eventually, enqueuer.resolution 693 // TODO(ahe): Remove this line. Eventually, enqueuer.resolution
683 // should know this. 694 // should know this.
684 world.populate(); 695 world.populate();
685 696
697 deferredLoadTask.onResolutionComplete(main);
698
686 log('Inferring types...'); 699 log('Inferring types...');
687 typesTask.onResolutionComplete(main); 700 typesTask.onResolutionComplete(main);
688 701
689 log('Compiling...'); 702 log('Compiling...');
690 phase = PHASE_COMPILING; 703 phase = PHASE_COMPILING;
691 // TODO(johnniwinther): Move these to [CodegenEnqueuer]. 704 // TODO(johnniwinther): Move these to [CodegenEnqueuer].
692 if (hasIsolateSupport()) { 705 if (hasIsolateSupport()) {
693 enqueuer.codegen.addToWorkList( 706 enqueuer.codegen.addToWorkList(
694 isolateHelperLibrary.find(Compiler.START_ROOT_ISOLATE)); 707 isolateHelperLibrary.find(Compiler.START_ROOT_ISOLATE));
695 } 708 }
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 1171
1159 void close() {} 1172 void close() {}
1160 1173
1161 toString() => name; 1174 toString() => name;
1162 1175
1163 /// Convenience method for getting an [api.CompilerOutputProvider]. 1176 /// Convenience method for getting an [api.CompilerOutputProvider].
1164 static NullSink outputProvider(String name, String extension) { 1177 static NullSink outputProvider(String name, String extension) {
1165 return new NullSink('$name.$extension'); 1178 return new NullSink('$name.$extension');
1166 } 1179 }
1167 } 1180 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698