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

Unified Diff: dart/site/try/src/caching_compiler.dart

Issue 344203004: Improve incremental compilation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address Kasper's comments. Created 6 years, 6 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/site/try/src/compilation.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/site/try/src/caching_compiler.dart
diff --git a/dart/site/try/src/caching_compiler.dart b/dart/site/try/src/caching_compiler.dart
index affa4acbf01343f6c5287ead20b12fc1d398bd81..2228b99926f9f151a24f78affaade78fb3446f4f 100644
--- a/dart/site/try/src/caching_compiler.dart
+++ b/dart/site/try/src/caching_compiler.dart
@@ -4,7 +4,8 @@
library trydart.caching_compiler;
-import 'dart:async' show EventSink;
+import 'dart:profiler' show
+ UserTag;
import 'package:compiler/compiler.dart' show
CompilerInputProvider,
@@ -25,6 +26,8 @@ import 'package:compiler/implementation/js_backend/js_backend.dart' show
import 'package:compiler/implementation/elements/elements.dart' show
LibraryElement;
+import 'package:compiler/implementation/native_handler.dart' as native;
+
void clearLibraryLoader(LibraryLoaderTask libraryLoader) {
// TODO(ahe): Move this method to [LibraryLoader].
libraryLoader
@@ -50,7 +53,9 @@ Compiler reuseCompiler(
List<String> options: const [],
Compiler cachedCompiler,
Uri libraryRoot,
- Uri packageRoot}) {
+ Uri packageRoot,
+ bool packagesAreImmutable: false}) {
+ UserTag oldTag = new UserTag('reuseCompiler').makeCurrent();
if (libraryRoot == null) {
throw 'Missing libraryRoot';
}
@@ -64,7 +69,26 @@ Compiler reuseCompiler(
outputProvider = NullSink.outputProvider;
}
Compiler compiler = cachedCompiler;
- if (compiler == null || compiler.libraryRoot != libraryRoot) {
+ if (compiler == null ||
+ compiler.libraryRoot != libraryRoot ||
+ compiler.hasCrashed ||
+ compiler.compilerWasCancelled ||
+ compiler.enqueuer.resolution.hasEnqueuedEverything ||
+ compiler.deferredLoadTask.splitProgram) {
+ if (compiler != null) {
+ print('***FLUSH***');
+ if (compiler.hasCrashed) {
+ print('Unable to reuse compiler due to crash.');
+ } else if (compiler.compilerWasCancelled) {
+ print('Unable to reuse compiler due to cancel.');
+ } else if (compiler.enqueuer.resolution.hasEnqueuedEverything) {
+ print('Unable to reuse compiler due to dart:mirrors.');
+ } else if (compiler.deferredLoadTask.splitProgram) {
+ print('Unable to reuse compiler due to deferred loading.');
+ } else {
+ print('Unable to reuse compiler.');
+ }
+ }
compiler = new Compiler(
inputProvider,
outputProvider,
@@ -79,11 +103,19 @@ Compiler reuseCompiler(
..provider = inputProvider
..handler = diagnosticHandler
..enqueuer.resolution.queueIsClosed = false
+ ..enqueuer.resolution.hasEnqueuedEverything = false
+ ..enqueuer.resolution.hasEnqueuedReflectiveStaticFields = false
..enqueuer.codegen.queueIsClosed = false
+ ..enqueuer.codegen.hasEnqueuedEverything = false
+ ..enqueuer.codegen.hasEnqueuedReflectiveStaticFields = false
..assembledCode = null
..compilationFailed = false;
JavaScriptBackend backend = compiler.backend;
+ backend.emitter.cachedElements.addAll(backend.generatedCode.keys);
+
+ compiler.enqueuer.codegen.newlyEnqueuedElements.clear();
+
backend.emitter.containerBuilder
..staticGetters.clear()
..methodClosures.clear();
@@ -112,9 +144,6 @@ Compiler reuseCompiler(
..nativeMethods.clear();
backend.emitter
- ..needsDefineClass = false
- ..needsMixinSupport = false
- ..needsLazyInitializer = false
..outputBuffers.clear()
..deferredConstants.clear()
..isolateProperties = null
@@ -140,11 +169,13 @@ Compiler reuseCompiler(
compiler.libraries.clear();
clearLibraryLoader(compiler.libraryLoader);
libraries.forEach((String uri, LibraryElement library) {
- if (library.isPlatformLibrary) {
+ if (library.isPlatformLibrary ||
+ (packagesAreImmutable && library.isPackageLibrary)) {
compiler.libraries[uri] = library;
reuseLibrary(compiler.libraryLoader, library);
}
});
}
+ oldTag.makeCurrent();
return compiler;
}
« no previous file with comments | « no previous file | dart/site/try/src/compilation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698