Chromium Code Reviews| 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; | 9 import 'dart:io' show exit; |
| 10 | 10 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 {bool useSdkSummary: false, bool compileSdk: true}) async { | 108 {bool useSdkSummary: false, bool compileSdk: true}) async { |
| 109 // TODO(sigmund): this is here only to compute the input size, | 109 // TODO(sigmund): this is here only to compute the input size, |
| 110 // we should extract the input size from the frontend instead. | 110 // we should extract the input size from the frontend instead. |
| 111 scanReachableFiles(entryUri); | 111 scanReachableFiles(entryUri); |
| 112 | 112 |
| 113 var dartkTimer = new Stopwatch()..start(); | 113 var dartkTimer = new Stopwatch()..start(); |
| 114 // TODO(sigmund): add a constructor with named args to compiler options. | 114 // TODO(sigmund): add a constructor with named args to compiler options. |
| 115 var options = new CompilerOptions() | 115 var options = new CompilerOptions() |
| 116 ..strongMode = false | 116 ..strongMode = false |
| 117 ..compileSdk = compileSdk | 117 ..compileSdk = compileSdk |
| 118 ..packagesFilePath = '.packages' | 118 ..packagesFileUri = new Uri.file('.packages') |
|
Siggi Cherem (dart-lang)
2017/01/11 22:59:53
probably doesn't matter, but another option here w
Paul Berry
2017/01/12 23:10:04
One of the goals of the FileSystem abstraction is
| |
| 119 ..onError = ((e) => print('${e.message}')); | 119 ..onError = ((e) => print('${e.message}')); |
| 120 if (useSdkSummary) { | 120 if (useSdkSummary) { |
| 121 // TODO(sigmund): adjust path based on the benchmark runner architecture. | 121 // TODO(sigmund): adjust path based on the benchmark runner architecture. |
| 122 // Possibly let the runner make the file available at an architecture | 122 // Possibly let the runner make the file available at an architecture |
| 123 // independent location. | 123 // independent location. |
| 124 options.sdkSummary = 'out/ReleaseX64/dart-sdk/lib/_internal/spec.sum'; | 124 options.sdkSummary = |
| 125 new Uri.file('out/ReleaseX64/dart-sdk/lib/_internal/spec.sum'); | |
| 125 } else { | 126 } else { |
| 126 options.sdkPath = 'sdk'; | 127 options.sdkRoot = new Uri.file('sdk'); |
| 127 } | 128 } |
| 128 Program program = await kernelForProgram(entryUri, options); | 129 Program program = await kernelForProgram(entryUri, options); |
| 129 dartkTimer.stop(); | 130 dartkTimer.stop(); |
| 130 var suffix = useSdkSummary ? '_sum' : ''; | 131 var suffix = useSdkSummary ? '_sum' : ''; |
| 131 report('kernel_gen_e2e${suffix}', dartkTimer.elapsedMicroseconds); | 132 report('kernel_gen_e2e${suffix}', dartkTimer.elapsedMicroseconds); |
| 132 return program; | 133 return program; |
| 133 } | 134 } |
| 134 | 135 |
| 135 /// Generates unlinkmed summaries for all files in [files], and returns them in | 136 /// Generates unlinkmed summaries for all files in [files], and returns them in |
| 136 /// an [_UnlinkedSummaries] container. | 137 /// an [_UnlinkedSummaries] container. |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 class _Scanner extends Scanner { | 340 class _Scanner extends Scanner { |
| 340 _Scanner(String contents) : super(new CharSequenceReader(contents)) { | 341 _Scanner(String contents) : super(new CharSequenceReader(contents)) { |
| 341 preserveComments = false; | 342 preserveComments = false; |
| 342 } | 343 } |
| 343 | 344 |
| 344 @override | 345 @override |
| 345 void reportError(errorCode, int offset, List<Object> arguments) { | 346 void reportError(errorCode, int offset, List<Object> arguments) { |
| 346 // ignore errors. | 347 // ignore errors. |
| 347 } | 348 } |
| 348 } | 349 } |
| OLD | NEW |