| OLD | NEW |
| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 TreeValidatorTask validator; | 300 TreeValidatorTask validator; |
| 301 ResolverTask resolver; | 301 ResolverTask resolver; |
| 302 closureMapping.ClosureTask closureToClassMapper; | 302 closureMapping.ClosureTask closureToClassMapper; |
| 303 TypeCheckerTask checker; | 303 TypeCheckerTask checker; |
| 304 ti.TypesTask typesTask; | 304 ti.TypesTask typesTask; |
| 305 Backend backend; | 305 Backend backend; |
| 306 ConstantHandler constantHandler; | 306 ConstantHandler constantHandler; |
| 307 ConstantHandler metadataHandler; | 307 ConstantHandler metadataHandler; |
| 308 EnqueueTask enqueuer; | 308 EnqueueTask enqueuer; |
| 309 CompilerTask fileReadingTask; | 309 CompilerTask fileReadingTask; |
| 310 DeferredLoadTask deferredLoadTask; |
| 310 | 311 |
| 311 static const SourceString MAIN = const SourceString('main'); | 312 static const SourceString MAIN = const SourceString('main'); |
| 312 static const SourceString CALL_OPERATOR_NAME = const SourceString('call'); | 313 static const SourceString CALL_OPERATOR_NAME = const SourceString('call'); |
| 313 static const SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); | 314 static const SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); |
| 314 static const int NO_SUCH_METHOD_ARG_COUNT = 1; | 315 static const int NO_SUCH_METHOD_ARG_COUNT = 1; |
| 315 static const SourceString CREATE_INVOCATION_MIRROR = | 316 static const SourceString CREATE_INVOCATION_MIRROR = |
| 316 const SourceString('createInvocationMirror'); | 317 const SourceString('createInvocationMirror'); |
| 317 static const SourceString INVOKE_ON = const SourceString('invokeOn'); | 318 static const SourceString INVOKE_ON = const SourceString('invokeOn'); |
| 318 static const SourceString RUNTIME_TYPE = const SourceString('runtimeType'); | 319 static const SourceString RUNTIME_TYPE = const SourceString('runtimeType'); |
| 319 static const SourceString START_ROOT_ISOLATE = | 320 static const SourceString START_ROOT_ISOLATE = |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 libraryLoader = new LibraryLoaderTask(this), | 379 libraryLoader = new LibraryLoaderTask(this), |
| 379 scanner = new ScannerTask(this), | 380 scanner = new ScannerTask(this), |
| 380 dietParser = new DietParserTask(this), | 381 dietParser = new DietParserTask(this), |
| 381 parser = new ParserTask(this), | 382 parser = new ParserTask(this), |
| 382 patchParser = new PatchParserTask(this), | 383 patchParser = new PatchParserTask(this), |
| 383 resolver = new ResolverTask(this), | 384 resolver = new ResolverTask(this), |
| 384 closureToClassMapper = new closureMapping.ClosureTask(this, closureNamer), | 385 closureToClassMapper = new closureMapping.ClosureTask(this, closureNamer), |
| 385 checker = new TypeCheckerTask(this), | 386 checker = new TypeCheckerTask(this), |
| 386 typesTask = new ti.TypesTask(this), | 387 typesTask = new ti.TypesTask(this), |
| 387 constantHandler = new ConstantHandler(this, backend.constantSystem), | 388 constantHandler = new ConstantHandler(this, backend.constantSystem), |
| 389 deferredLoadTask = new DeferredLoadTask(this), |
| 388 enqueuer = new EnqueueTask(this)]; | 390 enqueuer = new EnqueueTask(this)]; |
| 389 | 391 |
| 390 tasks.addAll(backend.tasks); | 392 tasks.addAll(backend.tasks); |
| 391 metadataHandler = new ConstantHandler( | 393 metadataHandler = new ConstantHandler( |
| 392 this, backend.constantSystem, isMetadata: true); | 394 this, backend.constantSystem, isMetadata: true); |
| 393 } | 395 } |
| 394 | 396 |
| 395 Universe get resolverWorld => enqueuer.resolution.universe; | 397 Universe get resolverWorld => enqueuer.resolution.universe; |
| 396 Universe get codegenWorld => enqueuer.codegen.universe; | 398 Universe get codegenWorld => enqueuer.codegen.universe; |
| 397 | 399 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 reportFatalError('main is not a function', main); | 648 reportFatalError('main is not a function', main); |
| 647 } | 649 } |
| 648 FunctionElement mainMethod = main; | 650 FunctionElement mainMethod = main; |
| 649 FunctionSignature parameters = mainMethod.computeSignature(this); | 651 FunctionSignature parameters = mainMethod.computeSignature(this); |
| 650 parameters.forEachParameter((Element parameter) { | 652 parameters.forEachParameter((Element parameter) { |
| 651 reportFatalError('main cannot have parameters', parameter); | 653 reportFatalError('main cannot have parameters', parameter); |
| 652 }); | 654 }); |
| 653 } | 655 } |
| 654 } | 656 } |
| 655 | 657 |
| 658 deferredLoadTask.registerMainApp(mainApp); |
| 659 |
| 656 log('Resolving...'); | 660 log('Resolving...'); |
| 657 phase = PHASE_RESOLVING; | 661 phase = PHASE_RESOLVING; |
| 658 if (analyzeAll) { | 662 if (analyzeAll) { |
| 659 libraries.forEach((_, lib) => fullyEnqueueLibrary(lib)); | 663 libraries.forEach((_, lib) => fullyEnqueueLibrary(lib)); |
| 660 } | 664 } |
| 661 backend.enqueueHelpers(enqueuer.resolution); | 665 backend.enqueueHelpers(enqueuer.resolution); |
| 662 processQueue(enqueuer.resolution, main); | 666 processQueue(enqueuer.resolution, main); |
| 663 enqueuer.resolution.logSummary(log); | 667 enqueuer.resolution.logSummary(log); |
| 664 | 668 |
| 665 if (compilationFailed) return; | 669 if (compilationFailed) return; |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 | 1039 |
| 1036 class CompilerTask { | 1040 class CompilerTask { |
| 1037 final Compiler compiler; | 1041 final Compiler compiler; |
| 1038 final Stopwatch watch; | 1042 final Stopwatch watch; |
| 1039 | 1043 |
| 1040 CompilerTask(this.compiler) : watch = new Stopwatch(); | 1044 CompilerTask(this.compiler) : watch = new Stopwatch(); |
| 1041 | 1045 |
| 1042 String get name => 'Unknown task'; | 1046 String get name => 'Unknown task'; |
| 1043 int get timing => watch.elapsedMilliseconds; | 1047 int get timing => watch.elapsedMilliseconds; |
| 1044 | 1048 |
| 1045 measure(Function action) { | 1049 measure(action()) { |
| 1046 CompilerTask previous = compiler.measuredTask; | 1050 CompilerTask previous = compiler.measuredTask; |
| 1047 if (identical(this, previous)) return action(); | 1051 if (identical(this, previous)) return action(); |
| 1048 compiler.measuredTask = this; | 1052 compiler.measuredTask = this; |
| 1049 if (previous != null) previous.watch.stop(); | 1053 if (previous != null) previous.watch.stop(); |
| 1050 watch.start(); | 1054 watch.start(); |
| 1051 try { | 1055 try { |
| 1052 return action(); | 1056 return action(); |
| 1053 } finally { | 1057 } finally { |
| 1054 watch.stop(); | 1058 watch.stop(); |
| 1055 if (previous != null) previous.watch.start(); | 1059 if (previous != null) previous.watch.start(); |
| 1056 compiler.measuredTask = previous; | 1060 compiler.measuredTask = previous; |
| 1057 } | 1061 } |
| 1058 } | 1062 } |
| 1063 |
| 1064 measureElement(Element element, action()) { |
| 1065 compiler.withCurrentElement(element, () => measure(action)); |
| 1066 } |
| 1059 } | 1067 } |
| 1060 | 1068 |
| 1061 class CompilerCancelledException implements Exception { | 1069 class CompilerCancelledException implements Exception { |
| 1062 final String reason; | 1070 final String reason; |
| 1063 CompilerCancelledException(this.reason); | 1071 CompilerCancelledException(this.reason); |
| 1064 | 1072 |
| 1065 String toString() { | 1073 String toString() { |
| 1066 String banner = 'compiler cancelled'; | 1074 String banner = 'compiler cancelled'; |
| 1067 return (reason != null) ? '$banner: $reason' : '$banner'; | 1075 return (reason != null) ? '$banner: $reason' : '$banner'; |
| 1068 } | 1076 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 | 1148 |
| 1141 void close() {} | 1149 void close() {} |
| 1142 | 1150 |
| 1143 toString() => name; | 1151 toString() => name; |
| 1144 | 1152 |
| 1145 /// Convenience method for getting an [api.CompilerOutputProvider]. | 1153 /// Convenience method for getting an [api.CompilerOutputProvider]. |
| 1146 static NullSink outputProvider(String name, String extension) { | 1154 static NullSink outputProvider(String name, String extension) { |
| 1147 return new NullSink('$name.$extension'); | 1155 return new NullSink('$name.$extension'); |
| 1148 } | 1156 } |
| 1149 } | 1157 } |
| OLD | NEW |