Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1957343002: Register NativeBehavior from WorldImpact. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comment. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/common/resolution.dart ('k') | pkg/compiler/lib/src/native/enqueue.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2609 matching lines...) Expand 10 before | Expand all | Expand 10 after
2620 } 2620 }
2621 } 2621 }
2622 2622
2623 class JavaScriptImpactTransformer extends ImpactTransformer { 2623 class JavaScriptImpactTransformer extends ImpactTransformer {
2624 final JavaScriptBackend backend; 2624 final JavaScriptBackend backend;
2625 2625
2626 JavaScriptImpactTransformer(this.backend); 2626 JavaScriptImpactTransformer(this.backend);
2627 2627
2628 BackendImpacts get impacts => backend.impacts; 2628 BackendImpacts get impacts => backend.impacts;
2629 2629
2630 // TODO(johnniwinther): Avoid this dependency.
2631 ResolutionEnqueuer get resolutionEnqueuer {
2632 return backend.compiler.enqueuer.resolution;
2633 }
2634
2630 @override 2635 @override
2631 WorldImpact transformResolutionImpact(ResolutionImpact worldImpact) { 2636 WorldImpact transformResolutionImpact(ResolutionImpact worldImpact) {
2632 TransformedWorldImpact transformed = 2637 TransformedWorldImpact transformed =
2633 new TransformedWorldImpact(worldImpact); 2638 new TransformedWorldImpact(worldImpact);
2634 for (Feature feature in worldImpact.features) { 2639 for (Feature feature in worldImpact.features) {
2635 switch (feature) { 2640 switch (feature) {
2636 case Feature.ABSTRACT_CLASS_INSTANTIATION: 2641 case Feature.ABSTRACT_CLASS_INSTANTIATION:
2637 registerBackendImpact( 2642 registerBackendImpact(
2638 transformed, impacts.abstractClassInstantiation); 2643 transformed, impacts.abstractClassInstantiation);
2639 break; 2644 break;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
2779 for (String constSymbolName in worldImpact.constSymbolNames) { 2784 for (String constSymbolName in worldImpact.constSymbolNames) {
2780 backend.registerConstSymbol(constSymbolName); 2785 backend.registerConstSymbol(constSymbolName);
2781 } 2786 }
2782 } 2787 }
2783 2788
2784 for (StaticUse staticUse in worldImpact.staticUses) { 2789 for (StaticUse staticUse in worldImpact.staticUses) {
2785 if (staticUse.kind == StaticUseKind.CLOSURE) { 2790 if (staticUse.kind == StaticUseKind.CLOSURE) {
2786 registerBackendImpact(transformed, impacts.closure); 2791 registerBackendImpact(transformed, impacts.closure);
2787 LocalFunctionElement closure = staticUse.element; 2792 LocalFunctionElement closure = staticUse.element;
2788 if (closure.type.containsTypeVariables) { 2793 if (closure.type.containsTypeVariables) {
2789 backend.compiler.enqueuer.resolution.universe 2794 resolutionEnqueuer.universe.closuresWithFreeTypeVariables
2790 .closuresWithFreeTypeVariables
2791 .add(closure); 2795 .add(closure);
2792 registerBackendImpact(transformed, impacts.computeSignature); 2796 registerBackendImpact(transformed, impacts.computeSignature);
2793 } 2797 }
2794 } 2798 }
2795 } 2799 }
2796 2800
2797 for (ConstantExpression constant in worldImpact.constantLiterals) { 2801 for (ConstantExpression constant in worldImpact.constantLiterals) {
2798 switch (constant.kind) { 2802 switch (constant.kind) {
2799 case ConstantExpressionKind.NULL: 2803 case ConstantExpressionKind.NULL:
2800 registerBackendImpact(transformed, impacts.nullLiteral); 2804 registerBackendImpact(transformed, impacts.nullLiteral);
2801 break; 2805 break;
2802 case ConstantExpressionKind.BOOL: 2806 case ConstantExpressionKind.BOOL:
2803 registerBackendImpact(transformed, impacts.boolLiteral); 2807 registerBackendImpact(transformed, impacts.boolLiteral);
2804 break; 2808 break;
2805 case ConstantExpressionKind.INT: 2809 case ConstantExpressionKind.INT:
2806 registerBackendImpact(transformed, impacts.intLiteral); 2810 registerBackendImpact(transformed, impacts.intLiteral);
2807 break; 2811 break;
2808 case ConstantExpressionKind.DOUBLE: 2812 case ConstantExpressionKind.DOUBLE:
2809 registerBackendImpact(transformed, impacts.doubleLiteral); 2813 registerBackendImpact(transformed, impacts.doubleLiteral);
2810 break; 2814 break;
2811 case ConstantExpressionKind.STRING: 2815 case ConstantExpressionKind.STRING:
2812 registerBackendImpact(transformed, impacts.stringLiteral); 2816 registerBackendImpact(transformed, impacts.stringLiteral);
2813 break; 2817 break;
2814 default: 2818 default:
2815 assert(invariant(NO_LOCATION_SPANNABLE, false, 2819 assert(invariant(NO_LOCATION_SPANNABLE, false,
2816 message: "Unexpected constant literal: ${constant.kind}.")); 2820 message: "Unexpected constant literal: ${constant.kind}."));
2817 } 2821 }
2818 } 2822 }
2819 2823
2824 for (native.NativeBehavior behavior in worldImpact.nativeData) {
2825 resolutionEnqueuer.nativeEnqueuer
2826 .registerNativeBehavior(behavior, worldImpact);
2827 }
2828
2820 return transformed; 2829 return transformed;
2821 } 2830 }
2822 2831
2823 void registerBackendImpact( 2832 void registerBackendImpact(
2824 TransformedWorldImpact worldImpact, BackendImpact backendImpact) { 2833 TransformedWorldImpact worldImpact, BackendImpact backendImpact) {
2825 for (Element staticUse in backendImpact.staticUses) { 2834 for (Element staticUse in backendImpact.staticUses) {
2826 assert(staticUse != null); 2835 assert(staticUse != null);
2827 backend.registerBackendUse(staticUse); 2836 backend.registerBackendUse(staticUse);
2828 worldImpact.registerStaticUse( 2837 worldImpact.registerStaticUse(
2829 // TODO(johnniwinther): Store the correct use in impacts. 2838 // TODO(johnniwinther): Store the correct use in impacts.
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
3047 3056
3048 @override 3057 @override
3049 void onImpactUsed(ImpactUseCase impactUse) { 3058 void onImpactUsed(ImpactUseCase impactUse) {
3050 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { 3059 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) {
3051 // TODO(johnniwinther): Allow emptying when serialization has been 3060 // TODO(johnniwinther): Allow emptying when serialization has been
3052 // performed. 3061 // performed.
3053 resolution.emptyCache(); 3062 resolution.emptyCache();
3054 } 3063 }
3055 } 3064 }
3056 } 3065 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/common/resolution.dart ('k') | pkg/compiler/lib/src/native/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698