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

Side by Side Diff: pkg/front_end/lib/src/incremental_kernel_generator_impl.dart

Issue 2893563003: Rename buildOutline() and separate 'build' and 'writeProgram()'. (Closed)
Patch Set: Created 3 years, 7 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 | « pkg/front_end/lib/src/fasta/target.dart ('k') | pkg/front_end/test/fasta/testing/suite.dart » ('j') | 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 import 'dart:io'; 6 import 'dart:io';
7 7
8 import 'package:front_end/file_system.dart'; 8 import 'package:front_end/file_system.dart';
9 import 'package:front_end/incremental_kernel_generator.dart'; 9 import 'package:front_end/incremental_kernel_generator.dart';
10 import 'package:front_end/incremental_resolved_ast_generator.dart'; 10 import 'package:front_end/incremental_resolved_ast_generator.dart';
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 Uri uri = library.uri; 166 Uri uri = library.uri;
167 libraryUris.add(uri); 167 libraryUris.add(uri);
168 libraryUriToFile[uri] = library; 168 libraryUriToFile[uri] = library;
169 } 169 }
170 170
171 Future<Null> appendNewDillLibraries(Program program) async { 171 Future<Null> appendNewDillLibraries(Program program) async {
172 List<DillLibraryBuilder> libraryBuilders = dillTarget.loader 172 List<DillLibraryBuilder> libraryBuilders = dillTarget.loader
173 .appendLibraries(program, (uri) => libraryUris.contains(uri)); 173 .appendLibraries(program, (uri) => libraryUris.contains(uri));
174 174
175 // Compute local scopes. 175 // Compute local scopes.
176 await dillTarget.computeOutline(); 176 await dillTarget.buildOutlines();
177 177
178 // Compute export scopes. 178 // Compute export scopes.
179 _computeExportScopes(dillTarget, libraryUriToFile, libraryBuilders); 179 _computeExportScopes(dillTarget, libraryUriToFile, libraryBuilders);
180 } 180 }
181 181
182 // Check if there is already a bundle with these libraries. 182 // Check if there is already a bundle with these libraries.
183 List<int> bytes = _byteStore.get(kernelKey); 183 List<int> bytes = _byteStore.get(kernelKey);
184 if (bytes != null) { 184 if (bytes != null) {
185 return _logger.runAsync('Read serialized libraries', () async { 185 return _logger.runAsync('Read serialized libraries', () async {
186 var program = new Program(nameRoot: nameRoot); 186 var program = new Program(nameRoot: nameRoot);
187 var reader = new BinaryBuilder(bytes); 187 var reader = new BinaryBuilder(bytes);
188 reader.readProgram(program); 188 reader.readProgram(program);
189 189
190 await appendNewDillLibraries(program); 190 await appendNewDillLibraries(program);
191 191
192 return new _LibraryCycleResult(cycle, signature, program.libraries); 192 return new _LibraryCycleResult(cycle, signature, program.libraries);
193 }); 193 });
194 } 194 }
195 195
196 // Create KernelTarget and configure it for compiling the cycle URIs. 196 // Create KernelTarget and configure it for compiling the cycle URIs.
197 KernelTarget kernelTarget = new KernelTarget(_fsState.fileSystemView, 197 KernelTarget kernelTarget = new KernelTarget(_fsState.fileSystemView,
198 dillTarget, _uriTranslator, _options.strongMode); 198 dillTarget, _uriTranslator, _options.strongMode);
199 for (FileState library in cycle.libraries) { 199 for (FileState library in cycle.libraries) {
200 kernelTarget.read(library.uri); 200 kernelTarget.read(library.uri);
201 } 201 }
202 202
203 // Compile the cycle libraries into a new full program. 203 // Compile the cycle libraries into a new full program.
204 Program program = await _logger 204 Program program = await _logger
205 .runAsync('Compile ${cycle.libraries.length} libraries', () async { 205 .runAsync('Compile ${cycle.libraries.length} libraries', () async {
206 await kernelTarget.computeOutline(nameRoot: nameRoot); 206 await kernelTarget.buildOutlines(nameRoot: nameRoot);
207 return await kernelTarget.writeProgram(null); 207 return await kernelTarget.buildProgram();
208 }); 208 });
209 209
210 // Add newly compiled libraries into DILL. 210 // Add newly compiled libraries into DILL.
211 await appendNewDillLibraries(program); 211 await appendNewDillLibraries(program);
212 212
213 List<Library> kernelLibraries = program.libraries 213 List<Library> kernelLibraries = program.libraries
214 .where((library) => libraryUris.contains(library.importUri)) 214 .where((library) => libraryUris.contains(library.importUri))
215 .toList(); 215 .toList();
216 216
217 _logger.run('Serialize ${kernelLibraries.length} libraries', () { 217 _logger.run('Serialize ${kernelLibraries.length} libraries', () {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 /// TODO(scheglov) Use API signatures. 284 /// TODO(scheglov) Use API signatures.
285 /// TODO(scheglov) Or use tree shaking and compute signatures of outlines. 285 /// TODO(scheglov) Or use tree shaking and compute signatures of outlines.
286 final String signature; 286 final String signature;
287 287
288 /// Kernel libraries for libraries in the [cycle]. Bodies of dependencies 288 /// Kernel libraries for libraries in the [cycle]. Bodies of dependencies
289 /// are not included, but but references to those dependencies are included. 289 /// are not included, but but references to those dependencies are included.
290 final List<Library> kernelLibraries; 290 final List<Library> kernelLibraries;
291 291
292 _LibraryCycleResult(this.cycle, this.signature, this.kernelLibraries); 292 _LibraryCycleResult(this.cycle, this.signature, this.kernelLibraries);
293 } 293 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/target.dart ('k') | pkg/front_end/test/fasta/testing/suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698