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

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

Issue 16162005: Add compileAll internal compiler flag. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Issues discovered during testing Created 7 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 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 * We should get rid of this and ensure that all dependencies are 244 * We should get rid of this and ensure that all dependencies are
245 * associated with a particular element. 245 * associated with a particular element.
246 */ 246 */
247 final TreeElements globalDependencies = new TreeElementMapping(null); 247 final TreeElements globalDependencies = new TreeElementMapping(null);
248 248
249 final bool enableMinification; 249 final bool enableMinification;
250 final bool enableTypeAssertions; 250 final bool enableTypeAssertions;
251 final bool enableUserAssertions; 251 final bool enableUserAssertions;
252 final bool trustTypeAnnotations; 252 final bool trustTypeAnnotations;
253 final bool enableConcreteTypeInference; 253 final bool enableConcreteTypeInference;
254 final bool disableTypeInference; 254 final bool disableTypeInferenceFlag;
255 255
256 /** 256 /**
257 * The maximum size of a concrete type before it widens to dynamic during 257 * The maximum size of a concrete type before it widens to dynamic during
258 * concrete type inference. 258 * concrete type inference.
259 */ 259 */
260 final int maxConcreteTypeSize; 260 final int maxConcreteTypeSize;
261 final bool analyzeAll; 261 final bool analyzeAllFlag;
262 final bool analyzeOnly; 262 final bool analyzeOnly;
263 /** 263 /**
264 * If true, skip analysis of method bodies and field initializers. Implies 264 * If true, skip analysis of method bodies and field initializers. Implies
265 * [analyzeOnly]. 265 * [analyzeOnly].
266 */ 266 */
267 final bool analyzeSignaturesOnly; 267 final bool analyzeSignaturesOnly;
268 final bool enableNativeLiveTypeAnalysis; 268 final bool enableNativeLiveTypeAnalysis;
269 final bool rejectDeprecatedFeatures; 269 final bool rejectDeprecatedFeatures;
270 final bool checkDeprecationInSdk; 270 final bool checkDeprecationInSdk;
271 271
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 447
448 bool compilationFailed = false; 448 bool compilationFailed = false;
449 449
450 bool hasCrashed = false; 450 bool hasCrashed = false;
451 451
452 Compiler({this.tracer: const Tracer(), 452 Compiler({this.tracer: const Tracer(),
453 this.enableTypeAssertions: false, 453 this.enableTypeAssertions: false,
454 this.enableUserAssertions: false, 454 this.enableUserAssertions: false,
455 this.trustTypeAnnotations: false, 455 this.trustTypeAnnotations: false,
456 this.enableConcreteTypeInference: false, 456 this.enableConcreteTypeInference: false,
457 this.disableTypeInference: false, 457 this.disableTypeInferenceFlag: false,
458 this.maxConcreteTypeSize: 5, 458 this.maxConcreteTypeSize: 5,
459 this.enableMinification: false, 459 this.enableMinification: false,
460 this.enableNativeLiveTypeAnalysis: false, 460 this.enableNativeLiveTypeAnalysis: false,
461 bool emitJavaScript: true, 461 bool emitJavaScript: true,
462 bool generateSourceMap: true, 462 bool generateSourceMap: true,
463 bool disallowUnsafeEval: false, 463 bool disallowUnsafeEval: false,
464 this.analyzeAll: false, 464 this.analyzeAllFlag: false,
465 bool analyzeOnly: false, 465 bool analyzeOnly: false,
466 bool analyzeSignaturesOnly: false, 466 bool analyzeSignaturesOnly: false,
467 this.rejectDeprecatedFeatures: false, 467 this.rejectDeprecatedFeatures: false,
468 this.checkDeprecationInSdk: false, 468 this.checkDeprecationInSdk: false,
469 this.preserveComments: false, 469 this.preserveComments: false,
470 this.verbose: false, 470 this.verbose: false,
471 this.sourceMapUri: null, 471 this.sourceMapUri: null,
472 this.buildId: UNDETERMINED_BUILD_ID, 472 this.buildId: UNDETERMINED_BUILD_ID,
473 this.globalJsName: r'$', 473 this.globalJsName: r'$',
474 outputProvider, 474 outputProvider,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 this, backend.constantSystem, isMetadata: true); 515 this, backend.constantSystem, isMetadata: true);
516 } 516 }
517 517
518 Universe get resolverWorld => enqueuer.resolution.universe; 518 Universe get resolverWorld => enqueuer.resolution.universe;
519 Universe get codegenWorld => enqueuer.codegen.universe; 519 Universe get codegenWorld => enqueuer.codegen.universe;
520 520
521 bool get hasBuildId => buildId != UNDETERMINED_BUILD_ID; 521 bool get hasBuildId => buildId != UNDETERMINED_BUILD_ID;
522 522
523 bool get mirrorsEnabled => mirrorSystemClass != null; 523 bool get mirrorsEnabled => mirrorSystemClass != null;
524 524
525 bool get analyzeAll => analyzeAllFlag || compileAll;
526
527 bool get compileAll => mirrorsEnabled;
528
529 bool get disableTypeInference => disableTypeInferenceFlag || mirrorsEnabled;
530
525 int getNextFreeClassId() => nextFreeClassId++; 531 int getNextFreeClassId() => nextFreeClassId++;
526 532
527 void ensure(bool condition) { 533 void ensure(bool condition) {
528 if (!condition) cancel('failed assertion in leg'); 534 if (!condition) cancel('failed assertion in leg');
529 } 535 }
530 536
531 void unimplemented(String methodName, 537 void unimplemented(String methodName,
532 {Node node, Token token, HInstruction instruction, 538 {Node node, Token token, HInstruction instruction,
533 Element element}) { 539 Element element}) {
534 internalError("$methodName not implemented", 540 internalError("$methodName not implemented",
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 // something to the resolution queue. So we cannot wait with 832 // something to the resolution queue. So we cannot wait with
827 // this until after the resolution queue is processed. 833 // this until after the resolution queue is processed.
828 // TODO(ahe): Clean this up, for example, by not enqueueing 834 // TODO(ahe): Clean this up, for example, by not enqueueing
829 // classes only used for metadata. 835 // classes only used for metadata.
830 deferredLoadTask.findDeferredLibraries(mainApp); 836 deferredLoadTask.findDeferredLibraries(mainApp);
831 } 837 }
832 838
833 log('Resolving...'); 839 log('Resolving...');
834 phase = PHASE_RESOLVING; 840 phase = PHASE_RESOLVING;
835 if (analyzeAll) { 841 if (analyzeAll) {
836 libraries.forEach((_, lib) => fullyEnqueueLibrary(lib)); 842 libraries.forEach(
843 (_, lib) => fullyEnqueueLibrary(lib, enqueuer.resolution));
837 } 844 }
838 // Elements required by enqueueHelpers are global dependencies 845 // Elements required by enqueueHelpers are global dependencies
839 // that are not pulled in by a particular element. 846 // that are not pulled in by a particular element.
840 backend.enqueueHelpers(enqueuer.resolution, globalDependencies); 847 backend.enqueueHelpers(enqueuer.resolution, globalDependencies);
841 resolveReflectiveDataIfNeeded(); 848 resolveReflectiveDataIfNeeded();
842 processQueue(enqueuer.resolution, main); 849 processQueue(enqueuer.resolution, main);
843 enqueuer.resolution.logSummary(log); 850 enqueuer.resolution.logSummary(log);
844 851
845 if (compilationFailed) return; 852 if (compilationFailed) return;
846 if (analyzeOnly) return; 853 if (analyzeOnly) return;
(...skipping 17 matching lines...) Expand all
864 // TODO(johnniwinther): Move these to [CodegenEnqueuer]. 871 // TODO(johnniwinther): Move these to [CodegenEnqueuer].
865 if (hasIsolateSupport()) { 872 if (hasIsolateSupport()) {
866 enqueuer.codegen.addToWorkList( 873 enqueuer.codegen.addToWorkList(
867 isolateHelperLibrary.find(Compiler.START_ROOT_ISOLATE)); 874 isolateHelperLibrary.find(Compiler.START_ROOT_ISOLATE));
868 enqueuer.codegen.registerGetOfStaticFunction(mainApp.find(MAIN)); 875 enqueuer.codegen.registerGetOfStaticFunction(mainApp.find(MAIN));
869 } 876 }
870 if (enabledNoSuchMethod) { 877 if (enabledNoSuchMethod) {
871 enqueuer.codegen.registerInvocation(NO_SUCH_METHOD, noSuchMethodSelector); 878 enqueuer.codegen.registerInvocation(NO_SUCH_METHOD, noSuchMethodSelector);
872 enqueuer.codegen.addToWorkList(createInvocationMirrorElement); 879 enqueuer.codegen.addToWorkList(createInvocationMirrorElement);
873 } 880 }
881 if (compileAll) {
882 libraries.forEach((_, lib) => fullyEnqueueLibrary(lib, enqueuer.codegen));
883 }
874 processQueue(enqueuer.codegen, main); 884 processQueue(enqueuer.codegen, main);
875 enqueuer.codegen.logSummary(log); 885 enqueuer.codegen.logSummary(log);
876 886
877 if (compilationFailed) return; 887 if (compilationFailed) return;
878 888
879 backend.assembleProgram(); 889 backend.assembleProgram();
880 890
881 checkQueues(); 891 checkQueues();
882 } 892 }
883 893
884 void resolveReflectiveDataIfNeeded() { 894 void resolveReflectiveDataIfNeeded() {
885 // Only need reflective data when dart:mirrors is loaded. 895 // Only need reflective data when dart:mirrors is loaded.
886 if (!mirrorsEnabled) return; 896 if (!mirrorsEnabled) return;
887 897
888 for (LibraryElement library in libraries.values) { 898 for (LibraryElement library in libraries.values) {
889 for (Link link = library.metadata; !link.isEmpty; link = link.tail) { 899 for (Link link = library.metadata; !link.isEmpty; link = link.tail) {
890 link.head.ensureResolved(this); 900 link.head.ensureResolved(this);
891 } 901 }
892 } 902 }
893 } 903 }
894 904
895 void fullyEnqueueLibrary(LibraryElement library) { 905 void fullyEnqueueLibrary(LibraryElement library, Enqueuer world) {
896 library.implementation.forEachLocalMember(fullyEnqueueTopLevelElement); 906 void enqueueAll(Element element) {
907 fullyEnqueueTopLevelElement(element, world);
908 }
909 library.implementation.forEachLocalMember(enqueueAll);
897 } 910 }
898 911
899 void fullyEnqueueTopLevelElement(Element element) { 912 void fullyEnqueueTopLevelElement(Element element, Enqueuer world) {
900 if (element.isClass()) { 913 if (element.isClass()) {
901 ClassElement cls = element; 914 ClassElement cls = element;
902 cls.ensureResolved(this); 915 cls.ensureResolved(this);
903 cls.forEachLocalMember(enqueuer.resolution.addToWorkList); 916 cls.forEachLocalMember(world.addToWorkList);
904 enqueuer.resolution.registerInstantiatedClass( 917 world.registerInstantiatedClass(element, globalDependencies);
905 element, globalDependencies);
906 } else { 918 } else {
907 enqueuer.resolution.addToWorkList(element); 919 world.addToWorkList(element);
908 } 920 }
909 } 921 }
910 922
911 void processQueue(Enqueuer world, Element main) { 923 void processQueue(Enqueuer world, Element main) {
912 world.nativeEnqueuer.processNativeClasses(libraries.values); 924 world.nativeEnqueuer.processNativeClasses(libraries.values);
913 if (main != null) { 925 if (main != null) {
914 world.addToWorkList(main); 926 world.addToWorkList(main);
915 } 927 }
916 progress.reset(); 928 progress.reset();
917 world.forEach((WorkItem work) { 929 world.forEach((WorkItem work) {
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 1379
1368 void close() {} 1380 void close() {}
1369 1381
1370 toString() => name; 1382 toString() => name;
1371 1383
1372 /// Convenience method for getting an [api.CompilerOutputProvider]. 1384 /// Convenience method for getting an [api.CompilerOutputProvider].
1373 static NullSink outputProvider(String name, String extension) { 1385 static NullSink outputProvider(String name, String extension) {
1374 return new NullSink('$name.$extension'); 1386 return new NullSink('$name.$extension');
1375 } 1387 }
1376 } 1388 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698