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

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

Issue 2932793005: Rename FrontEndStrategy to FrontendStrategy (Closed)
Patch Set: Created 3 years, 6 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
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 library js_backend.backend; 5 library js_backend.backend;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/backend_api.dart' 8 import '../common/backend_api.dart'
9 show ForeignResolver, NativeRegistry, ImpactTransformer; 9 show ForeignResolver, NativeRegistry, ImpactTransformer;
10 import '../common/codegen.dart' show CodegenWorkItem; 10 import '../common/codegen.dart' show CodegenWorkItem;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 450
451 Tracer tracer; 451 Tracer tracer;
452 452
453 JavaScriptBackend(this.compiler, 453 JavaScriptBackend(this.compiler,
454 {bool generateSourceMap: true, 454 {bool generateSourceMap: true,
455 bool useStartupEmitter: false, 455 bool useStartupEmitter: false,
456 bool useMultiSourceInfo: false, 456 bool useMultiSourceInfo: false,
457 bool useNewSourceInfo: false, 457 bool useNewSourceInfo: false,
458 bool useKernel: false}) 458 bool useKernel: false})
459 : _rti = new RuntimeTypesImpl( 459 : _rti = new RuntimeTypesImpl(
460 compiler.elementEnvironment, compiler.frontEndStrategy.dartTypes), 460 compiler.elementEnvironment, compiler.frontendStrategy.dartTypes),
461 optimizerHints = new OptimizerHintsForTests( 461 optimizerHints = new OptimizerHintsForTests(
462 compiler.elementEnvironment, compiler.commonElements), 462 compiler.elementEnvironment, compiler.commonElements),
463 this.sourceInformationStrategy = 463 this.sourceInformationStrategy =
464 compiler.backendStrategy.sourceInformationStrategy, 464 compiler.backendStrategy.sourceInformationStrategy,
465 constantCompilerTask = new JavaScriptConstantTask(compiler), 465 constantCompilerTask = new JavaScriptConstantTask(compiler),
466 _nativeDataResolver = new NativeDataResolverImpl(compiler), 466 _nativeDataResolver = new NativeDataResolverImpl(compiler),
467 _rtiNeedBuilder = 467 _rtiNeedBuilder =
468 compiler.frontEndStrategy.createRuntimeTypesNeedBuilder() { 468 compiler.frontendStrategy.createRuntimeTypesNeedBuilder() {
469 _target = new JavaScriptBackendTarget(this); 469 _target = new JavaScriptBackendTarget(this);
470 impacts = new BackendImpacts(compiler.options, commonElements); 470 impacts = new BackendImpacts(compiler.options, commonElements);
471 _mirrorsData = compiler.frontEndStrategy.createMirrorsDataBuilder(); 471 _mirrorsData = compiler.frontendStrategy.createMirrorsDataBuilder();
472 _backendUsageBuilder = new BackendUsageBuilderImpl(commonElements); 472 _backendUsageBuilder = new BackendUsageBuilderImpl(commonElements);
473 _checkedModeHelpers = new CheckedModeHelpers(commonElements); 473 _checkedModeHelpers = new CheckedModeHelpers(commonElements);
474 emitter = 474 emitter =
475 new CodeEmitterTask(compiler, generateSourceMap, useStartupEmitter); 475 new CodeEmitterTask(compiler, generateSourceMap, useStartupEmitter);
476 476
477 _typeVariableResolutionAnalysis = new TypeVariableResolutionAnalysis( 477 _typeVariableResolutionAnalysis = new TypeVariableResolutionAnalysis(
478 compiler.elementEnvironment, impacts, _backendUsageBuilder); 478 compiler.elementEnvironment, impacts, _backendUsageBuilder);
479 jsInteropAnalysis = new JsInteropAnalysis(this); 479 jsInteropAnalysis = new JsInteropAnalysis(this);
480 _mirrorsResolutionAnalysis = 480 _mirrorsResolutionAnalysis =
481 compiler.frontEndStrategy.createMirrorsResolutionAnalysis(this); 481 compiler.frontendStrategy.createMirrorsResolutionAnalysis(this);
482 lookupMapResolutionAnalysis = 482 lookupMapResolutionAnalysis =
483 new LookupMapResolutionAnalysis(reporter, compiler.elementEnvironment); 483 new LookupMapResolutionAnalysis(reporter, compiler.elementEnvironment);
484 484
485 noSuchMethodRegistry = new NoSuchMethodRegistry( 485 noSuchMethodRegistry = new NoSuchMethodRegistry(
486 commonElements, compiler.frontEndStrategy.createNoSuchMethodResolver()); 486 commonElements, compiler.frontendStrategy.createNoSuchMethodResolver());
487 kernelTask = new KernelTask(compiler); 487 kernelTask = new KernelTask(compiler);
488 patchResolverTask = new PatchResolverTask(compiler); 488 patchResolverTask = new PatchResolverTask(compiler);
489 functionCompiler = new SsaFunctionCompiler( 489 functionCompiler = new SsaFunctionCompiler(
490 this, compiler.measurer, sourceInformationStrategy); 490 this, compiler.measurer, sourceInformationStrategy);
491 serialization = new JavaScriptBackendSerialization(this); 491 serialization = new JavaScriptBackendSerialization(this);
492 } 492 }
493 493
494 /// The [ConstantSystem] used to interpret compile-time constants for this 494 /// The [ConstantSystem] used to interpret compile-time constants for this
495 /// backend. 495 /// backend.
496 ConstantSystem get constantSystem => constants.constantSystem; 496 ConstantSystem get constantSystem => constants.constantSystem;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 .getThisType(commonElements.jsExtendableArrayClass); 730 .getThisType(commonElements.jsExtendableArrayClass);
731 731
732 validateInterceptorImplementsAllObjectMethods( 732 validateInterceptorImplementsAllObjectMethods(
733 commonElements.jsInterceptorClass); 733 commonElements.jsInterceptorClass);
734 // The null-interceptor must also implement *all* methods. 734 // The null-interceptor must also implement *all* methods.
735 validateInterceptorImplementsAllObjectMethods(commonElements.jsNullClass); 735 validateInterceptorImplementsAllObjectMethods(commonElements.jsNullClass);
736 } 736 }
737 737
738 /// Called when the resolution queue has been closed. 738 /// Called when the resolution queue has been closed.
739 void onResolutionEnd() { 739 void onResolutionEnd() {
740 compiler.frontEndStrategy.annotationProcesser 740 compiler.frontendStrategy.annotationProcesser
741 .processJsInteropAnnotations(nativeBasicData, nativeDataBuilder); 741 .processJsInteropAnnotations(nativeBasicData, nativeDataBuilder);
742 } 742 }
743 743
744 /// Called when the closed world from resolution has been computed. 744 /// Called when the closed world from resolution has been computed.
745 void onResolutionClosedWorld( 745 void onResolutionClosedWorld(
746 ClosedWorld closedWorld, ClosedWorldRefiner closedWorldRefiner) { 746 ClosedWorld closedWorld, ClosedWorldRefiner closedWorldRefiner) {
747 for (MemberEntity entity 747 for (MemberEntity entity
748 in compiler.enqueuer.resolution.processedEntities) { 748 in compiler.enqueuer.resolution.processedEntities) {
749 processAnnotations(entity, closedWorldRefiner); 749 processAnnotations(entity, closedWorldRefiner);
750 } 750 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 } 793 }
794 794
795 ResolutionEnqueuer createResolutionEnqueuer( 795 ResolutionEnqueuer createResolutionEnqueuer(
796 CompilerTask task, Compiler compiler) { 796 CompilerTask task, Compiler compiler) {
797 _nativeBasicData = 797 _nativeBasicData =
798 nativeBasicDataBuilder.close(compiler.elementEnvironment); 798 nativeBasicDataBuilder.close(compiler.elementEnvironment);
799 _nativeResolutionEnqueuer = new native.NativeResolutionEnqueuer( 799 _nativeResolutionEnqueuer = new native.NativeResolutionEnqueuer(
800 compiler.options, 800 compiler.options,
801 compiler.elementEnvironment, 801 compiler.elementEnvironment,
802 commonElements, 802 commonElements,
803 compiler.frontEndStrategy.dartTypes, 803 compiler.frontendStrategy.dartTypes,
804 _backendUsageBuilder, 804 _backendUsageBuilder,
805 compiler.frontEndStrategy.createNativeClassFinder(nativeBasicData)); 805 compiler.frontendStrategy.createNativeClassFinder(nativeBasicData));
806 _nativeDataBuilder = new NativeDataBuilderImpl(nativeBasicData); 806 _nativeDataBuilder = new NativeDataBuilderImpl(nativeBasicData);
807 _customElementsResolutionAnalysis = new CustomElementsResolutionAnalysis( 807 _customElementsResolutionAnalysis = new CustomElementsResolutionAnalysis(
808 constantSystem, 808 constantSystem,
809 compiler.elementEnvironment, 809 compiler.elementEnvironment,
810 commonElements, 810 commonElements,
811 nativeBasicData, 811 nativeBasicData,
812 _backendUsageBuilder); 812 _backendUsageBuilder);
813 impactTransformer = new JavaScriptImpactTransformer( 813 impactTransformer = new JavaScriptImpactTransformer(
814 compiler.options, 814 compiler.options,
815 compiler.elementEnvironment, 815 compiler.elementEnvironment,
(...skipping 26 matching lines...) Expand all
842 rtiNeedBuilder, 842 rtiNeedBuilder,
843 mirrorsDataBuilder, 843 mirrorsDataBuilder,
844 noSuchMethodRegistry, 844 noSuchMethodRegistry,
845 customElementsResolutionAnalysis, 845 customElementsResolutionAnalysis,
846 lookupMapResolutionAnalysis, 846 lookupMapResolutionAnalysis,
847 mirrorsResolutionAnalysis, 847 mirrorsResolutionAnalysis,
848 typeVariableResolutionAnalysis, 848 typeVariableResolutionAnalysis,
849 _nativeResolutionEnqueuer, 849 _nativeResolutionEnqueuer,
850 compiler.deferredLoadTask, 850 compiler.deferredLoadTask,
851 kernelTask), 851 kernelTask),
852 compiler.frontEndStrategy.createResolutionWorldBuilder( 852 compiler.frontendStrategy.createResolutionWorldBuilder(
853 nativeBasicData, 853 nativeBasicData,
854 _nativeDataBuilder, 854 _nativeDataBuilder,
855 interceptorDataBuilder, 855 interceptorDataBuilder,
856 _backendUsageBuilder, 856 _backendUsageBuilder,
857 const OpenWorldStrategy()), 857 const OpenWorldStrategy()),
858 compiler.frontEndStrategy.createResolutionWorkItemBuilder( 858 compiler.frontendStrategy.createResolutionWorkItemBuilder(
859 nativeBasicData, _nativeDataBuilder, impactTransformer)); 859 nativeBasicData, _nativeDataBuilder, impactTransformer));
860 } 860 }
861 861
862 /// Creates an [Enqueuer] for code generation specific to this backend. 862 /// Creates an [Enqueuer] for code generation specific to this backend.
863 CodegenEnqueuer createCodegenEnqueuer( 863 CodegenEnqueuer createCodegenEnqueuer(
864 CompilerTask task, Compiler compiler, ClosedWorld closedWorld) { 864 CompilerTask task, Compiler compiler, ClosedWorld closedWorld) {
865 _typeVariableCodegenAnalysis = new TypeVariableCodegenAnalysis( 865 _typeVariableCodegenAnalysis = new TypeVariableCodegenAnalysis(
866 compiler.elementEnvironment, this, commonElements, mirrorsData); 866 compiler.elementEnvironment, this, commonElements, mirrorsData);
867 _lookupMapAnalysis = new LookupMapAnalysis( 867 _lookupMapAnalysis = new LookupMapAnalysis(
868 reporter, 868 reporter,
869 constantSystem, 869 constantSystem,
870 constants, 870 constants,
871 compiler.elementEnvironment, 871 compiler.elementEnvironment,
872 commonElements, 872 commonElements,
873 lookupMapResolutionAnalysis); 873 lookupMapResolutionAnalysis);
874 _mirrorsCodegenAnalysis = mirrorsResolutionAnalysis.close(); 874 _mirrorsCodegenAnalysis = mirrorsResolutionAnalysis.close();
875 _customElementsCodegenAnalysis = new CustomElementsCodegenAnalysis( 875 _customElementsCodegenAnalysis = new CustomElementsCodegenAnalysis(
876 constantSystem, 876 constantSystem,
877 commonElements, 877 commonElements,
878 compiler.elementEnvironment, 878 compiler.elementEnvironment,
879 nativeBasicData); 879 nativeBasicData);
880 _nativeCodegenEnqueuer = new native.NativeCodegenEnqueuer( 880 _nativeCodegenEnqueuer = new native.NativeCodegenEnqueuer(
881 compiler.options, 881 compiler.options,
882 compiler.elementEnvironment, 882 compiler.elementEnvironment,
883 commonElements, 883 commonElements,
884 compiler.frontEndStrategy.dartTypes, 884 compiler.frontendStrategy.dartTypes,
885 emitter, 885 emitter,
886 _nativeResolutionEnqueuer, 886 _nativeResolutionEnqueuer,
887 closedWorld.nativeData); 887 closedWorld.nativeData);
888 return new CodegenEnqueuer( 888 return new CodegenEnqueuer(
889 task, 889 task,
890 compiler.options, 890 compiler.options,
891 const TreeShakingEnqueuerStrategy(), 891 const TreeShakingEnqueuerStrategy(),
892 compiler.backendStrategy.createCodegenWorldBuilder( 892 compiler.backendStrategy.createCodegenWorldBuilder(
893 nativeBasicData, closedWorld, const TypeMaskStrategy()), 893 nativeBasicData, closedWorld, const TypeMaskStrategy()),
894 compiler.backendStrategy.createCodegenWorkItemBuilder(closedWorld), 894 compiler.backendStrategy.createCodegenWorkItemBuilder(closedWorld),
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 element == commonElements.jsExtendableArrayClass || 1022 element == commonElements.jsExtendableArrayClass ||
1023 element == commonElements.jsFixedArrayClass || 1023 element == commonElements.jsFixedArrayClass ||
1024 element == commonElements.jsUnmodifiableArrayClass; 1024 element == commonElements.jsUnmodifiableArrayClass;
1025 } 1025 }
1026 1026
1027 /// This method is called immediately after the [library] and its parts have 1027 /// This method is called immediately after the [library] and its parts have
1028 /// been loaded. 1028 /// been loaded.
1029 void setAnnotations(LibraryEntity library) { 1029 void setAnnotations(LibraryEntity library) {
1030 if (!compiler.serialization.isDeserialized(library)) { 1030 if (!compiler.serialization.isDeserialized(library)) {
1031 AnnotationProcessor processor = 1031 AnnotationProcessor processor =
1032 compiler.frontEndStrategy.annotationProcesser; 1032 compiler.frontendStrategy.annotationProcesser;
1033 if (canLibraryUseNative(library)) { 1033 if (canLibraryUseNative(library)) {
1034 processor.extractNativeAnnotations(library, nativeBasicDataBuilder); 1034 processor.extractNativeAnnotations(library, nativeBasicDataBuilder);
1035 } 1035 }
1036 processor.extractJsInteropAnnotations(library, nativeBasicDataBuilder); 1036 processor.extractJsInteropAnnotations(library, nativeBasicDataBuilder);
1037 } 1037 }
1038 Uri uri = library.canonicalUri; 1038 Uri uri = library.canonicalUri;
1039 if (uri == Uris.dart_html) { 1039 if (uri == Uris.dart_html) {
1040 htmlLibraryIsLoaded = true; 1040 htmlLibraryIsLoaded = true;
1041 } else if (uri == LookupMapResolutionAnalysis.PACKAGE_LOOKUP_MAP) { 1041 } else if (uri == LookupMapResolutionAnalysis.PACKAGE_LOOKUP_MAP) {
1042 lookupMapResolutionAnalysis.init(library); 1042 lookupMapResolutionAnalysis.init(library);
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 1397
1398 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { 1398 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) {
1399 return !selector.isGetter; 1399 return !selector.isGetter;
1400 } 1400 }
1401 1401
1402 /// Returns `true` if [member] is called from a subclass via `super`. 1402 /// Returns `true` if [member] is called from a subclass via `super`.
1403 bool isAliasedSuperMember(MemberEntity member) { 1403 bool isAliasedSuperMember(MemberEntity member) {
1404 return _aliasedSuperMembers.contains(member); 1404 return _aliasedSuperMembers.contains(member);
1405 } 1405 }
1406 } 1406 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/frontend_strategy.dart ('k') | pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698