OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 js_backend; | 5 part of js_backend; |
6 | 6 |
7 const VERBOSE_OPTIMIZER_HINTS = false; | 7 const VERBOSE_OPTIMIZER_HINTS = false; |
8 | 8 |
9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); | 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); |
10 | 10 |
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2148 return staticFields; | 2148 return staticFields; |
2149 } | 2149 } |
2150 | 2150 |
2151 /// Called when [enqueuer] is empty, but before it is closed. | 2151 /// Called when [enqueuer] is empty, but before it is closed. |
2152 bool onQueueEmpty(Enqueuer enqueuer, Iterable<ClassElement> recentClasses) { | 2152 bool onQueueEmpty(Enqueuer enqueuer, Iterable<ClassElement> recentClasses) { |
2153 // Add elements referenced only via custom elements. Return early if any | 2153 // Add elements referenced only via custom elements. Return early if any |
2154 // elements are added to avoid counting the elements as due to mirrors. | 2154 // elements are added to avoid counting the elements as due to mirrors. |
2155 customElementsAnalysis.onQueueEmpty(enqueuer); | 2155 customElementsAnalysis.onQueueEmpty(enqueuer); |
2156 if (!enqueuer.queueIsEmpty) return false; | 2156 if (!enqueuer.queueIsEmpty) return false; |
2157 | 2157 |
| 2158 if (compiler.hasIncrementalSupport) { |
| 2159 // Always enable tear-off closures during incremental compilation. |
| 2160 Element e = findHelper('closureFromTearOff'); |
| 2161 if (e != null && !enqueuer.isProcessed(e)) { |
| 2162 registerBackendUse(e); |
| 2163 enqueuer.addToWorkList(e); |
| 2164 } |
| 2165 } |
| 2166 |
2158 if (!enqueuer.isResolutionQueue && preMirrorsMethodCount == 0) { | 2167 if (!enqueuer.isResolutionQueue && preMirrorsMethodCount == 0) { |
2159 preMirrorsMethodCount = generatedCode.length; | 2168 preMirrorsMethodCount = generatedCode.length; |
2160 } | 2169 } |
2161 | 2170 |
2162 if (isTreeShakingDisabled) { | 2171 if (isTreeShakingDisabled) { |
2163 enqueuer.enqueueReflectiveElements(recentClasses); | 2172 enqueuer.enqueueReflectiveElements(recentClasses); |
2164 } else if (!targetsUsed.isEmpty && enqueuer.isResolutionQueue) { | 2173 } else if (!targetsUsed.isEmpty && enqueuer.isResolutionQueue) { |
2165 // Add all static elements (not classes) that have been requested for | 2174 // Add all static elements (not classes) that have been requested for |
2166 // reflection. If there is no mirror-usage these are probably not | 2175 // reflection. If there is no mirror-usage these are probably not |
2167 // necessary, but the backend relies on them being resolved. | 2176 // necessary, but the backend relies on them being resolved. |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2467 } | 2476 } |
2468 } | 2477 } |
2469 | 2478 |
2470 /// Records that [constant] is used by the element behind [registry]. | 2479 /// Records that [constant] is used by the element behind [registry]. |
2471 class Dependency { | 2480 class Dependency { |
2472 final ConstantValue constant; | 2481 final ConstantValue constant; |
2473 final Element annotatedElement; | 2482 final Element annotatedElement; |
2474 | 2483 |
2475 const Dependency(this.constant, this.annotatedElement); | 2484 const Dependency(this.constant, this.annotatedElement); |
2476 } | 2485 } |
OLD | NEW |