| 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 |
| 11 import 'package:compiler/compiler_new.dart'; | 11 import 'package:compiler/compiler_new.dart'; |
| 12 import 'package:compiler/src/apiimpl.dart'; | 12 import 'package:compiler/src/apiimpl.dart'; |
| 13 import 'package:compiler/src/compiler.dart'; | 13 import 'package:compiler/src/compiler.dart'; |
| 14 import 'package:compiler/src/elements/elements.dart'; | 14 import 'package:compiler/src/elements/entities.dart' show LibraryEntity; |
| 15 import 'package:compiler/src/common.dart'; | 15 import 'package:compiler/src/common.dart'; |
| 16 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; | 16 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; |
| 17 import 'package:compiler/src/diagnostics/messages.dart' | 17 import 'package:compiler/src/diagnostics/messages.dart' |
| 18 show Message, MessageTemplate; | 18 show Message, MessageTemplate; |
| 19 import 'package:compiler/src/enqueue.dart' show ResolutionEnqueuer; | 19 import 'package:compiler/src/enqueue.dart' show ResolutionEnqueuer; |
| 20 import 'package:compiler/src/io/source_file.dart'; | 20 import 'package:compiler/src/io/source_file.dart'; |
| 21 import 'package:compiler/src/options.dart'; | 21 import 'package:compiler/src/options.dart'; |
| 22 import 'package:compiler/src/parser/element_listener.dart' show ScannerOptions; | 22 import 'package:compiler/src/parser/element_listener.dart' show ScannerOptions; |
| 23 import 'package:compiler/src/parser/node_listener.dart' show NodeListener; | 23 import 'package:compiler/src/parser/node_listener.dart' show NodeListener; |
| 24 import 'package:compiler/src/parser/diet_parser_task.dart' show PartialParser; | 24 import 'package:compiler/src/parser/diet_parser_task.dart' show PartialParser; |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 deferredLoadTask.beforeResolution(this); | 354 deferredLoadTask.beforeResolution(this); |
| 355 impactStrategy = backend.createImpactStrategy( | 355 impactStrategy = backend.createImpactStrategy( |
| 356 supportDeferredLoad: deferredLoadTask.isProgramSplit, | 356 supportDeferredLoad: deferredLoadTask.isProgramSplit, |
| 357 supportDumpInfo: options.dumpInfo, | 357 supportDumpInfo: options.dumpInfo, |
| 358 supportSerialization: serialization.supportSerialization); | 358 supportSerialization: serialization.supportSerialization); |
| 359 | 359 |
| 360 phase = Compiler.PHASE_RESOLVING; | 360 phase = Compiler.PHASE_RESOLVING; |
| 361 resolutionEnqueuer.applyImpact(mainImpact); | 361 resolutionEnqueuer.applyImpact(mainImpact); |
| 362 // Note: we enqueue everything in the program so we measure generating | 362 // Note: we enqueue everything in the program so we measure generating |
| 363 // kernel for the entire code, not just what's reachable from main. | 363 // kernel for the entire code, not just what's reachable from main. |
| 364 libraryLoader.libraries.forEach((LibraryElement library) { | 364 libraryLoader.libraries.forEach((LibraryEntity library) { |
| 365 resolutionEnqueuer.applyImpact(computeImpactForLibrary(library)); | 365 resolutionEnqueuer.applyImpact(computeImpactForLibrary(library)); |
| 366 }); | 366 }); |
| 367 | 367 |
| 368 if (deferredLoadTask.isProgramSplit) { | 368 if (deferredLoadTask.isProgramSplit) { |
| 369 resolutionEnqueuer | 369 resolutionEnqueuer |
| 370 .applyImpact(backend.computeDeferredLoadingImpact()); | 370 .applyImpact(backend.computeDeferredLoadingImpact()); |
| 371 } | 371 } |
| 372 resolveLibraryMetadata(); | 372 resolveLibraryMetadata(); |
| 373 reporter.log('Resolving...'); | 373 reporter.log('Resolving...'); |
| 374 processQueue(resolutionEnqueuer, mainFunction, libraryLoader.libraries); | 374 processQueue(resolutionEnqueuer, mainFunction, libraryLoader.libraries); |
| 375 resolutionEnqueuer.logSummary(reporter.log); | 375 resolutionEnqueuer.logSummary(reporter.log); |
| 376 | 376 |
| 377 (reporter as CompilerDiagnosticReporter) | 377 (reporter as CompilerDiagnosticReporter) |
| 378 .reportSuppressedMessagesSummary(); | 378 .reportSuppressedMessagesSummary(); |
| 379 | 379 |
| 380 if (compilationFailed) { | 380 if (compilationFailed) { |
| 381 // TODO(sigmund): more diagnostics? | 381 // TODO(sigmund): more diagnostics? |
| 382 print('compilation failed!'); | 382 print('compilation failed!'); |
| 383 exit(1); | 383 exit(1); |
| 384 } | 384 } |
| 385 | 385 |
| 386 closeResolution(); | 386 closeResolution(); |
| 387 var program = (backend as dynamic).kernelTask.program; | 387 var program = (backend as dynamic).kernelTask.program; |
| 388 print('total libraries: ${program.libraries.length}'); | 388 print('total libraries: ${program.libraries.length}'); |
| 389 }); | 389 }); |
| 390 } | 390 } |
| OLD | NEW |