| 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 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
| 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); | 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); |
| (...skipping 2830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2841 registerRequiredType(listLiteralUse.type); | 2841 registerRequiredType(listLiteralUse.type); |
| 2842 } | 2842 } |
| 2843 | 2843 |
| 2844 if (worldImpact.constSymbolNames.isNotEmpty) { | 2844 if (worldImpact.constSymbolNames.isNotEmpty) { |
| 2845 registerBackendImpact(transformed, impacts.constSymbol); | 2845 registerBackendImpact(transformed, impacts.constSymbol); |
| 2846 for (String constSymbolName in worldImpact.constSymbolNames) { | 2846 for (String constSymbolName in worldImpact.constSymbolNames) { |
| 2847 backend.registerConstSymbol(constSymbolName); | 2847 backend.registerConstSymbol(constSymbolName); |
| 2848 } | 2848 } |
| 2849 } | 2849 } |
| 2850 | 2850 |
| 2851 if (worldImpact.closures.isNotEmpty) { | 2851 for (StaticUse staticUse in worldImpact.staticUses) { |
| 2852 registerBackendImpact(transformed, impacts.closure); | 2852 if (staticUse.kind == StaticUseKind.CLOSURE) { |
| 2853 for (LocalFunctionElement closure in worldImpact.closures) { | 2853 registerBackendImpact(transformed, impacts.closure); |
| 2854 if (closure.computeType(backend.resolution).containsTypeVariables) { | 2854 LocalFunctionElement closure = staticUse.element; |
| 2855 if (closure.type.containsTypeVariables) { |
| 2855 backend.compiler.enqueuer.resolution.universe | 2856 backend.compiler.enqueuer.resolution.universe |
| 2856 .closuresWithFreeTypeVariables.add(closure); | 2857 .closuresWithFreeTypeVariables.add(closure); |
| 2857 registerBackendImpact(transformed, impacts.computeSignature); | 2858 registerBackendImpact(transformed, impacts.computeSignature); |
| 2858 } | 2859 } |
| 2859 } | 2860 } |
| 2860 } | 2861 } |
| 2861 | 2862 |
| 2862 for (ConstantExpression constant in worldImpact.constantLiterals) { | 2863 for (ConstantExpression constant in worldImpact.constantLiterals) { |
| 2863 switch (constant.kind) { | 2864 switch (constant.kind) { |
| 2864 case ConstantExpressionKind.NULL: | 2865 case ConstantExpressionKind.NULL: |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3018 for (ConstantValue constant in impact.compileTimeConstants) { | 3019 for (ConstantValue constant in impact.compileTimeConstants) { |
| 3019 backend.registerCompileTimeConstant(constant, registry); | 3020 backend.registerCompileTimeConstant(constant, registry); |
| 3020 backend.addCompileTimeConstantForEmission(constant); | 3021 backend.addCompileTimeConstantForEmission(constant); |
| 3021 } | 3022 } |
| 3022 | 3023 |
| 3023 for (Pair<DartType, DartType> check in | 3024 for (Pair<DartType, DartType> check in |
| 3024 impact.typeVariableBoundsSubtypeChecks) { | 3025 impact.typeVariableBoundsSubtypeChecks) { |
| 3025 backend.registerTypeVariableBoundsSubtypeCheck(check.a, check.b); | 3026 backend.registerTypeVariableBoundsSubtypeCheck(check.a, check.b); |
| 3026 } | 3027 } |
| 3027 | 3028 |
| 3028 for (LocalFunctionElement element in impact.closures) { | 3029 |
| 3029 if (backend.methodNeedsRti(element)) { | 3030 for (StaticUse staticUse in impact.staticUses) { |
| 3030 registerBackendImpact(transformed, impacts.computeSignature); | 3031 if (staticUse.kind == StaticUseKind.CLOSURE) { |
| 3032 LocalFunctionElement closure = staticUse.element; |
| 3033 if (backend.methodNeedsRti(closure)) { |
| 3034 registerBackendImpact(transformed, impacts.computeSignature); |
| 3035 } |
| 3031 } | 3036 } |
| 3032 } | 3037 } |
| 3033 | 3038 |
| 3034 for (String name in impact.constSymbols) { | 3039 for (String name in impact.constSymbols) { |
| 3035 backend.registerConstSymbol(name); | 3040 backend.registerConstSymbol(name); |
| 3036 } | 3041 } |
| 3037 | 3042 |
| 3038 for (Set<ClassElement> classes in impact.specializedGetInterceptors) { | 3043 for (Set<ClassElement> classes in impact.specializedGetInterceptors) { |
| 3039 backend.registerSpecializedGetInterceptor(classes); | 3044 backend.registerSpecializedGetInterceptor(classes); |
| 3040 } | 3045 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 3067 } | 3072 } |
| 3068 } | 3073 } |
| 3069 | 3074 |
| 3070 /// Records that [constant] is used by the element behind [registry]. | 3075 /// Records that [constant] is used by the element behind [registry]. |
| 3071 class Dependency { | 3076 class Dependency { |
| 3072 final ConstantValue constant; | 3077 final ConstantValue constant; |
| 3073 final Element annotatedElement; | 3078 final Element annotatedElement; |
| 3074 | 3079 |
| 3075 const Dependency(this.constant, this.annotatedElement); | 3080 const Dependency(this.constant, this.annotatedElement); |
| 3076 } | 3081 } |
| OLD | NEW |