Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: pkg/front_end/lib/src/incremental/kernel_driver.dart

Issue 2980093002: Disable printing in kernel-driver (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:front_end/file_system.dart'; 7 import 'package:front_end/file_system.dart';
8 import 'package:front_end/src/base/api_signature.dart'; 8 import 'package:front_end/src/base/api_signature.dart';
9 import 'package:front_end/src/base/performace_logger.dart'; 9 import 'package:front_end/src/base/performace_logger.dart';
10 import 'package:front_end/src/fasta/compiler_command_line.dart';
11 import 'package:front_end/src/fasta/compiler_context.dart';
10 import 'package:front_end/src/fasta/dill/dill_library_builder.dart'; 12 import 'package:front_end/src/fasta/dill/dill_library_builder.dart';
11 import 'package:front_end/src/fasta/dill/dill_target.dart'; 13 import 'package:front_end/src/fasta/dill/dill_target.dart';
12 import 'package:front_end/src/fasta/kernel/kernel_target.dart'; 14 import 'package:front_end/src/fasta/kernel/kernel_target.dart';
13 import 'package:front_end/src/fasta/kernel/utils.dart'; 15 import 'package:front_end/src/fasta/kernel/utils.dart';
14 import 'package:front_end/src/fasta/ticker.dart'; 16 import 'package:front_end/src/fasta/ticker.dart';
15 import 'package:front_end/src/fasta/uri_translator.dart'; 17 import 'package:front_end/src/fasta/uri_translator.dart';
16 import 'package:front_end/src/incremental/byte_store.dart'; 18 import 'package:front_end/src/incremental/byte_store.dart';
17 import 'package:front_end/src/incremental/file_state.dart'; 19 import 'package:front_end/src/incremental/file_state.dart';
18 import 'package:kernel/binary/ast_from_binary.dart'; 20 import 'package:kernel/binary/ast_from_binary.dart';
19 import 'package:kernel/kernel.dart' hide Source; 21 import 'package:kernel/kernel.dart' hide Source;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 /// The [uri] must be absolute and normalized. 108 /// The [uri] must be absolute and normalized.
107 /// 109 ///
108 /// The driver will update the current file state for any file previously 110 /// The driver will update the current file state for any file previously
109 /// reported using [invalidate]. 111 /// reported using [invalidate].
110 /// 112 ///
111 /// If the driver has the cached result for the file with the current file 113 /// If the driver has the cached result for the file with the current file
112 /// state, it is returned. 114 /// state, it is returned.
113 /// 115 ///
114 /// Otherwise the driver will compute new kernel files and return them. 116 /// Otherwise the driver will compute new kernel files and return them.
115 Future<KernelResult> getKernel(Uri uri) async { 117 Future<KernelResult> getKernel(Uri uri) async {
116 return await _logger.runAsync('Compute delta', () async { 118 return await runWithFrontEndContext('Compute delta', () async {
117 await _refreshInvalidatedFiles(); 119 await _refreshInvalidatedFiles();
118 120
119 // Ensure that the graph starting at the entry point is ready. 121 // Ensure that the graph starting at the entry point is ready.
120 FileState entryLibrary = 122 FileState entryLibrary =
121 await _logger.runAsync('Build graph of files', () async { 123 await _logger.runAsync('Build graph of files', () async {
122 return await _fsState.getFile(uri); 124 return await _fsState.getFile(uri);
123 }); 125 });
124 126
125 List<LibraryCycle> cycles = _logger.run('Compute library cycles', () { 127 List<LibraryCycle> cycles = _logger.run('Compute library cycles', () {
126 List<LibraryCycle> cycles = entryLibrary.topologicalOrder; 128 List<LibraryCycle> cycles = entryLibrary.topologicalOrder;
(...skipping 12 matching lines...) Expand all
139 LibraryCycleResult result = 141 LibraryCycleResult result =
140 await _compileCycle(nameRoot, dillTarget, cycle); 142 await _compileCycle(nameRoot, dillTarget, cycle);
141 results.add(result); 143 results.add(result);
142 } 144 }
143 }); 145 });
144 146
145 return new KernelResult(nameRoot, results); 147 return new KernelResult(nameRoot, results);
146 }); 148 });
147 } 149 }
148 150
151 Future<T> runWithFrontEndContext<T>(String msg, Future<T> f()) async {
152 return await CompilerCommandLine.withGlobalOptions("", [""],
scheglov 2017/07/14 15:49:17 The name CompilerCommandLine does not make sense i
Siggi Cherem (dart-lang) 2017/07/14 16:34:04 Completely agree - this is exactly what I'm workin
153 (CompilerContext context) {
154 context.options.options["--target"] = _target;
155 context.options.options["report"] = (message, severity) {};
156 context.options.options["reportWithoutLocation"] = (message, severity) {};
157 return _logger.runAsync(msg, f);
158 });
159 }
160
149 /// The file with the given [uri] might have changed - updated, added, or 161 /// The file with the given [uri] might have changed - updated, added, or
150 /// removed. Or not, we don't know. Or it might have, but then changed back. 162 /// removed. Or not, we don't know. Or it might have, but then changed back.
151 /// 163 ///
152 /// The [uri] must be absolute and normalized file URI. 164 /// The [uri] must be absolute and normalized file URI.
153 /// 165 ///
154 /// Schedules the file contents for the [uri] to be read into the current 166 /// Schedules the file contents for the [uri] to be read into the current
155 /// file state prior the next invocation of [getKernel] returns the result. 167 /// file state prior the next invocation of [getKernel] returns the result.
156 /// 168 ///
157 /// Invocation of this method will not prevent a [Future] returned from 169 /// Invocation of this method will not prevent a [Future] returned from
158 /// [getKernel] from completing with a result, but the result is not 170 /// [getKernel] from completing with a result, but the result is not
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 369
358 LibraryCycleResult(this.cycle, this.signature, this.kernelLibraries); 370 LibraryCycleResult(this.cycle, this.signature, this.kernelLibraries);
359 } 371 }
360 372
361 @visibleForTesting 373 @visibleForTesting
362 class _TestView { 374 class _TestView {
363 /// The list of [LibraryCycle]s compiled for the last delta. 375 /// The list of [LibraryCycle]s compiled for the last delta.
364 /// It does not include libraries which were read from the cache. 376 /// It does not include libraries which were read from the cache.
365 final List<LibraryCycle> compiledCycles = []; 377 final List<LibraryCycle> compiledCycles = [];
366 } 378 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698