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 front_end and measure its performance. | 5 /// An entrypoint used to run portions of front_end and measure its performance. |
6 library front_end.tool.perf; | 6 library front_end.tool.perf; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:io' show exit, stderr; | 9 import 'dart:io' show exit, stderr; |
10 | 10 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 // TODO(sigmund): replace this once kernel is produced by the frontend directly. | 235 // TODO(sigmund): replace this once kernel is produced by the frontend directly. |
236 Future<Program> generateKernel(Uri entryUri) async { | 236 Future<Program> generateKernel(Uri entryUri) async { |
237 var dartkTimer = new Stopwatch()..start(); | 237 var dartkTimer = new Stopwatch()..start(); |
238 var options = new DartOptions(strongMode: false, sdk: 'sdk'); | 238 var options = new DartOptions(strongMode: false, sdk: 'sdk'); |
239 var packages = | 239 var packages = |
240 await createPackages(options.packagePath, discoveryPath: entryUri.path); | 240 await createPackages(options.packagePath, discoveryPath: entryUri.path); |
241 var repository = new Repository(); | 241 var repository = new Repository(); |
242 DartLoader loader = new DartLoader(repository, options, packages); | 242 DartLoader loader = new DartLoader(repository, options, packages); |
243 | 243 |
244 Program program = loader.loadProgram(entryUri.path); | 244 Program program = loader.loadProgram(entryUri); |
245 List errors = loader.errors; | 245 List errors = loader.errors; |
246 if (errors.isNotEmpty) { | 246 if (errors.isNotEmpty) { |
247 const int errorLimit = 100; | 247 const int errorLimit = 100; |
248 stderr.writeln(errors.take(errorLimit).join('\n')); | 248 stderr.writeln(errors.take(errorLimit).join('\n')); |
249 if (errors.length > errorLimit) { | 249 if (errors.length > errorLimit) { |
250 stderr.writeln('[error] ${errors.length - errorLimit} errors not shown'); | 250 stderr.writeln('[error] ${errors.length - errorLimit} errors not shown'); |
251 } | 251 } |
252 } | 252 } |
253 dartkTimer.stop(); | 253 dartkTimer.stop(); |
254 report("kernel_gen_e2e", dartkTimer.elapsedMicroseconds); | 254 report("kernel_gen_e2e", dartkTimer.elapsedMicroseconds); |
255 return program; | 255 return program; |
256 } | 256 } |
OLD | NEW |