| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /// An entrypoint used to run portions of dart2js and measure its performance. | 5 /// An entrypoint used to run portions of dart2js and measure its performance. |
| 6 library compiler.tool.perf; | 6 library compiler.tool.perf; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 class MyCompiler extends CompilerImpl { | 337 class MyCompiler extends CompilerImpl { |
| 338 MyCompiler(CompilerInput provider, CompilerDiagnostics handler, | 338 MyCompiler(CompilerInput provider, CompilerDiagnostics handler, |
| 339 CompilerOptions options) | 339 CompilerOptions options) |
| 340 : super(provider, null, handler, options) {} | 340 : super(provider, null, handler, options) {} |
| 341 | 341 |
| 342 /// Performs the compilation when all libraries have been loaded. | 342 /// Performs the compilation when all libraries have been loaded. |
| 343 void compileLoadedLibraries(LibraryEntity rootLibrary) => | 343 void compileLoadedLibraries(LibraryEntity rootLibrary) => |
| 344 selfTask.measureSubtask('KernelCompiler.compileLoadedLibraries', () { | 344 selfTask.measureSubtask('KernelCompiler.compileLoadedLibraries', () { |
| 345 ResolutionEnqueuer resolutionEnqueuer = startResolution(); | 345 ResolutionEnqueuer resolutionEnqueuer = startResolution(); |
| 346 WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl(); | 346 WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl(); |
| 347 mainFunction = frontendStrategy.computeMain(rootLibrary, mainImpact); | 347 var mainFunction = |
| 348 mirrorUsageAnalyzerTask.analyzeUsage(mainApp); | 348 frontendStrategy.computeMain(rootLibrary, mainImpact); |
| 349 mirrorUsageAnalyzerTask.analyzeUsage(rootLibrary); |
| 349 | 350 |
| 350 deferredLoadTask.beforeResolution(this); | 351 deferredLoadTask.beforeResolution(rootLibrary); |
| 351 impactStrategy = backend.createImpactStrategy( | 352 impactStrategy = backend.createImpactStrategy( |
| 352 supportDeferredLoad: deferredLoadTask.isProgramSplit, | 353 supportDeferredLoad: deferredLoadTask.isProgramSplit, |
| 353 supportDumpInfo: options.dumpInfo, | 354 supportDumpInfo: options.dumpInfo, |
| 354 supportSerialization: serialization.supportSerialization); | 355 supportSerialization: serialization.supportSerialization); |
| 355 | 356 |
| 356 phase = Compiler.PHASE_RESOLVING; | 357 phase = Compiler.PHASE_RESOLVING; |
| 357 resolutionEnqueuer.applyImpact(mainImpact); | 358 resolutionEnqueuer.applyImpact(mainImpact); |
| 358 // Note: we enqueue everything in the program so we measure generating | 359 // Note: we enqueue everything in the program so we measure generating |
| 359 // kernel for the entire code, not just what's reachable from main. | 360 // kernel for the entire code, not just what's reachable from main. |
| 360 libraryLoader.libraries.forEach((LibraryEntity library) { | 361 libraryLoader.libraries.forEach((LibraryEntity library) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 372 (reporter as CompilerDiagnosticReporter) | 373 (reporter as CompilerDiagnosticReporter) |
| 373 .reportSuppressedMessagesSummary(); | 374 .reportSuppressedMessagesSummary(); |
| 374 | 375 |
| 375 if (compilationFailed) { | 376 if (compilationFailed) { |
| 376 // TODO(sigmund): more diagnostics? | 377 // TODO(sigmund): more diagnostics? |
| 377 print('compilation failed!'); | 378 print('compilation failed!'); |
| 378 exit(1); | 379 exit(1); |
| 379 } | 380 } |
| 380 | 381 |
| 381 backend.onResolutionEnd(); | 382 backend.onResolutionEnd(); |
| 382 closeResolution(); | 383 closeResolution(mainFunction); |
| 383 var program = (backend as dynamic).kernelTask.program; | 384 var program = (backend as dynamic).kernelTask.program; |
| 384 print('total libraries: ${program.libraries.length}'); | 385 print('total libraries: ${program.libraries.length}'); |
| 385 }); | 386 }); |
| 386 } | 387 } |
| OLD | NEW |