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

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

Issue 2935063002: Add ClosedWorld.elementEnvironment and remove Compiler.elementEnvironment (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;
11 import '../common/names.dart' show Uris; 11 import '../common/names.dart' show Uris;
12 import '../common/resolution.dart' show Resolution, Target; 12 import '../common/resolution.dart' show Resolution, Target;
13 import '../common/tasks.dart' show CompilerTask; 13 import '../common/tasks.dart' show CompilerTask;
14 import '../compiler.dart' show Compiler; 14 import '../compiler.dart' show Compiler;
15 import '../constants/constant_system.dart'; 15 import '../constants/constant_system.dart';
16 import '../constants/expressions.dart'; 16 import '../constants/expressions.dart';
17 import '../constants/values.dart'; 17 import '../constants/values.dart';
18 import '../common_elements.dart' show CommonElements; 18 import '../common_elements.dart' show CommonElements, ElementEnvironment;
19 import '../deferred_load.dart' show DeferredLoadTask; 19 import '../deferred_load.dart' show DeferredLoadTask;
20 import '../dump_info.dart' show DumpInfoTask; 20 import '../dump_info.dart' show DumpInfoTask;
21 import '../elements/elements.dart'; 21 import '../elements/elements.dart';
22 import '../elements/entities.dart'; 22 import '../elements/entities.dart';
23 import '../elements/names.dart'; 23 import '../elements/names.dart';
24 import '../elements/resolution_types.dart'; 24 import '../elements/resolution_types.dart';
25 import '../elements/types.dart'; 25 import '../elements/types.dart';
26 import '../enqueue.dart' 26 import '../enqueue.dart'
27 show 27 show
28 DirectEnqueuerStrategy, 28 DirectEnqueuerStrategy,
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 445
446 Tracer tracer; 446 Tracer tracer;
447 447
448 JavaScriptBackend(this.compiler, 448 JavaScriptBackend(this.compiler,
449 {bool generateSourceMap: true, 449 {bool generateSourceMap: true,
450 bool useStartupEmitter: false, 450 bool useStartupEmitter: false,
451 bool useMultiSourceInfo: false, 451 bool useMultiSourceInfo: false,
452 bool useNewSourceInfo: false, 452 bool useNewSourceInfo: false,
453 bool useKernel: false}) 453 bool useKernel: false})
454 : _rti = new RuntimeTypesImpl( 454 : _rti = new RuntimeTypesImpl(
455 compiler.elementEnvironment, compiler.frontendStrategy.dartTypes), 455 compiler.frontendStrategy.elementEnvironment,
456 optimizerHints = new OptimizerHintsForTests(compiler.elementEnvironment, 456 compiler.frontendStrategy.dartTypes),
457 optimizerHints = new OptimizerHintsForTests(
458 compiler.frontendStrategy.elementEnvironment,
457 compiler.frontendStrategy.commonElements), 459 compiler.frontendStrategy.commonElements),
458 this.sourceInformationStrategy = 460 this.sourceInformationStrategy =
459 compiler.backendStrategy.sourceInformationStrategy, 461 compiler.backendStrategy.sourceInformationStrategy,
460 constantCompilerTask = new JavaScriptConstantTask(compiler), 462 constantCompilerTask = new JavaScriptConstantTask(compiler),
461 _nativeDataResolver = new NativeDataResolverImpl(compiler), 463 _nativeDataResolver = new NativeDataResolverImpl(compiler),
462 _rtiNeedBuilder = 464 _rtiNeedBuilder =
463 compiler.frontendStrategy.createRuntimeTypesNeedBuilder() { 465 compiler.frontendStrategy.createRuntimeTypesNeedBuilder() {
464 CommonElements commonElements = compiler.frontendStrategy.commonElements; 466 CommonElements commonElements = compiler.frontendStrategy.commonElements;
465 _target = new JavaScriptBackendTarget(this); 467 _target = new JavaScriptBackendTarget(this);
466 impacts = new BackendImpacts(compiler.options, commonElements); 468 impacts = new BackendImpacts(compiler.options, commonElements);
467 _mirrorsData = compiler.frontendStrategy.createMirrorsDataBuilder(); 469 _mirrorsData = compiler.frontendStrategy.createMirrorsDataBuilder();
468 _backendUsageBuilder = new BackendUsageBuilderImpl(commonElements); 470 _backendUsageBuilder = new BackendUsageBuilderImpl(commonElements);
469 _checkedModeHelpers = new CheckedModeHelpers(commonElements); 471 _checkedModeHelpers = new CheckedModeHelpers(commonElements);
470 emitter = 472 emitter =
471 new CodeEmitterTask(compiler, generateSourceMap, useStartupEmitter); 473 new CodeEmitterTask(compiler, generateSourceMap, useStartupEmitter);
472 474
473 _typeVariableResolutionAnalysis = new TypeVariableResolutionAnalysis( 475 _typeVariableResolutionAnalysis = new TypeVariableResolutionAnalysis(
474 compiler.elementEnvironment, impacts, _backendUsageBuilder); 476 compiler.frontendStrategy.elementEnvironment,
477 impacts,
478 _backendUsageBuilder);
475 jsInteropAnalysis = new JsInteropAnalysis(this); 479 jsInteropAnalysis = new JsInteropAnalysis(this);
476 _mirrorsResolutionAnalysis = 480 _mirrorsResolutionAnalysis =
477 compiler.frontendStrategy.createMirrorsResolutionAnalysis(this); 481 compiler.frontendStrategy.createMirrorsResolutionAnalysis(this);
478 lookupMapResolutionAnalysis = 482 lookupMapResolutionAnalysis = new LookupMapResolutionAnalysis(
479 new LookupMapResolutionAnalysis(reporter, compiler.elementEnvironment); 483 reporter, compiler.frontendStrategy.elementEnvironment);
480 484
481 noSuchMethodRegistry = new NoSuchMethodRegistry( 485 noSuchMethodRegistry = new NoSuchMethodRegistry(
482 commonElements, compiler.frontendStrategy.createNoSuchMethodResolver()); 486 commonElements, compiler.frontendStrategy.createNoSuchMethodResolver());
483 kernelTask = new KernelTask(compiler); 487 kernelTask = new KernelTask(compiler);
484 patchResolverTask = new PatchResolverTask(compiler); 488 patchResolverTask = new PatchResolverTask(compiler);
485 functionCompiler = new SsaFunctionCompiler( 489 functionCompiler = new SsaFunctionCompiler(
486 this, compiler.measurer, sourceInformationStrategy); 490 this, compiler.measurer, sourceInformationStrategy);
487 serialization = new JavaScriptBackendSerialization(this); 491 serialization = new JavaScriptBackendSerialization(this);
488 } 492 }
489 493
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 void onResolutionEnd() { 729 void onResolutionEnd() {
726 frontendStrategy.annotationProcesser 730 frontendStrategy.annotationProcesser
727 .processJsInteropAnnotations(nativeBasicData, nativeDataBuilder); 731 .processJsInteropAnnotations(nativeBasicData, nativeDataBuilder);
728 } 732 }
729 733
730 /// Called when the closed world from resolution has been computed. 734 /// Called when the closed world from resolution has been computed.
731 void onResolutionClosedWorld( 735 void onResolutionClosedWorld(
732 ClosedWorld closedWorld, ClosedWorldRefiner closedWorldRefiner) { 736 ClosedWorld closedWorld, ClosedWorldRefiner closedWorldRefiner) {
733 for (MemberEntity entity 737 for (MemberEntity entity
734 in compiler.enqueuer.resolution.processedEntities) { 738 in compiler.enqueuer.resolution.processedEntities) {
735 processAnnotations( 739 processAnnotations(closedWorld.elementEnvironment,
736 closedWorld.commonElements, entity, closedWorldRefiner); 740 closedWorld.commonElements, entity, closedWorldRefiner);
737 } 741 }
738 mirrorsDataBuilder.computeMembersNeededForReflection( 742 mirrorsDataBuilder.computeMembersNeededForReflection(
739 compiler.enqueuer.resolution.worldBuilder, closedWorld); 743 compiler.enqueuer.resolution.worldBuilder, closedWorld);
740 _rtiNeed = rtiNeedBuilder.computeRuntimeTypesNeed( 744 _rtiNeed = rtiNeedBuilder.computeRuntimeTypesNeed(
741 compiler.enqueuer.resolution.worldBuilder, closedWorld, compiler.types, 745 compiler.enqueuer.resolution.worldBuilder, closedWorld, compiler.types,
742 enableTypeAssertions: compiler.options.enableTypeAssertions); 746 enableTypeAssertions: compiler.options.enableTypeAssertions);
743 mirrorsResolutionAnalysis.onResolutionComplete(); 747 mirrorsResolutionAnalysis.onResolutionComplete();
744 } 748 }
745 749
(...skipping 28 matching lines...) Expand all
774 } 778 }
775 reporter.reportErrorMessage( 779 reporter.reportErrorMessage(
776 node, MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT); 780 node, MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT);
777 } 781 }
778 // No native behavior for this call. 782 // No native behavior for this call.
779 return null; 783 return null;
780 } 784 }
781 785
782 ResolutionEnqueuer createResolutionEnqueuer( 786 ResolutionEnqueuer createResolutionEnqueuer(
783 CompilerTask task, Compiler compiler) { 787 CompilerTask task, Compiler compiler) {
788 ElementEnvironment elementEnvironment =
789 compiler.frontendStrategy.elementEnvironment;
784 CommonElements commonElements = compiler.frontendStrategy.commonElements; 790 CommonElements commonElements = compiler.frontendStrategy.commonElements;
785 _nativeBasicData = 791 _nativeBasicData = nativeBasicDataBuilder.close(elementEnvironment);
786 nativeBasicDataBuilder.close(compiler.elementEnvironment);
787 _nativeResolutionEnqueuer = new native.NativeResolutionEnqueuer( 792 _nativeResolutionEnqueuer = new native.NativeResolutionEnqueuer(
788 compiler.options, 793 compiler.options,
789 compiler.elementEnvironment, 794 elementEnvironment,
790 commonElements, 795 commonElements,
791 compiler.frontendStrategy.dartTypes, 796 compiler.frontendStrategy.dartTypes,
792 _backendUsageBuilder, 797 _backendUsageBuilder,
793 compiler.frontendStrategy.createNativeClassFinder(nativeBasicData)); 798 compiler.frontendStrategy.createNativeClassFinder(nativeBasicData));
794 _nativeDataBuilder = new NativeDataBuilderImpl(nativeBasicData); 799 _nativeDataBuilder = new NativeDataBuilderImpl(nativeBasicData);
795 _customElementsResolutionAnalysis = new CustomElementsResolutionAnalysis( 800 _customElementsResolutionAnalysis = new CustomElementsResolutionAnalysis(
796 constantSystem, 801 constantSystem,
797 compiler.elementEnvironment, 802 elementEnvironment,
798 commonElements, 803 commonElements,
799 nativeBasicData, 804 nativeBasicData,
800 _backendUsageBuilder); 805 _backendUsageBuilder);
801 impactTransformer = new JavaScriptImpactTransformer( 806 impactTransformer = new JavaScriptImpactTransformer(
802 compiler.options, 807 compiler.options,
803 compiler.elementEnvironment, 808 elementEnvironment,
804 commonElements, 809 commonElements,
805 impacts, 810 impacts,
806 nativeBasicData, 811 nativeBasicData,
807 _nativeResolutionEnqueuer, 812 _nativeResolutionEnqueuer,
808 _backendUsageBuilder, 813 _backendUsageBuilder,
809 mirrorsDataBuilder, 814 mirrorsDataBuilder,
810 customElementsResolutionAnalysis, 815 customElementsResolutionAnalysis,
811 rtiNeedBuilder); 816 rtiNeedBuilder);
812 InterceptorDataBuilder interceptorDataBuilder = 817 InterceptorDataBuilder interceptorDataBuilder =
813 new InterceptorDataBuilderImpl( 818 new InterceptorDataBuilderImpl(
814 nativeBasicData, compiler.elementEnvironment, commonElements); 819 nativeBasicData, elementEnvironment, commonElements);
815 return new ResolutionEnqueuer( 820 return new ResolutionEnqueuer(
816 task, 821 task,
817 compiler.options, 822 compiler.options,
818 compiler.reporter, 823 compiler.reporter,
819 compiler.options.analyzeOnly && compiler.options.analyzeMain 824 compiler.options.analyzeOnly && compiler.options.analyzeMain
820 ? const DirectEnqueuerStrategy() 825 ? const DirectEnqueuerStrategy()
821 : const TreeShakingEnqueuerStrategy(), 826 : const TreeShakingEnqueuerStrategy(),
822 new ResolutionEnqueuerListener( 827 new ResolutionEnqueuerListener(
823 compiler.options, 828 compiler.options,
824 compiler.elementEnvironment, 829 elementEnvironment,
825 commonElements, 830 commonElements,
826 impacts, 831 impacts,
827 nativeBasicData, 832 nativeBasicData,
828 interceptorDataBuilder, 833 interceptorDataBuilder,
829 _backendUsageBuilder, 834 _backendUsageBuilder,
830 rtiNeedBuilder, 835 rtiNeedBuilder,
831 mirrorsDataBuilder, 836 mirrorsDataBuilder,
832 noSuchMethodRegistry, 837 noSuchMethodRegistry,
833 customElementsResolutionAnalysis, 838 customElementsResolutionAnalysis,
834 lookupMapResolutionAnalysis, 839 lookupMapResolutionAnalysis,
835 mirrorsResolutionAnalysis, 840 mirrorsResolutionAnalysis,
836 typeVariableResolutionAnalysis, 841 typeVariableResolutionAnalysis,
837 _nativeResolutionEnqueuer, 842 _nativeResolutionEnqueuer,
838 compiler.deferredLoadTask, 843 compiler.deferredLoadTask,
839 kernelTask), 844 kernelTask),
840 compiler.frontendStrategy.createResolutionWorldBuilder( 845 compiler.frontendStrategy.createResolutionWorldBuilder(
841 nativeBasicData, 846 nativeBasicData,
842 _nativeDataBuilder, 847 _nativeDataBuilder,
843 interceptorDataBuilder, 848 interceptorDataBuilder,
844 _backendUsageBuilder, 849 _backendUsageBuilder,
845 const OpenWorldStrategy()), 850 const OpenWorldStrategy()),
846 compiler.frontendStrategy.createResolutionWorkItemBuilder( 851 compiler.frontendStrategy.createResolutionWorkItemBuilder(
847 nativeBasicData, _nativeDataBuilder, impactTransformer)); 852 nativeBasicData, _nativeDataBuilder, impactTransformer));
848 } 853 }
849 854
850 /// Creates an [Enqueuer] for code generation specific to this backend. 855 /// Creates an [Enqueuer] for code generation specific to this backend.
851 CodegenEnqueuer createCodegenEnqueuer( 856 CodegenEnqueuer createCodegenEnqueuer(
852 CompilerTask task, Compiler compiler, ClosedWorld closedWorld) { 857 CompilerTask task, Compiler compiler, ClosedWorld closedWorld) {
858 ElementEnvironment elementEnvironment = closedWorld.elementEnvironment;
853 CommonElements commonElements = closedWorld.commonElements; 859 CommonElements commonElements = closedWorld.commonElements;
854 _typeVariableCodegenAnalysis = new TypeVariableCodegenAnalysis( 860 _typeVariableCodegenAnalysis = new TypeVariableCodegenAnalysis(
855 compiler.elementEnvironment, this, commonElements, mirrorsData); 861 closedWorld.elementEnvironment, this, commonElements, mirrorsData);
856 _lookupMapAnalysis = new LookupMapAnalysis( 862 _lookupMapAnalysis = new LookupMapAnalysis(
857 reporter, 863 reporter,
858 constantSystem, 864 constantSystem,
859 constants, 865 constants,
860 compiler.elementEnvironment, 866 elementEnvironment,
861 commonElements, 867 commonElements,
862 lookupMapResolutionAnalysis); 868 lookupMapResolutionAnalysis);
863 _mirrorsCodegenAnalysis = mirrorsResolutionAnalysis.close(); 869 _mirrorsCodegenAnalysis = mirrorsResolutionAnalysis.close();
864 _customElementsCodegenAnalysis = new CustomElementsCodegenAnalysis( 870 _customElementsCodegenAnalysis = new CustomElementsCodegenAnalysis(
865 constantSystem, 871 constantSystem, commonElements, elementEnvironment, nativeBasicData);
866 commonElements,
867 compiler.elementEnvironment,
868 nativeBasicData);
869 _nativeCodegenEnqueuer = new native.NativeCodegenEnqueuer( 872 _nativeCodegenEnqueuer = new native.NativeCodegenEnqueuer(
870 compiler.options, 873 compiler.options,
871 compiler.elementEnvironment, 874 elementEnvironment,
872 commonElements, 875 commonElements,
873 compiler.frontendStrategy.dartTypes, 876 compiler.frontendStrategy.dartTypes,
874 emitter, 877 emitter,
875 _nativeResolutionEnqueuer, 878 _nativeResolutionEnqueuer,
876 closedWorld.nativeData); 879 closedWorld.nativeData);
877 return new CodegenEnqueuer( 880 return new CodegenEnqueuer(
878 task, 881 task,
879 compiler.options, 882 compiler.options,
880 const TreeShakingEnqueuerStrategy(), 883 const TreeShakingEnqueuerStrategy(),
881 compiler.backendStrategy.createCodegenWorldBuilder( 884 compiler.backendStrategy.createCodegenWorldBuilder(
882 nativeBasicData, closedWorld, const TypeMaskStrategy()), 885 nativeBasicData, closedWorld, const TypeMaskStrategy()),
883 compiler.backendStrategy.createCodegenWorkItemBuilder(closedWorld), 886 compiler.backendStrategy.createCodegenWorkItemBuilder(closedWorld),
884 new CodegenEnqueuerListener( 887 new CodegenEnqueuerListener(
885 compiler.elementEnvironment, 888 elementEnvironment,
886 commonElements, 889 commonElements,
887 impacts, 890 impacts,
888 closedWorld.backendUsage, 891 closedWorld.backendUsage,
889 rtiNeed, 892 rtiNeed,
890 customElementsCodegenAnalysis, 893 customElementsCodegenAnalysis,
891 typeVariableCodegenAnalysis, 894 typeVariableCodegenAnalysis,
892 lookupMapAnalysis, 895 lookupMapAnalysis,
893 mirrorsCodegenAnalysis, 896 mirrorsCodegenAnalysis,
894 nativeCodegenEnqueuer)); 897 nativeCodegenEnqueuer));
895 } 898 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 1059
1057 /// Called when the compiler starts running the codegen enqueuer. The 1060 /// Called when the compiler starts running the codegen enqueuer. The
1058 /// [WorldImpact] of enabled backend features is returned. 1061 /// [WorldImpact] of enabled backend features is returned.
1059 WorldImpact onCodegenStart( 1062 WorldImpact onCodegenStart(
1060 ClosedWorld closedWorld, CodegenWorldBuilder codegenWorldBuilder) { 1063 ClosedWorld closedWorld, CodegenWorldBuilder codegenWorldBuilder) {
1061 _oneShotInterceptorData = new OneShotInterceptorData( 1064 _oneShotInterceptorData = new OneShotInterceptorData(
1062 closedWorld.interceptorData, closedWorld.commonElements); 1065 closedWorld.interceptorData, closedWorld.commonElements);
1063 _namer = determineNamer(closedWorld, codegenWorldBuilder); 1066 _namer = determineNamer(closedWorld, codegenWorldBuilder);
1064 tracer = new Tracer(closedWorld, namer, compiler); 1067 tracer = new Tracer(closedWorld, namer, compiler);
1065 _rtiEncoder = _namer.rtiEncoder = new RuntimeTypesEncoderImpl( 1068 _rtiEncoder = _namer.rtiEncoder = new RuntimeTypesEncoderImpl(
1066 namer, compiler.elementEnvironment, closedWorld.commonElements); 1069 namer, closedWorld.elementEnvironment, closedWorld.commonElements);
1067 emitter.createEmitter(namer, closedWorld, codegenWorldBuilder); 1070 emitter.createEmitter(namer, closedWorld, codegenWorldBuilder);
1068 _codegenImpactTransformer = new CodegenImpactTransformer( 1071 _codegenImpactTransformer = new CodegenImpactTransformer(
1069 compiler.options, 1072 compiler.options,
1070 compiler.elementEnvironment, 1073 closedWorld.elementEnvironment,
1071 closedWorld.commonElements, 1074 closedWorld.commonElements,
1072 impacts, 1075 impacts,
1073 checkedModeHelpers, 1076 checkedModeHelpers,
1074 closedWorld.nativeData, 1077 closedWorld.nativeData,
1075 closedWorld.backendUsage, 1078 closedWorld.backendUsage,
1076 rtiNeed, 1079 rtiNeed,
1077 nativeCodegenEnqueuer, 1080 nativeCodegenEnqueuer,
1078 namer, 1081 namer,
1079 oneShotInterceptorData, 1082 oneShotInterceptorData,
1080 lookupMapAnalysis, 1083 lookupMapAnalysis,
(...skipping 21 matching lines...) Expand all
1102 if (canonicalUri == Uris.dart__js_helper || 1105 if (canonicalUri == Uris.dart__js_helper ||
1103 canonicalUri == Uris.dart__interceptors) { 1106 canonicalUri == Uris.dart__interceptors) {
1104 return true; 1107 return true;
1105 } 1108 }
1106 return false; 1109 return false;
1107 } 1110 }
1108 1111
1109 /// Process backend specific annotations. 1112 /// Process backend specific annotations.
1110 // TODO(johnniwinther): Merge this with [AnnotationProcessor] and use 1113 // TODO(johnniwinther): Merge this with [AnnotationProcessor] and use
1111 // [ElementEnvironment.getMemberMetadata] in [AnnotationProcessor]. 1114 // [ElementEnvironment.getMemberMetadata] in [AnnotationProcessor].
1112 void processAnnotations(CommonElements commonElements, MemberEntity element, 1115 void processAnnotations(
1116 ElementEnvironment elementEnvironment,
1117 CommonElements commonElements,
1118 MemberEntity element,
1113 ClosedWorldRefiner closedWorldRefiner) { 1119 ClosedWorldRefiner closedWorldRefiner) {
1114 if (element is MemberElement && element.isMalformed) { 1120 if (element is MemberElement && element.isMalformed) {
1115 // Elements that are marked as malformed during parsing or resolution 1121 // Elements that are marked as malformed during parsing or resolution
1116 // might be registered here. These should just be ignored. 1122 // might be registered here. These should just be ignored.
1117 return; 1123 return;
1118 } 1124 }
1119 1125
1120 if (element.isFunction || element.isConstructor) { 1126 if (element.isFunction || element.isConstructor) {
1121 if (optimizerHints.noInline(element)) { 1127 if (optimizerHints.noInline(element)) {
1122 inlineCache.markAsNonInlinable(element); 1128 inlineCache.markAsNonInlinable(element);
1123 } 1129 }
1124 } 1130 }
1125 if (element.isField) return; 1131 if (element.isField) return;
1126 FunctionEntity method = element; 1132 FunctionEntity method = element;
1127 1133
1128 LibraryEntity library = method.library; 1134 LibraryEntity library = method.library;
1129 if (library.canonicalUri.scheme != 'dart' && 1135 if (library.canonicalUri.scheme != 'dart' &&
1130 !canLibraryUseNative(library)) { 1136 !canLibraryUseNative(library)) {
1131 return; 1137 return;
1132 } 1138 }
1133 bool hasNoInline = false; 1139 bool hasNoInline = false;
1134 bool hasForceInline = false; 1140 bool hasForceInline = false;
1135 bool hasNoThrows = false; 1141 bool hasNoThrows = false;
1136 bool hasNoSideEffects = false; 1142 bool hasNoSideEffects = false;
1137 for (ConstantValue constantValue 1143 for (ConstantValue constantValue
1138 in compiler.elementEnvironment.getMemberMetadata(method)) { 1144 in elementEnvironment.getMemberMetadata(method)) {
1139 if (!constantValue.isConstructedObject) continue; 1145 if (!constantValue.isConstructedObject) continue;
1140 ObjectConstantValue value = constantValue; 1146 ObjectConstantValue value = constantValue;
1141 ClassEntity cls = value.type.element; 1147 ClassEntity cls = value.type.element;
1142 if (cls == commonElements.forceInlineClass) { 1148 if (cls == commonElements.forceInlineClass) {
1143 hasForceInline = true; 1149 hasForceInline = true;
1144 if (VERBOSE_OPTIMIZER_HINTS) { 1150 if (VERBOSE_OPTIMIZER_HINTS) {
1145 reporter.reportHintMessage( 1151 reporter.reportHintMessage(
1146 method, MessageKind.GENERIC, {'text': "Must inline"}); 1152 method, MessageKind.GENERIC, {'text': "Must inline"});
1147 } 1153 }
1148 inlineCache.markAsMustInline(method); 1154 inlineCache.markAsMustInline(method);
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 1393
1388 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { 1394 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) {
1389 return !selector.isGetter; 1395 return !selector.isGetter;
1390 } 1396 }
1391 1397
1392 /// Returns `true` if [member] is called from a subclass via `super`. 1398 /// Returns `true` if [member] is called from a subclass via `super`.
1393 bool isAliasedSuperMember(MemberEntity member) { 1399 bool isAliasedSuperMember(MemberEntity member) {
1394 return _aliasedSuperMembers.contains(member); 1400 return _aliasedSuperMembers.contains(member);
1395 } 1401 }
1396 } 1402 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/js_backend/element_strategy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698