OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library trydart.caching_compiler; | 5 library trydart.caching_compiler; |
6 | 6 |
7 import 'dart:profiler' show | 7 import 'dart:profiler' show |
8 UserTag; | 8 UserTag; |
9 | 9 |
10 import 'package:compiler/compiler.dart' show | 10 import 'package:compiler/compiler.dart' show |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 } | 62 } |
63 if (diagnosticHandler == null) { | 63 if (diagnosticHandler == null) { |
64 throw 'Missing diagnosticHandler'; | 64 throw 'Missing diagnosticHandler'; |
65 } | 65 } |
66 if (outputProvider == null) { | 66 if (outputProvider == null) { |
67 outputProvider = NullSink.outputProvider; | 67 outputProvider = NullSink.outputProvider; |
68 } | 68 } |
69 Compiler compiler = cachedCompiler; | 69 Compiler compiler = cachedCompiler; |
70 if (compiler == null || | 70 if (compiler == null || |
71 compiler.libraryRoot != libraryRoot || | 71 compiler.libraryRoot != libraryRoot || |
| 72 !compiler.hasIncrementalSupport || |
72 compiler.hasCrashed || | 73 compiler.hasCrashed || |
73 compiler.compilerWasCancelled || | 74 compiler.compilerWasCancelled || |
74 compiler.enqueuer.resolution.hasEnqueuedEverything || | 75 compiler.enqueuer.resolution.hasEnqueuedEverything || |
75 compiler.deferredLoadTask.splitProgram) { | 76 compiler.deferredLoadTask.splitProgram) { |
76 if (compiler != null) { | 77 if (compiler != null && compiler.hasIncrementalSupport) { |
77 print('***FLUSH***'); | 78 print('***FLUSH***'); |
78 if (compiler.hasCrashed) { | 79 if (compiler.hasCrashed) { |
79 print('Unable to reuse compiler due to crash.'); | 80 print('Unable to reuse compiler due to crash.'); |
80 } else if (compiler.compilerWasCancelled) { | 81 } else if (compiler.compilerWasCancelled) { |
81 print('Unable to reuse compiler due to cancel.'); | 82 print('Unable to reuse compiler due to cancel.'); |
82 } else if (compiler.enqueuer.resolution.hasEnqueuedEverything) { | 83 } else if (compiler.enqueuer.resolution.hasEnqueuedEverything) { |
83 print('Unable to reuse compiler due to dart:mirrors.'); | 84 print('Unable to reuse compiler due to dart:mirrors.'); |
84 } else if (compiler.deferredLoadTask.splitProgram) { | 85 } else if (compiler.deferredLoadTask.splitProgram) { |
85 print('Unable to reuse compiler due to deferred loading.'); | 86 print('Unable to reuse compiler due to deferred loading.'); |
86 } else { | 87 } else { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 if (library.isPlatformLibrary || | 171 if (library.isPlatformLibrary || |
171 (packagesAreImmutable && library.isPackageLibrary)) { | 172 (packagesAreImmutable && library.isPackageLibrary)) { |
172 compiler.libraries[uri] = library; | 173 compiler.libraries[uri] = library; |
173 reuseLibrary(compiler.libraryLoader, library); | 174 reuseLibrary(compiler.libraryLoader, library); |
174 } | 175 } |
175 }); | 176 }); |
176 } | 177 } |
177 oldTag.makeCurrent(); | 178 oldTag.makeCurrent(); |
178 return compiler; | 179 return compiler; |
179 } | 180 } |
OLD | NEW |