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

Unified Diff: dart/pkg/dart2js_incremental/lib/dart2js_incremental.dart

Issue 641143002: Perform incremental compilation, and run the updated program. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r41074. Created 6 years, 2 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
« no previous file with comments | « no previous file | dart/pkg/dart2js_incremental/lib/library_updater.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/pkg/dart2js_incremental/lib/dart2js_incremental.dart
diff --git a/dart/pkg/dart2js_incremental/lib/dart2js_incremental.dart b/dart/pkg/dart2js_incremental/lib/dart2js_incremental.dart
index ddaa79d70c6de53357fa7ef46f60a00402a7e75c..b450c22dd90eecc8a74a8513314723de698f51ae 100644
--- a/dart/pkg/dart2js_incremental/lib/dart2js_incremental.dart
+++ b/dart/pkg/dart2js_incremental/lib/dart2js_incremental.dart
@@ -28,6 +28,10 @@ import 'package:compiler/implementation/js_backend/js_backend.dart' show
import 'package:compiler/implementation/elements/elements.dart' show
LibraryElement;
+import 'library_updater.dart' show
+ LibraryUpdater,
+ Logger;
+
part 'caching_compiler.dart';
const List<String> INCREMENTAL_OPTIONS = const <String>[
@@ -69,10 +73,18 @@ class IncrementalCompiler {
}
Future<bool> compile(Uri script) {
+ return _reuseCompiler(null).then((Compiler compiler) {
+ _compiler = compiler;
+ return compiler.run(script);
+ });
+ }
+
+ Future<Compiler> _reuseCompiler(
+ Future<bool> reuseLibrary(LibraryElement library)) {
List<String> options = this.options == null
? <String> [] : new List<String>.from(this.options);
options.addAll(INCREMENTAL_OPTIONS);
- Future<Compiler> future = reuseCompiler(
+ return reuseCompiler(
cachedCompiler: _compiler,
libraryRoot: libraryRoot,
packageRoot: packageRoot,
@@ -80,10 +92,38 @@ class IncrementalCompiler {
diagnosticHandler: diagnosticHandler,
options: options,
outputProvider: outputProvider,
- environment: environment);
+ environment: environment,
+ reuseLibrary: reuseLibrary);
+ }
+
+ Future<String> compileUpdates(
+ Map<Uri, Uri> updatedFiles,
+ {Logger logTime,
+ Logger logVerbose}) {
+ if (logTime == null) {
+ logTime = (_) {};
+ }
+ if (logVerbose == null) {
+ logVerbose = (_) {};
+ }
+ Future mappingInputProvider(Uri uri) {
+ Uri updatedFile = updatedFiles[uri];
+ return inputProvider(updatedFile == null ? uri : updatedFile);
+ }
+ LibraryUpdater updater = new LibraryUpdater(
+ _compiler,
+ mappingInputProvider,
+ _compiler.mainApp.canonicalUri,
+ logTime,
+ logVerbose);
+ Future<Compiler> future = _reuseCompiler(updater.reuseLibrary);
return future.then((Compiler compiler) {
_compiler = compiler;
- return compiler.run(script);
+ if (compiler.compilationFailed) {
+ return null;
+ } else {
+ return updater.computeUpdateJs();
+ }
});
}
}
« no previous file with comments | « no previous file | dart/pkg/dart2js_incremental/lib/library_updater.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698