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

Unified Diff: pkg/front_end/lib/src/incremental/kernel_driver.dart

Issue 2993093003: Add support for SDK outline in KernelDriver. (Closed)
Patch Set: Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/incremental/kernel_driver.dart
diff --git a/pkg/front_end/lib/src/incremental/kernel_driver.dart b/pkg/front_end/lib/src/incremental/kernel_driver.dart
index 60984505d48cbf7838c97c7823ef1902ee358d8c..a9f71a7831410e96c1bcb81b8a3dccbff5e47866 100644
--- a/pkg/front_end/lib/src/incremental/kernel_driver.dart
+++ b/pkg/front_end/lib/src/incremental/kernel_driver.dart
@@ -51,6 +51,10 @@ class KernelDriver {
/// Options used by the kernel compiler.
final ProcessedOptions _options;
+ /// The optional SDK outline as a serialized program.
+ /// If provided, the driver will not attempt to read SDK files.
+ final List<int> _sdkOutlineBytes;
+
/// The logger to report compilation progress.
final PerformanceLog _logger;
@@ -68,6 +72,10 @@ class KernelDriver {
/// reading the file contents.
final KernelDriverFileAddedFn _fileAddedFn;
+ /// The optional SDK outline loaded from [_sdkOutlineBytes].
+ /// Might be `null` if the byte are not provided, or if not loaded yet.
+ Program _sdkOutline;
+
/// The salt to mix into all hashes used as keys for serialized data.
List<int> _salt;
@@ -82,10 +90,11 @@ class KernelDriver {
final _TestView _testView = new _TestView();
KernelDriver(this._options, this._uriTranslator,
- {KernelDriverFileAddedFn fileAddedFn})
+ {List<int> sdkOutlineBytes, KernelDriverFileAddedFn fileAddedFn})
: _logger = _options.logger,
_fileSystem = _options.fileSystem,
_byteStore = _options.byteStore,
+ _sdkOutlineBytes = sdkOutlineBytes,
_fileAddedFn = fileAddedFn {
_computeSalt();
@@ -122,6 +131,10 @@ class KernelDriver {
return await runWithFrontEndContext('Compute delta', () async {
await _refreshInvalidatedFiles();
+ // Load the SDK outline before building the graph, so that the file
+ // system state is configured to skip SDK libraries.
+ await _loadSdkOutline();
+
// Ensure that the graph starting at the entry point is ready.
FileState entryLibrary =
await _logger.runAsync('Build graph of files', () async {
@@ -138,6 +151,12 @@ class KernelDriver {
DillTarget dillTarget = new DillTarget(
new Ticker(isVerbose: false), _uriTranslator, _options.target);
+ // If there is SDK outline, load it.
+ if (_sdkOutline != null) {
+ dillTarget.loader.appendLibraries(_sdkOutline);
+ await dillTarget.buildOutlines();
+ }
+
List<LibraryCycleResult> results = [];
_testView.compiledCycles.clear();
await _logger.runAsync('Compute results for cycles', () async {
@@ -297,6 +316,9 @@ class KernelDriver {
var saltBuilder = new ApiSignature();
saltBuilder.addInt(DATA_VERSION);
saltBuilder.addBool(_options.strongMode);
+ if (_sdkOutlineBytes != null) {
+ saltBuilder.addBytes(_sdkOutlineBytes);
+ }
_salt = saltBuilder.toByteList();
}
@@ -335,6 +357,20 @@ class KernelDriver {
return signatureBuilder.toHex();
}
+ /// Load the SDK outline if its bytes are provided, and configure the file
+ /// system state to skip SDK library files.
+ Future<Null> _loadSdkOutline() async {
+ if (_sdkOutlineBytes != null) {
+ if (_sdkOutline == null) {
+ await _logger.runAsync('Load SDK outline from bytes.', () async {
+ _sdkOutline = new Program();
+ new BinaryBuilder(_sdkOutlineBytes).readProgram(_sdkOutline);
+ _fsState.skipSdkLibraries = true;
Siggi Cherem (dart-lang) 2017/08/05 03:22:47 if we track which libraries to skip, then I was th
scheglov 2017/08/06 21:04:06 ACK, I will make the change if we will find out th
+ });
+ }
+ }
+ }
+
/// Refresh all the invalidated files and update dependencies.
Future<Null> _refreshInvalidatedFiles() async {
await _logger.runAsync('Refresh invalidated files', () async {

Powered by Google App Engine
This is Rietveld 408576698