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 part of dart2js_incremental; | 5 part of dart2js_incremental; |
6 | 6 |
7 /// Do not call this method directly. It will be made private. | 7 /// Do not call this method directly. It will be made private. |
8 // TODO(ahe): Make this method private. | 8 // TODO(ahe): Make this method private. |
9 Compiler reuseCompiler( | 9 Compiler reuseCompiler( |
10 {DiagnosticHandler diagnosticHandler, | 10 {DiagnosticHandler diagnosticHandler, |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 if (environment == null) { | 32 if (environment == null) { |
33 environment = {}; | 33 environment = {}; |
34 } | 34 } |
35 Compiler compiler = cachedCompiler; | 35 Compiler compiler = cachedCompiler; |
36 if (compiler == null || | 36 if (compiler == null || |
37 compiler.libraryRoot != libraryRoot || | 37 compiler.libraryRoot != libraryRoot || |
38 !compiler.hasIncrementalSupport || | 38 !compiler.hasIncrementalSupport || |
39 compiler.hasCrashed || | 39 compiler.hasCrashed || |
40 compiler.compilerWasCancelled || | 40 compiler.compilerWasCancelled || |
41 compiler.enqueuer.resolution.hasEnqueuedEverything || | 41 compiler.enqueuer.resolution.hasEnqueuedReflectiveElements || |
42 compiler.deferredLoadTask.splitProgram) { | 42 compiler.deferredLoadTask.splitProgram) { |
43 if (compiler != null && compiler.hasIncrementalSupport) { | 43 if (compiler != null && compiler.hasIncrementalSupport) { |
44 print('***FLUSH***'); | 44 print('***FLUSH***'); |
45 if (compiler.hasCrashed) { | 45 if (compiler.hasCrashed) { |
46 print('Unable to reuse compiler due to crash.'); | 46 print('Unable to reuse compiler due to crash.'); |
47 } else if (compiler.compilerWasCancelled) { | 47 } else if (compiler.compilerWasCancelled) { |
48 print('Unable to reuse compiler due to cancel.'); | 48 print('Unable to reuse compiler due to cancel.'); |
49 } else if (compiler.enqueuer.resolution.hasEnqueuedEverything) { | 49 } else if (compiler.enqueuer.resolution.hasEnqueuedReflectiveElements) { |
50 print('Unable to reuse compiler due to dart:mirrors.'); | 50 print('Unable to reuse compiler due to dart:mirrors.'); |
51 } else if (compiler.deferredLoadTask.splitProgram) { | 51 } else if (compiler.deferredLoadTask.splitProgram) { |
52 print('Unable to reuse compiler due to deferred loading.'); | 52 print('Unable to reuse compiler due to deferred loading.'); |
53 } else { | 53 } else { |
54 print('Unable to reuse compiler.'); | 54 print('Unable to reuse compiler.'); |
55 } | 55 } |
56 } | 56 } |
57 compiler = new Compiler( | 57 compiler = new Compiler( |
58 inputProvider, | 58 inputProvider, |
59 outputProvider, | 59 outputProvider, |
60 diagnosticHandler, | 60 diagnosticHandler, |
61 libraryRoot, | 61 libraryRoot, |
62 packageRoot, | 62 packageRoot, |
63 options, | 63 options, |
64 environment); | 64 environment); |
65 } else { | 65 } else { |
66 compiler | 66 compiler |
67 ..outputProvider = outputProvider | 67 ..outputProvider = outputProvider |
68 ..provider = inputProvider | 68 ..provider = inputProvider |
69 ..handler = diagnosticHandler | 69 ..handler = diagnosticHandler |
70 ..enqueuer.resolution.queueIsClosed = false | 70 ..enqueuer.resolution.queueIsClosed = false |
71 ..enqueuer.resolution.hasEnqueuedEverything = false | 71 ..enqueuer.resolution.hasEnqueuedReflectiveElements = false |
72 ..enqueuer.resolution.hasEnqueuedReflectiveStaticFields = false | 72 ..enqueuer.resolution.hasEnqueuedReflectiveStaticFields = false |
73 ..enqueuer.codegen.queueIsClosed = false | 73 ..enqueuer.codegen.queueIsClosed = false |
74 ..enqueuer.codegen.hasEnqueuedEverything = false | 74 ..enqueuer.codegen.hasEnqueuedReflectiveElements = false |
75 ..enqueuer.codegen.hasEnqueuedReflectiveStaticFields = false | 75 ..enqueuer.codegen.hasEnqueuedReflectiveStaticFields = false |
76 ..assembledCode = null | 76 ..assembledCode = null |
77 ..compilationFailed = false; | 77 ..compilationFailed = false; |
78 JavaScriptBackend backend = compiler.backend; | 78 JavaScriptBackend backend = compiler.backend; |
79 | 79 |
80 backend.emitter.cachedElements.addAll(backend.generatedCode.keys); | 80 backend.emitter.cachedElements.addAll(backend.generatedCode.keys); |
81 | 81 |
82 compiler.enqueuer.codegen.newlyEnqueuedElements.clear(); | 82 compiler.enqueuer.codegen.newlyEnqueuedElements.clear(); |
83 | 83 |
84 backend.emitter.containerBuilder | 84 backend.emitter.containerBuilder |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 ..preMirrorsMethodCount = 0; | 131 ..preMirrorsMethodCount = 0; |
132 | 132 |
133 compiler.libraryLoader.reset(reuseLibrary: (LibraryElement library) { | 133 compiler.libraryLoader.reset(reuseLibrary: (LibraryElement library) { |
134 return library.isPlatformLibrary || | 134 return library.isPlatformLibrary || |
135 (packagesAreImmutable && library.isPackageLibrary); | 135 (packagesAreImmutable && library.isPackageLibrary); |
136 }); | 136 }); |
137 } | 137 } |
138 oldTag.makeCurrent(); | 138 oldTag.makeCurrent(); |
139 return compiler; | 139 return compiler; |
140 } | 140 } |
OLD | NEW |