| 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 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2177 return staticFields; | 2177 return staticFields; |
| 2178 } | 2178 } |
| 2179 | 2179 |
| 2180 /// Called when [enqueuer] is empty, but before it is closed. | 2180 /// Called when [enqueuer] is empty, but before it is closed. |
| 2181 bool onQueueEmpty(Enqueuer enqueuer, Iterable<ClassElement> recentClasses) { | 2181 bool onQueueEmpty(Enqueuer enqueuer, Iterable<ClassElement> recentClasses) { |
| 2182 // Add elements referenced only via custom elements. Return early if any | 2182 // Add elements referenced only via custom elements. Return early if any |
| 2183 // elements are added to avoid counting the elements as due to mirrors. | 2183 // elements are added to avoid counting the elements as due to mirrors. |
| 2184 customElementsAnalysis.onQueueEmpty(enqueuer); | 2184 customElementsAnalysis.onQueueEmpty(enqueuer); |
| 2185 if (!enqueuer.queueIsEmpty) return false; | 2185 if (!enqueuer.queueIsEmpty) return false; |
| 2186 | 2186 |
| 2187 if (compiler.hasIncrementalSupport) { |
| 2188 // Always enable tear-off closures during incremental compilation. |
| 2189 Element e = findHelper('closureFromTearOff'); |
| 2190 if (e != null && !enqueuer.isProcessed(e)) { |
| 2191 registerBackendUse(e); |
| 2192 enqueuer.addToWorkList(e); |
| 2193 } |
| 2194 } |
| 2195 |
| 2187 if (!enqueuer.isResolutionQueue && preMirrorsMethodCount == 0) { | 2196 if (!enqueuer.isResolutionQueue && preMirrorsMethodCount == 0) { |
| 2188 preMirrorsMethodCount = generatedCode.length; | 2197 preMirrorsMethodCount = generatedCode.length; |
| 2189 } | 2198 } |
| 2190 | 2199 |
| 2191 if (isTreeShakingDisabled) { | 2200 if (isTreeShakingDisabled) { |
| 2192 enqueuer.enqueueReflectiveElements(recentClasses); | 2201 enqueuer.enqueueReflectiveElements(recentClasses); |
| 2193 } else if (!targetsUsed.isEmpty && enqueuer.isResolutionQueue) { | 2202 } else if (!targetsUsed.isEmpty && enqueuer.isResolutionQueue) { |
| 2194 // Add all static elements (not classes) that have been requested for | 2203 // Add all static elements (not classes) that have been requested for |
| 2195 // reflection. If there is no mirror-usage these are probably not | 2204 // reflection. If there is no mirror-usage these are probably not |
| 2196 // necessary, but the backend relies on them being resolved. | 2205 // necessary, but the backend relies on them being resolved. |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2497 } | 2506 } |
| 2498 } | 2507 } |
| 2499 | 2508 |
| 2500 /// Records that [constant] is used by the element behind [registry]. | 2509 /// Records that [constant] is used by the element behind [registry]. |
| 2501 class Dependency { | 2510 class Dependency { |
| 2502 final ConstantValue constant; | 2511 final ConstantValue constant; |
| 2503 final Element annotatedElement; | 2512 final Element annotatedElement; |
| 2504 | 2513 |
| 2505 const Dependency(this.constant, this.annotatedElement); | 2514 const Dependency(this.constant, this.annotatedElement); |
| 2506 } | 2515 } |
| OLD | NEW |