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

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

Issue 2814453005: Merge CommonElements and BackendHelpers! (Closed)
Patch Set: comments and re-merge, take two Created 3 years, 8 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 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; 7 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../common/backend_api.dart' 10 import '../common/backend_api.dart'
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 import '../types/types.dart'; 53 import '../types/types.dart';
54 import '../universe/call_structure.dart' show CallStructure; 54 import '../universe/call_structure.dart' show CallStructure;
55 import '../universe/selector.dart' show Selector; 55 import '../universe/selector.dart' show Selector;
56 import '../universe/world_builder.dart'; 56 import '../universe/world_builder.dart';
57 import '../universe/use.dart' show ConstantUse, StaticUse; 57 import '../universe/use.dart' show ConstantUse, StaticUse;
58 import '../universe/world_impact.dart' 58 import '../universe/world_impact.dart'
59 show ImpactStrategy, ImpactUseCase, WorldImpact, WorldImpactVisitor; 59 show ImpactStrategy, ImpactUseCase, WorldImpact, WorldImpactVisitor;
60 import '../util/util.dart'; 60 import '../util/util.dart';
61 import '../world.dart' show ClosedWorld, ClosedWorldRefiner; 61 import '../world.dart' show ClosedWorld, ClosedWorldRefiner;
62 import 'annotations.dart'; 62 import 'annotations.dart';
63 import 'backend_helpers.dart';
64 import 'backend_impact.dart'; 63 import 'backend_impact.dart';
65 import 'backend_serialization.dart' show JavaScriptBackendSerialization; 64 import 'backend_serialization.dart' show JavaScriptBackendSerialization;
66 import 'backend_usage.dart'; 65 import 'backend_usage.dart';
67 import 'checked_mode_helpers.dart'; 66 import 'checked_mode_helpers.dart';
68 import 'codegen_listener.dart'; 67 import 'codegen_listener.dart';
69 import 'constant_handler_javascript.dart'; 68 import 'constant_handler_javascript.dart';
70 import 'custom_elements_analysis.dart'; 69 import 'custom_elements_analysis.dart';
71 import 'enqueuer.dart'; 70 import 'enqueuer.dart';
72 import 'impact_transformer.dart'; 71 import 'impact_transformer.dart';
73 import 'interceptor_data.dart'; 72 import 'interceptor_data.dart';
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } 296 }
298 297
299 enum SyntheticConstantKind { 298 enum SyntheticConstantKind {
300 DUMMY_INTERCEPTOR, 299 DUMMY_INTERCEPTOR,
301 EMPTY_VALUE, 300 EMPTY_VALUE,
302 TYPEVARIABLE_REFERENCE, // Reference to a type in reflection data. 301 TYPEVARIABLE_REFERENCE, // Reference to a type in reflection data.
303 NAME 302 NAME
304 } 303 }
305 304
306 class JavaScriptBackend { 305 class JavaScriptBackend {
306 static const String JS = 'JS';
307 static const String JS_BUILTIN = 'JS_BUILTIN';
308 static const String JS_EMBEDDED_GLOBAL = 'JS_EMBEDDED_GLOBAL';
309 static const String JS_INTERCEPTOR_CONSTANT = 'JS_INTERCEPTOR_CONSTANT';
310
307 final Compiler compiler; 311 final Compiler compiler;
308 312
309 String get patchVersion => emitter.patchVersion; 313 String get patchVersion => emitter.patchVersion;
310 314
311 /// Returns true if the backend supports reflection. 315 /// Returns true if the backend supports reflection.
312 bool get supportsReflection => emitter.supportsReflection; 316 bool get supportsReflection => emitter.supportsReflection;
313 317
314 final Annotations annotations; 318 final Annotations annotations;
315 319
316 /// Set of classes that need to be considered for reflection although not 320 /// Set of classes that need to be considered for reflection although not
317 /// otherwise visible during resolution. 321 /// otherwise visible during resolution.
318 Iterable<ClassEntity> get classesRequiredForReflection { 322 Iterable<ClassEntity> get classesRequiredForReflection {
319 // TODO(herhut): Clean this up when classes needed for rti are tracked. 323 // TODO(herhut): Clean this up when classes needed for rti are tracked.
320 return [helpers.closureClass, helpers.jsIndexableClass]; 324 return [commonElements.closureClass, commonElements.jsIndexableClass];
321 } 325 }
322 326
323 FunctionCompiler functionCompiler; 327 FunctionCompiler functionCompiler;
324 328
325 CodeEmitterTask emitter; 329 CodeEmitterTask emitter;
326 330
327 /** 331 /**
328 * The generated code as a js AST for compiled methods. 332 * The generated code as a js AST for compiled methods.
329 */ 333 */
330 final Map<MemberElement, jsAst.Expression> generatedCode = 334 final Map<MemberElement, jsAst.Expression> generatedCode =
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 BackendUsage _backendUsage; 441 BackendUsage _backendUsage;
438 BackendUsageBuilder _backendUsageBuilder; 442 BackendUsageBuilder _backendUsageBuilder;
439 MirrorsDataImpl _mirrorsData; 443 MirrorsDataImpl _mirrorsData;
440 CheckedModeHelpers _checkedModeHelpers; 444 CheckedModeHelpers _checkedModeHelpers;
441 445
442 final SuperMemberData superMemberData = new SuperMemberData(); 446 final SuperMemberData superMemberData = new SuperMemberData();
443 447
444 native.NativeResolutionEnqueuer _nativeResolutionEnqueuer; 448 native.NativeResolutionEnqueuer _nativeResolutionEnqueuer;
445 native.NativeCodegenEnqueuer _nativeCodegenEnqueuer; 449 native.NativeCodegenEnqueuer _nativeCodegenEnqueuer;
446 450
447 BackendHelpers helpers;
448 BackendImpacts impacts; 451 BackendImpacts impacts;
449 452
450 /// Common classes used by the backend. 453 /// Common classes used by the backend.
451 BackendClasses _backendClasses; 454 BackendClasses _backendClasses;
452 455
453 /// Backend access to the front-end. 456 /// Backend access to the front-end.
454 final JSFrontendAccess frontend; 457 final JSFrontendAccess frontend;
455 458
456 Target _target; 459 Target _target;
457 460
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 : _rti = new _RuntimeTypes(compiler), 493 : _rti = new _RuntimeTypes(compiler),
491 annotations = new Annotations(compiler), 494 annotations = new Annotations(compiler),
492 this.sourceInformationStrategy = createSourceInformationStrategy( 495 this.sourceInformationStrategy = createSourceInformationStrategy(
493 generateSourceMap: generateSourceMap, 496 generateSourceMap: generateSourceMap,
494 useMultiSourceInfo: useMultiSourceInfo, 497 useMultiSourceInfo: useMultiSourceInfo,
495 useNewSourceInfo: useNewSourceInfo), 498 useNewSourceInfo: useNewSourceInfo),
496 frontend = new JSFrontendAccess(compiler), 499 frontend = new JSFrontendAccess(compiler),
497 constantCompilerTask = new JavaScriptConstantTask(compiler), 500 constantCompilerTask = new JavaScriptConstantTask(compiler),
498 _nativeDataResolver = new NativeDataResolverImpl(compiler) { 501 _nativeDataResolver = new NativeDataResolverImpl(compiler) {
499 _target = new JavaScriptBackendTarget(this); 502 _target = new JavaScriptBackendTarget(this);
500 helpers = new BackendHelpers(compiler.elementEnvironment, commonElements); 503 impacts = new BackendImpacts(compiler.options, commonElements);
501 impacts = new BackendImpacts(compiler.options, commonElements, helpers);
502 _mirrorsData = new MirrorsDataImpl( 504 _mirrorsData = new MirrorsDataImpl(
503 compiler, compiler.options, commonElements, helpers, constants); 505 compiler, compiler.options, commonElements, constants);
504 _backendUsageBuilder = new BackendUsageBuilderImpl(commonElements, helpers); 506 _backendUsageBuilder = new BackendUsageBuilderImpl(commonElements);
505 _checkedModeHelpers = new CheckedModeHelpers(commonElements, helpers); 507 _checkedModeHelpers = new CheckedModeHelpers(commonElements);
506 emitter = 508 emitter =
507 new CodeEmitterTask(compiler, generateSourceMap, useStartupEmitter); 509 new CodeEmitterTask(compiler, generateSourceMap, useStartupEmitter);
508 510
509 _typeVariableResolutionAnalysis = new TypeVariableResolutionAnalysis( 511 _typeVariableResolutionAnalysis = new TypeVariableResolutionAnalysis(
510 compiler.elementEnvironment, impacts, backendUsageBuilder); 512 compiler.elementEnvironment, impacts, backendUsageBuilder);
511 jsInteropAnalysis = new JsInteropAnalysis(this); 513 jsInteropAnalysis = new JsInteropAnalysis(this);
512 _mirrorsResolutionAnalysis = 514 _mirrorsResolutionAnalysis =
513 new MirrorsResolutionAnalysisImpl(this, compiler.resolution); 515 new MirrorsResolutionAnalysisImpl(this, compiler.resolution);
514 lookupMapResolutionAnalysis = 516 lookupMapResolutionAnalysis =
515 new LookupMapResolutionAnalysis(reporter, compiler.elementEnvironment); 517 new LookupMapResolutionAnalysis(reporter, compiler.elementEnvironment);
516 518
517 noSuchMethodRegistry = 519 noSuchMethodRegistry = new NoSuchMethodRegistry(
518 new NoSuchMethodRegistry(helpers, new NoSuchMethodResolverImpl()); 520 commonElements, new NoSuchMethodResolverImpl());
519 kernelTask = new KernelTask(compiler); 521 kernelTask = new KernelTask(compiler);
520 patchResolverTask = new PatchResolverTask(compiler); 522 patchResolverTask = new PatchResolverTask(compiler);
521 functionCompiler = 523 functionCompiler =
522 new SsaFunctionCompiler(this, sourceInformationStrategy, useKernel); 524 new SsaFunctionCompiler(this, sourceInformationStrategy, useKernel);
523 serialization = new JavaScriptBackendSerialization(this); 525 serialization = new JavaScriptBackendSerialization(this);
524 } 526 }
525 527
526 /// The [ConstantSystem] used to interpret compile-time constants for this 528 /// The [ConstantSystem] used to interpret compile-time constants for this
527 /// backend. 529 /// backend.
528 ConstantSystem get constantSystem => constants.constantSystem; 530 ConstantSystem get constantSystem => constants.constantSystem;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 reporter.reportErrorMessage( 688 reporter.reportErrorMessage(
687 element, MessageKind.JS_INTEROP_INDEX_NOT_SUPPORTED); 689 element, MessageKind.JS_INTEROP_INDEX_NOT_SUPPORTED);
688 } 690 }
689 return element; 691 return element;
690 } 692 }
691 return patchResolverTask.measure(() { 693 return patchResolverTask.measure(() {
692 return patchResolverTask.resolveExternalFunction(element); 694 return patchResolverTask.resolveExternalFunction(element);
693 }); 695 });
694 } 696 }
695 697
696 bool isForeign(Element element) => element.library == helpers.foreignLibrary; 698 bool isForeign(Element element) =>
699 element.library == commonElements.foreignLibrary;
697 700
698 bool isBackendLibrary(LibraryElement library) { 701 bool isBackendLibrary(LibraryElement library) {
699 return library == helpers.interceptorsLibrary || 702 return library == commonElements.interceptorsLibrary ||
700 library == helpers.jsHelperLibrary; 703 library == compiler.commonElements.jsHelperLibrary;
701 } 704 }
702 705
703 Namer determineNamer( 706 Namer determineNamer(
704 ClosedWorld closedWorld, CodegenWorldBuilder codegenWorldBuilder) { 707 ClosedWorld closedWorld, CodegenWorldBuilder codegenWorldBuilder) {
705 return compiler.options.enableMinification 708 return compiler.options.enableMinification
706 ? compiler.options.useFrequencyNamer 709 ? compiler.options.useFrequencyNamer
707 ? new FrequencyBasedNamer( 710 ? new FrequencyBasedNamer(
708 helpers, nativeData, closedWorld, codegenWorldBuilder) 711 nativeData, closedWorld, codegenWorldBuilder)
709 : new MinifyNamer( 712 : new MinifyNamer(nativeData, closedWorld, codegenWorldBuilder)
710 helpers, nativeData, closedWorld, codegenWorldBuilder) 713 : new Namer(nativeData, closedWorld, codegenWorldBuilder);
711 : new Namer(helpers, nativeData, closedWorld, codegenWorldBuilder);
712 } 714 }
713 715
714 /// Returns true if global optimizations such as type inferencing can apply to 716 /// Returns true if global optimizations such as type inferencing can apply to
715 /// the field [element]. 717 /// the field [element].
716 /// 718 ///
717 /// One category of elements that do not apply is runtime helpers that the 719 /// One category of elements that do not apply is runtime helpers that the
718 /// backend calls, but the optimizations don't see those calls. 720 /// backend calls, but the optimizations don't see those calls.
719 bool canFieldBeUsedForGlobalOptimizations(FieldElement element) { 721 bool canFieldBeUsedForGlobalOptimizations(FieldElement element) {
720 return !backendUsage.isFieldUsedByBackend(element) && 722 return !backendUsage.isFieldUsedByBackend(element) &&
721 !mirrorsData.invokedReflectively(element); 723 !mirrorsData.invokedReflectively(element);
722 } 724 }
723 725
724 /// Returns true if global optimizations such as type inferencing can apply to 726 /// Returns true if global optimizations such as type inferencing can apply to
725 /// the parameter [element]. 727 /// the parameter [element].
726 /// 728 ///
727 /// One category of elements that do not apply is runtime helpers that the 729 /// One category of elements that do not apply is runtime helpers that the
728 /// backend calls, but the optimizations don't see those calls. 730 /// backend calls, but the optimizations don't see those calls.
729 bool canFunctionParametersBeUsedForGlobalOptimizations( 731 bool canFunctionParametersBeUsedForGlobalOptimizations(
730 FunctionElement element) { 732 FunctionElement element) {
731 if (element.isLocal) return true; 733 if (element.isLocal) return true;
732 MethodElement method = element; 734 MethodElement method = element;
733 return !backendUsage.isFunctionUsedByBackend(method) && 735 return !backendUsage.isFunctionUsedByBackend(method) &&
734 !mirrorsData.invokedReflectively(method); 736 !mirrorsData.invokedReflectively(method);
735 } 737 }
736 738
737 /// Maps compile-time classes to their runtime class. The runtime class is 739 /// Maps compile-time classes to their runtime class. The runtime class is
738 /// always a superclass or the class itself. 740 /// always a superclass or the class itself.
739 ClassElement getRuntimeClass(ClassElement class_) { 741 ClassElement getRuntimeClass(ClassElement class_) {
740 if (class_.isSubclassOf(helpers.jsIntClass)) return helpers.jsIntClass; 742 if (class_.isSubclassOf(commonElements.jsIntClass))
741 if (class_.isSubclassOf(helpers.jsArrayClass)) return helpers.jsArrayClass; 743 return commonElements.jsIntClass;
744 if (class_.isSubclassOf(commonElements.jsArrayClass))
745 return commonElements.jsArrayClass;
742 return class_; 746 return class_;
743 } 747 }
744 748
745 bool operatorEqHandlesNullArgument(FunctionElement operatorEqfunction) { 749 bool operatorEqHandlesNullArgument(FunctionElement operatorEqfunction) {
746 return specialOperatorEqClasses.contains(operatorEqfunction.enclosingClass); 750 return specialOperatorEqClasses.contains(operatorEqfunction.enclosingClass);
747 } 751 }
748 752
749 void validateInterceptorImplementsAllObjectMethods( 753 void validateInterceptorImplementsAllObjectMethods(
750 ClassElement interceptorClass) { 754 ClassElement interceptorClass) {
751 if (interceptorClass == null) return; 755 if (interceptorClass == null) return;
752 interceptorClass.ensureResolved(resolution); 756 interceptorClass.ensureResolved(resolution);
753 ClassElement objectClass = commonElements.objectClass; 757 ClassElement objectClass = commonElements.objectClass;
754 objectClass.forEachMember((_, Element member) { 758 objectClass.forEachMember((_, Element member) {
755 if (member.isGenerativeConstructor) return; 759 if (member.isGenerativeConstructor) return;
756 Element interceptorMember = interceptorClass.lookupMember(member.name); 760 Element interceptorMember = interceptorClass.lookupMember(member.name);
757 // Interceptors must override all Object methods due to calling convention 761 // Interceptors must override all Object methods due to calling convention
758 // differences. 762 // differences.
759 assert(invariant(interceptorMember, 763 assert(invariant(interceptorMember,
760 interceptorMember.enclosingClass == interceptorClass, 764 interceptorMember.enclosingClass == interceptorClass,
761 message: 765 message:
762 "Member ${member.name} not overridden in ${interceptorClass}. " 766 "Member ${member.name} not overridden in ${interceptorClass}. "
763 "Found $interceptorMember from " 767 "Found $interceptorMember from "
764 "${interceptorMember.enclosingClass}.")); 768 "${interceptorMember.enclosingClass}."));
765 }); 769 });
766 } 770 }
767 771
768 void onResolutionStart(ResolutionEnqueuer enqueuer) { 772 void onResolutionStart(ResolutionEnqueuer enqueuer) {
769 helpers.onResolutionStart(); 773 // TODO(johnniwinther): Avoid the compiler.elementEnvironment.getThisType
774 // calls. Currently needed to ensure resolution of the classes for various
775 // queries in native behavior computation, inference and codegen.
776 compiler.elementEnvironment.getThisType(commonElements.jsArrayClass);
777 compiler.elementEnvironment
778 .getThisType(commonElements.jsExtendableArrayClass);
770 779
771 validateInterceptorImplementsAllObjectMethods(helpers.jsInterceptorClass); 780 validateInterceptorImplementsAllObjectMethods(
781 commonElements.jsInterceptorClass);
772 // The null-interceptor must also implement *all* methods. 782 // The null-interceptor must also implement *all* methods.
773 validateInterceptorImplementsAllObjectMethods(helpers.jsNullClass); 783 validateInterceptorImplementsAllObjectMethods(commonElements.jsNullClass);
774 } 784 }
775 785
776 void onResolutionComplete( 786 void onResolutionComplete(
777 ClosedWorld closedWorld, ClosedWorldRefiner closedWorldRefiner) { 787 ClosedWorld closedWorld, ClosedWorldRefiner closedWorldRefiner) {
778 for (Entity entity in compiler.enqueuer.resolution.processedEntities) { 788 for (Entity entity in compiler.enqueuer.resolution.processedEntities) {
779 processAnnotations(entity, closedWorldRefiner); 789 processAnnotations(entity, closedWorldRefiner);
780 } 790 }
781 mirrorsDataBuilder.computeMembersNeededForReflection( 791 mirrorsDataBuilder.computeMembersNeededForReflection(
782 compiler.enqueuer.resolution.worldBuilder, closedWorld); 792 compiler.enqueuer.resolution.worldBuilder, closedWorld);
783 _backendUsage = backendUsageBuilder.close(); 793 _backendUsage = backendUsageBuilder.close();
784 _rtiNeed = rtiNeedBuilder.computeRuntimeTypesNeed( 794 _rtiNeed = rtiNeedBuilder.computeRuntimeTypesNeed(
785 compiler.enqueuer.resolution.worldBuilder, 795 compiler.enqueuer.resolution.worldBuilder,
786 closedWorld, 796 closedWorld,
787 compiler.types, 797 compiler.types,
788 commonElements, 798 commonElements,
789 helpers,
790 _backendUsage, 799 _backendUsage,
791 enableTypeAssertions: compiler.options.enableTypeAssertions); 800 enableTypeAssertions: compiler.options.enableTypeAssertions);
792 _interceptorData = interceptorDataBuilder.onResolutionComplete(closedWorld); 801 _interceptorData = interceptorDataBuilder.onResolutionComplete(closedWorld);
793 _oneShotInterceptorData = 802 _oneShotInterceptorData =
794 new OneShotInterceptorData(interceptorData, helpers); 803 new OneShotInterceptorData(interceptorData, commonElements);
795 mirrorsResolutionAnalysis.onResolutionComplete(); 804 mirrorsResolutionAnalysis.onResolutionComplete();
796 } 805 }
797 806
798 void onTypeInferenceComplete(GlobalTypeInferenceResults results) { 807 void onTypeInferenceComplete(GlobalTypeInferenceResults results) {
799 noSuchMethodRegistry.onTypeInferenceComplete(results); 808 noSuchMethodRegistry.onTypeInferenceComplete(results);
800 } 809 }
801 810
802 /// Called when resolving a call to a foreign function. 811 /// Called when resolving a call to a foreign function.
803 native.NativeBehavior resolveForeignCall(Send node, Element element, 812 native.NativeBehavior resolveForeignCall(Send node, Element element,
804 CallStructure callStructure, ForeignResolver resolver) { 813 CallStructure callStructure, ForeignResolver resolver) {
805 if (element.name == BackendHelpers.JS) { 814 if (element.name == JS) {
806 return _nativeDataResolver.resolveJsCall(node, resolver); 815 return _nativeDataResolver.resolveJsCall(node, resolver);
807 } else if (element.name == BackendHelpers.JS_EMBEDDED_GLOBAL) { 816 } else if (element.name == JS_EMBEDDED_GLOBAL) {
808 return _nativeDataResolver.resolveJsEmbeddedGlobalCall(node, resolver); 817 return _nativeDataResolver.resolveJsEmbeddedGlobalCall(node, resolver);
809 } else if (element.name == BackendHelpers.JS_BUILTIN) { 818 } else if (element.name == JS_BUILTIN) {
810 return _nativeDataResolver.resolveJsBuiltinCall(node, resolver); 819 return _nativeDataResolver.resolveJsBuiltinCall(node, resolver);
811 } else if (element.name == BackendHelpers.JS_INTERCEPTOR_CONSTANT) { 820 } else if (element.name == JS_INTERCEPTOR_CONSTANT) {
812 // The type constant that is an argument to JS_INTERCEPTOR_CONSTANT names 821 // The type constant that is an argument to JS_INTERCEPTOR_CONSTANT names
813 // a class that will be instantiated outside the program by attaching a 822 // a class that will be instantiated outside the program by attaching a
814 // native class dispatch record referencing the interceptor. 823 // native class dispatch record referencing the interceptor.
815 if (!node.argumentsNode.isEmpty) { 824 if (!node.argumentsNode.isEmpty) {
816 Node argument = node.argumentsNode.nodes.head; 825 Node argument = node.argumentsNode.nodes.head;
817 ConstantExpression constant = resolver.getConstant(argument); 826 ConstantExpression constant = resolver.getConstant(argument);
818 if (constant != null && constant.kind == ConstantExpressionKind.TYPE) { 827 if (constant != null && constant.kind == ConstantExpressionKind.TYPE) {
819 TypeConstantExpression typeConstant = constant; 828 TypeConstantExpression typeConstant = constant;
820 if (typeConstant.type is ResolutionInterfaceType) { 829 if (typeConstant.type is ResolutionInterfaceType) {
821 resolver.registerInstantiatedType(typeConstant.type); 830 resolver.registerInstantiatedType(typeConstant.type);
822 // No native behavior for this call. 831 // No native behavior for this call.
823 return null; 832 return null;
824 } 833 }
825 } 834 }
826 } 835 }
827 reporter.reportErrorMessage( 836 reporter.reportErrorMessage(
828 node, MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT); 837 node, MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT);
829 } 838 }
830 // No native behavior for this call. 839 // No native behavior for this call.
831 return null; 840 return null;
832 } 841 }
833 842
834 ResolutionEnqueuer createResolutionEnqueuer( 843 ResolutionEnqueuer createResolutionEnqueuer(
835 CompilerTask task, Compiler compiler) { 844 CompilerTask task, Compiler compiler) {
836 _nativeBasicData = 845 _nativeBasicData =
837 nativeBasicDataBuilder.close(compiler.elementEnvironment); 846 nativeBasicDataBuilder.close(compiler.elementEnvironment);
838 _backendClasses = new JavaScriptBackendClasses( 847 _backendClasses = new JavaScriptBackendClasses(
839 compiler.elementEnvironment, helpers, nativeBasicData); 848 compiler.elementEnvironment, commonElements, nativeBasicData);
840 _nativeResolutionEnqueuer = new native.NativeResolutionEnqueuer( 849 _nativeResolutionEnqueuer = new native.NativeResolutionEnqueuer(
841 compiler.options, 850 compiler.options,
842 compiler.elementEnvironment, 851 compiler.elementEnvironment,
843 commonElements, 852 commonElements,
844 helpers,
845 backendClasses, 853 backendClasses,
846 backendUsageBuilder, 854 backendUsageBuilder,
847 new NativeClassResolverImpl( 855 new NativeClassResolverImpl(
848 compiler.resolution, reporter, helpers, nativeBasicData)); 856 compiler.resolution, reporter, commonElements, nativeBasicData));
849 _nativeData = new NativeDataImpl(nativeBasicData); 857 _nativeData = new NativeDataImpl(nativeBasicData);
850 _customElementsResolutionAnalysis = new CustomElementsResolutionAnalysis( 858 _customElementsResolutionAnalysis = new CustomElementsResolutionAnalysis(
851 compiler.resolution, 859 compiler.resolution,
852 constantSystem, 860 constantSystem,
853 commonElements, 861 commonElements,
854 backendClasses, 862 backendClasses,
855 helpers,
856 nativeBasicData, 863 nativeBasicData,
857 backendUsageBuilder); 864 backendUsageBuilder);
858 impactTransformer = new JavaScriptImpactTransformer( 865 impactTransformer = new JavaScriptImpactTransformer(
859 compiler.options, 866 compiler.options,
860 compiler.elementEnvironment, 867 compiler.elementEnvironment,
861 commonElements, 868 commonElements,
862 impacts, 869 impacts,
863 nativeBasicData, 870 nativeBasicData,
864 _nativeResolutionEnqueuer, 871 _nativeResolutionEnqueuer,
865 backendUsageBuilder, 872 backendUsageBuilder,
866 mirrorsDataBuilder, 873 mirrorsDataBuilder,
867 customElementsResolutionAnalysis, 874 customElementsResolutionAnalysis,
868 rtiNeedBuilder); 875 rtiNeedBuilder);
869 _interceptorDataBuilder = new InterceptorDataBuilderImpl( 876 _interceptorDataBuilder = new InterceptorDataBuilderImpl(
870 nativeBasicData, helpers, compiler.elementEnvironment, commonElements); 877 nativeBasicData, compiler.elementEnvironment, commonElements);
871 return new ResolutionEnqueuer( 878 return new ResolutionEnqueuer(
872 task, 879 task,
873 compiler.options, 880 compiler.options,
874 compiler.reporter, 881 compiler.reporter,
875 compiler.options.analyzeOnly && compiler.options.analyzeMain 882 compiler.options.analyzeOnly && compiler.options.analyzeMain
876 ? const DirectEnqueuerStrategy() 883 ? const DirectEnqueuerStrategy()
877 : const TreeShakingEnqueuerStrategy(), 884 : const TreeShakingEnqueuerStrategy(),
878 new ResolutionEnqueuerListener( 885 new ResolutionEnqueuerListener(
879 compiler.options, 886 compiler.options,
880 compiler.elementEnvironment, 887 compiler.elementEnvironment,
881 commonElements, 888 commonElements,
882 helpers,
883 impacts, 889 impacts,
884 backendClasses, 890 backendClasses,
885 nativeBasicData, 891 nativeBasicData,
886 interceptorDataBuilder, 892 interceptorDataBuilder,
887 backendUsageBuilder, 893 backendUsageBuilder,
888 rtiNeedBuilder, 894 rtiNeedBuilder,
889 mirrorsDataBuilder, 895 mirrorsDataBuilder,
890 noSuchMethodRegistry, 896 noSuchMethodRegistry,
891 customElementsResolutionAnalysis, 897 customElementsResolutionAnalysis,
892 lookupMapResolutionAnalysis, 898 lookupMapResolutionAnalysis,
893 mirrorsResolutionAnalysis, 899 mirrorsResolutionAnalysis,
894 typeVariableResolutionAnalysis, 900 typeVariableResolutionAnalysis,
895 _nativeResolutionEnqueuer, 901 _nativeResolutionEnqueuer,
896 compiler.deferredLoadTask, 902 compiler.deferredLoadTask,
897 kernelTask), 903 kernelTask),
898 new ElementResolutionWorldBuilder( 904 new ElementResolutionWorldBuilder(
899 this, compiler.resolution, const OpenWorldStrategy()), 905 this, compiler.resolution, const OpenWorldStrategy()),
900 new ResolutionWorkItemBuilder(compiler.resolution)); 906 new ResolutionWorkItemBuilder(compiler.resolution));
901 } 907 }
902 908
903 /// Creates an [Enqueuer] for code generation specific to this backend. 909 /// Creates an [Enqueuer] for code generation specific to this backend.
904 CodegenEnqueuer createCodegenEnqueuer( 910 CodegenEnqueuer createCodegenEnqueuer(
905 CompilerTask task, Compiler compiler, ClosedWorld closedWorld) { 911 CompilerTask task, Compiler compiler, ClosedWorld closedWorld) {
906 _typeVariableCodegenAnalysis = new TypeVariableCodegenAnalysis( 912 _typeVariableCodegenAnalysis = new TypeVariableCodegenAnalysis(
907 compiler.elementEnvironment, this, helpers, mirrorsData); 913 compiler.elementEnvironment, this, commonElements, mirrorsData);
908 _lookupMapAnalysis = new LookupMapAnalysis( 914 _lookupMapAnalysis = new LookupMapAnalysis(
909 reporter, 915 reporter,
910 constantSystem, 916 constantSystem,
911 constants, 917 constants,
912 compiler.elementEnvironment, 918 compiler.elementEnvironment,
913 commonElements, 919 commonElements,
914 helpers,
915 backendClasses, 920 backendClasses,
916 lookupMapResolutionAnalysis); 921 lookupMapResolutionAnalysis);
917 _mirrorsCodegenAnalysis = mirrorsResolutionAnalysis.close(); 922 _mirrorsCodegenAnalysis = mirrorsResolutionAnalysis.close();
918 _customElementsCodegenAnalysis = new CustomElementsCodegenAnalysis( 923 _customElementsCodegenAnalysis = new CustomElementsCodegenAnalysis(
919 compiler.resolution, 924 compiler.resolution,
920 constantSystem, 925 constantSystem,
921 commonElements, 926 commonElements,
922 backendClasses, 927 backendClasses,
923 helpers,
924 nativeBasicData); 928 nativeBasicData);
925 _nativeCodegenEnqueuer = new native.NativeCodegenEnqueuer( 929 _nativeCodegenEnqueuer = new native.NativeCodegenEnqueuer(
926 compiler.options, 930 compiler.options,
927 compiler.elementEnvironment, 931 compiler.elementEnvironment,
928 commonElements, 932 commonElements,
929 helpers,
930 backendClasses, 933 backendClasses,
931 emitter, 934 emitter,
932 _nativeResolutionEnqueuer, 935 _nativeResolutionEnqueuer,
933 nativeData); 936 nativeData);
934 return new CodegenEnqueuer( 937 return new CodegenEnqueuer(
935 task, 938 task,
936 compiler.options, 939 compiler.options,
937 const TreeShakingEnqueuerStrategy(), 940 const TreeShakingEnqueuerStrategy(),
938 new CodegenWorldBuilderImpl( 941 new CodegenWorldBuilderImpl(
939 nativeBasicData, closedWorld, constants, const TypeMaskStrategy()), 942 nativeBasicData, closedWorld, constants, const TypeMaskStrategy()),
940 new CodegenWorkItemBuilder(this, compiler.options), 943 new CodegenWorkItemBuilder(this, compiler.options),
941 new CodegenEnqueuerListener( 944 new CodegenEnqueuerListener(
942 compiler.elementEnvironment, 945 compiler.elementEnvironment,
943 commonElements, 946 commonElements,
944 helpers,
945 impacts, 947 impacts,
946 backendClasses, 948 backendClasses,
947 backendUsage, 949 backendUsage,
948 rtiNeed, 950 rtiNeed,
949 customElementsCodegenAnalysis, 951 customElementsCodegenAnalysis,
950 typeVariableCodegenAnalysis, 952 typeVariableCodegenAnalysis,
951 lookupMapAnalysis, 953 lookupMapAnalysis,
952 mirrorsCodegenAnalysis, 954 mirrorsCodegenAnalysis,
953 nativeCodegenEnqueuer)); 955 nativeCodegenEnqueuer));
954 } 956 }
(...skipping 11 matching lines...) Expand all
966 js.escapedString("Compile time error in $element: $messageText"); 968 js.escapedString("Compile time error in $element: $messageText");
967 generatedCode[element] = 969 generatedCode[element] =
968 js("function () { throw new Error(#); }", [messageLiteral]); 970 js("function () { throw new Error(#); }", [messageLiteral]);
969 return const CodegenImpact(); 971 return const CodegenImpact();
970 } 972 }
971 var kind = element.kind; 973 var kind = element.kind;
972 if (kind == ElementKind.TYPEDEF) { 974 if (kind == ElementKind.TYPEDEF) {
973 return const WorldImpact(); 975 return const WorldImpact();
974 } 976 }
975 if (element.isConstructor && 977 if (element.isConstructor &&
976 element.enclosingClass == helpers.jsNullClass) { 978 element.enclosingClass == commonElements.jsNullClass) {
977 // Work around a problem compiling JSNull's constructor. 979 // Work around a problem compiling JSNull's constructor.
978 return const CodegenImpact(); 980 return const CodegenImpact();
979 } 981 }
980 if (kind.category == ElementCategory.VARIABLE) { 982 if (kind.category == ElementCategory.VARIABLE) {
981 FieldElement variableElement = element; 983 FieldElement variableElement = element;
982 ConstantExpression constant = variableElement.constant; 984 ConstantExpression constant = variableElement.constant;
983 if (constant != null) { 985 if (constant != null) {
984 ConstantValue initialValue = constants.getConstantValue(constant); 986 ConstantValue initialValue = constants.getConstantValue(constant);
985 if (initialValue != null) { 987 if (initialValue != null) {
986 work.registry.worldImpact 988 work.registry.worldImpact
(...skipping 13 matching lines...) Expand all
1000 constant.isPotential, 1002 constant.isPotential,
1001 message: "Constant expression without value: " 1003 message: "Constant expression without value: "
1002 "${constant.toStructuredText()}.")); 1004 "${constant.toStructuredText()}."));
1003 } 1005 }
1004 } else { 1006 } else {
1005 // If the constant-handler was not able to produce a result we have to 1007 // If the constant-handler was not able to produce a result we have to
1006 // go through the builder (below) to generate the lazy initializer for 1008 // go through the builder (below) to generate the lazy initializer for
1007 // the static variable. 1009 // the static variable.
1008 // We also need to register the use of the cyclic-error helper. 1010 // We also need to register the use of the cyclic-error helper.
1009 work.registry.worldImpact.registerStaticUse(new StaticUse.staticInvoke( 1011 work.registry.worldImpact.registerStaticUse(new StaticUse.staticInvoke(
1010 helpers.cyclicThrowHelper, CallStructure.ONE_ARG)); 1012 commonElements.cyclicThrowHelper, CallStructure.ONE_ARG));
1011 } 1013 }
1012 } 1014 }
1013 1015
1014 jsAst.Fun function = functionCompiler.compile(work, _closedWorld); 1016 jsAst.Fun function = functionCompiler.compile(work, _closedWorld);
1015 if (function.sourceInformation == null) { 1017 if (function.sourceInformation == null) {
1016 function = function.withSourceInformation( 1018 function = function.withSourceInformation(
1017 sourceInformationStrategy.buildSourceMappedMarker()); 1019 sourceInformationStrategy.buildSourceMappedMarker());
1018 } 1020 }
1019 generatedCode[element] = function; 1021 generatedCode[element] = function;
1020 WorldImpact worldImpact = _codegenImpactTransformer 1022 WorldImpact worldImpact = _codegenImpactTransformer
1021 .transformCodegenImpact(work.registry.worldImpact); 1023 .transformCodegenImpact(work.registry.worldImpact);
1022 compiler.dumpInfoTask.registerImpact(element, worldImpact); 1024 compiler.dumpInfoTask.registerImpact(element, worldImpact);
1023 return worldImpact; 1025 return worldImpact;
1024 } 1026 }
1025 1027
1026 // TODO(johnniwinther): Remove this. It is now only used for testing. 1028 // TODO(johnniwinther): Remove this. It is now only used for testing.
1027 @deprecated 1029 @deprecated
1028 native.NativeEnqueuer get nativeResolutionEnqueuer => 1030 native.NativeEnqueuer get nativeResolutionEnqueuer =>
1029 _nativeResolutionEnqueuer; 1031 _nativeResolutionEnqueuer;
1030 1032
1031 native.NativeEnqueuer get nativeCodegenEnqueuer => _nativeCodegenEnqueuer; 1033 native.NativeEnqueuer get nativeCodegenEnqueuer => _nativeCodegenEnqueuer;
1032 1034
1033 ClassElement defaultSuperclass(ClassElement element) { 1035 ClassElement defaultSuperclass(ClassElement element) {
1034 if (nativeBasicData.isJsInteropClass(element)) { 1036 if (nativeBasicData.isJsInteropClass(element)) {
1035 return helpers.jsJavaScriptObjectClass; 1037 return commonElements.jsJavaScriptObjectClass;
1036 } 1038 }
1037 // Native classes inherit from Interceptor. 1039 // Native classes inherit from Interceptor.
1038 return nativeBasicData.isNativeClass(element) 1040 return nativeBasicData.isNativeClass(element)
1039 ? helpers.jsInterceptorClass 1041 ? commonElements.jsInterceptorClass
1040 : commonElements.objectClass; 1042 : commonElements.objectClass;
1041 } 1043 }
1042 1044
1043 /** 1045 /**
1044 * Unit test hook that returns code of an element as a String. 1046 * Unit test hook that returns code of an element as a String.
1045 * 1047 *
1046 * Invariant: [element] must be a declaration element. 1048 * Invariant: [element] must be a declaration element.
1047 */ 1049 */
1048 String getGeneratedCode(Element element) { 1050 String getGeneratedCode(Element element) {
1049 assert(invariant(element, element.isDeclaration)); 1051 assert(invariant(element, element.isDeclaration));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 * Returns [:true:] if the checking of [type] is performed directly on the 1098 * Returns [:true:] if the checking of [type] is performed directly on the
1097 * object and not on an interceptor. 1099 * object and not on an interceptor.
1098 */ 1100 */
1099 bool hasDirectCheckFor(ResolutionDartType type) { 1101 bool hasDirectCheckFor(ResolutionDartType type) {
1100 Element element = type.element; 1102 Element element = type.element;
1101 return element == commonElements.stringClass || 1103 return element == commonElements.stringClass ||
1102 element == commonElements.boolClass || 1104 element == commonElements.boolClass ||
1103 element == commonElements.numClass || 1105 element == commonElements.numClass ||
1104 element == commonElements.intClass || 1106 element == commonElements.intClass ||
1105 element == commonElements.doubleClass || 1107 element == commonElements.doubleClass ||
1106 element == helpers.jsArrayClass || 1108 element == commonElements.jsArrayClass ||
1107 element == helpers.jsMutableArrayClass || 1109 element == commonElements.jsMutableArrayClass ||
1108 element == helpers.jsExtendableArrayClass || 1110 element == commonElements.jsExtendableArrayClass ||
1109 element == helpers.jsFixedArrayClass || 1111 element == commonElements.jsFixedArrayClass ||
1110 element == helpers.jsUnmodifiableArrayClass; 1112 element == commonElements.jsUnmodifiableArrayClass;
1111 } 1113 }
1112 1114
1113 /// This method is called immediately after the [library] and its parts have 1115 /// This method is called immediately after the [library] and its parts have
1114 /// been loaded. 1116 /// been loaded.
1115 void setAnnotations(LibraryElement library) { 1117 void setAnnotations(LibraryElement library) {
1116 if (!compiler.serialization.isDeserialized(library)) { 1118 if (!compiler.serialization.isDeserialized(library)) {
1117 if (canLibraryUseNative(library)) { 1119 if (canLibraryUseNative(library)) {
1118 library.forEachLocalMember((Element element) { 1120 library.forEachLocalMember((Element element) {
1119 if (element.isClass) { 1121 if (element.isClass) {
1120 checkNativeAnnotation(compiler, element, nativeBasicDataBuilder); 1122 checkNativeAnnotation(compiler, element, nativeBasicDataBuilder);
1121 } 1123 }
1122 }); 1124 });
1123 } 1125 }
1124 checkJsInteropClassAnnotations(compiler, library, nativeBasicDataBuilder); 1126 checkJsInteropClassAnnotations(compiler, library, nativeBasicDataBuilder);
1125 } 1127 }
1126 Uri uri = library.canonicalUri; 1128 Uri uri = library.canonicalUri;
1127 if (uri == Uris.dart_html) { 1129 if (uri == Uris.dart_html) {
1128 htmlLibraryIsLoaded = true; 1130 htmlLibraryIsLoaded = true;
1129 } else if (uri == LookupMapResolutionAnalysis.PACKAGE_LOOKUP_MAP) { 1131 } else if (uri == LookupMapResolutionAnalysis.PACKAGE_LOOKUP_MAP) {
1130 lookupMapResolutionAnalysis.init(library); 1132 lookupMapResolutionAnalysis.init(library);
1131 } 1133 }
1132 annotations.onLibraryLoaded(library); 1134 annotations.onLibraryLoaded(library);
1133 } 1135 }
1134 1136
1135 /// This method is called when all new libraries loaded through 1137 /// This method is called when all new libraries loaded through
1136 /// [LibraryLoader.loadLibrary] has been loaded and their imports/exports 1138 /// [LibraryLoader.loadLibrary] has been loaded and their imports/exports
1137 /// have been computed. 1139 /// have been computed.
1138 void onLibrariesLoaded(LoadedLibraries loadedLibraries) { 1140 void onLibrariesLoaded(LoadedLibraries loadedLibraries) {
1139 if (loadedLibraries.containsLibrary(Uris.dart_core)) { 1141 if (loadedLibraries.containsLibrary(Uris.dart_core)) {
1140 helpers.onLibrariesLoaded(loadedLibraries); 1142 assert(loadedLibraries.containsLibrary(Uris.dart_core));
1143 assert(loadedLibraries.containsLibrary(Uris.dart__interceptors));
1144 assert(loadedLibraries.containsLibrary(Uris.dart__js_helper));
1141 1145
1142 // These methods are overwritten with generated versions. 1146 // These methods are overwritten with generated versions.
1143 inlineCache.markAsNonInlinable(helpers.getInterceptorMethod, 1147 inlineCache.markAsNonInlinable(commonElements.getInterceptorMethod,
1144 insideLoop: true); 1148 insideLoop: true);
1145 1149
1146 specialOperatorEqClasses 1150 specialOperatorEqClasses
1147 ..add(commonElements.objectClass) 1151 ..add(commonElements.objectClass)
1148 ..add(helpers.jsInterceptorClass) 1152 ..add(commonElements.jsInterceptorClass)
1149 ..add(helpers.jsNullClass); 1153 ..add(commonElements.jsNullClass);
1150 } 1154 }
1151 } 1155 }
1152 1156
1153 jsAst.Call generateIsJsIndexableCall( 1157 jsAst.Call generateIsJsIndexableCall(
1154 jsAst.Expression use1, jsAst.Expression use2) { 1158 jsAst.Expression use1, jsAst.Expression use2) {
1155 String dispatchPropertyName = embeddedNames.DISPATCH_PROPERTY_NAME; 1159 String dispatchPropertyName = embeddedNames.DISPATCH_PROPERTY_NAME;
1156 jsAst.Expression dispatchProperty = 1160 jsAst.Expression dispatchProperty =
1157 emitter.generateEmbeddedGlobalAccess(dispatchPropertyName); 1161 emitter.generateEmbeddedGlobalAccess(dispatchPropertyName);
1158 1162
1159 // We pass the dispatch property record to the isJsIndexable 1163 // We pass the dispatch property record to the isJsIndexable
1160 // helper rather than reading it inside the helper to increase the 1164 // helper rather than reading it inside the helper to increase the
1161 // chance of making the dispatch record access monomorphic. 1165 // chance of making the dispatch record access monomorphic.
1162 jsAst.PropertyAccess record = 1166 jsAst.PropertyAccess record =
1163 new jsAst.PropertyAccess(use2, dispatchProperty); 1167 new jsAst.PropertyAccess(use2, dispatchProperty);
1164 1168
1165 List<jsAst.Expression> arguments = <jsAst.Expression>[use1, record]; 1169 List<jsAst.Expression> arguments = <jsAst.Expression>[use1, record];
1166 MethodElement helper = helpers.isJsIndexable; 1170 MethodElement helper = commonElements.isJsIndexable;
1167 jsAst.Expression helperExpression = emitter.staticFunctionAccess(helper); 1171 jsAst.Expression helperExpression = emitter.staticFunctionAccess(helper);
1168 return new jsAst.Call(helperExpression, arguments); 1172 return new jsAst.Call(helperExpression, arguments);
1169 } 1173 }
1170 1174
1171 /// Called after the queue is closed. [onQueueEmpty] may be called multiple 1175 /// Called after the queue is closed. [onQueueEmpty] may be called multiple
1172 /// times, but [onQueueClosed] is only called once. 1176 /// times, but [onQueueClosed] is only called once.
1173 void onQueueClosed() { 1177 void onQueueClosed() {
1174 jsInteropAnalysis.onQueueClosed(); 1178 jsInteropAnalysis.onQueueClosed();
1175 } 1179 }
1176 1180
(...skipping 11 matching lines...) Expand all
1188 } 1192 }
1189 1193
1190 /// Called when the compiler starts running the codegen enqueuer. The 1194 /// Called when the compiler starts running the codegen enqueuer. The
1191 /// [WorldImpact] of enabled backend features is returned. 1195 /// [WorldImpact] of enabled backend features is returned.
1192 WorldImpact onCodegenStart( 1196 WorldImpact onCodegenStart(
1193 ClosedWorld closedWorld, CodegenWorldBuilder codegenWorldBuilder) { 1197 ClosedWorld closedWorld, CodegenWorldBuilder codegenWorldBuilder) {
1194 _closedWorld = closedWorld; 1198 _closedWorld = closedWorld;
1195 _namer = determineNamer(closedWorld, codegenWorldBuilder); 1199 _namer = determineNamer(closedWorld, codegenWorldBuilder);
1196 tracer = new Tracer(closedWorld, namer, compiler); 1200 tracer = new Tracer(closedWorld, namer, compiler);
1197 emitter.createEmitter(namer, closedWorld); 1201 emitter.createEmitter(namer, closedWorld);
1198 _rtiEncoder = 1202 _rtiEncoder = _namer.rtiEncoder =
1199 _namer.rtiEncoder = new _RuntimeTypesEncoder(namer, emitter, helpers); 1203 new _RuntimeTypesEncoder(namer, emitter, commonElements);
1200 _codegenImpactTransformer = new CodegenImpactTransformer( 1204 _codegenImpactTransformer = new CodegenImpactTransformer(
1201 compiler.options, 1205 compiler.options,
1202 compiler.elementEnvironment, 1206 compiler.elementEnvironment,
1203 helpers, 1207 commonElements,
1204 impacts, 1208 impacts,
1205 checkedModeHelpers, 1209 checkedModeHelpers,
1206 nativeData, 1210 nativeData,
1207 backendUsage, 1211 backendUsage,
1208 rtiNeed, 1212 rtiNeed,
1209 nativeCodegenEnqueuer, 1213 nativeCodegenEnqueuer,
1210 namer, 1214 namer,
1211 oneShotInterceptorData, 1215 oneShotInterceptorData,
1212 lookupMapAnalysis, 1216 lookupMapAnalysis,
1213 rtiChecksBuilder); 1217 rtiChecksBuilder);
1214 return const WorldImpact(); 1218 return const WorldImpact();
1215 } 1219 }
1216 1220
1217 /// Called when code generation has been completed. 1221 /// Called when code generation has been completed.
1218 void onCodegenEnd() { 1222 void onCodegenEnd() {
1219 sourceInformationStrategy.onComplete(); 1223 sourceInformationStrategy.onComplete();
1220 tracer.close(); 1224 tracer.close();
1221 } 1225 }
1222 1226
1223 // Does this element belong in the output 1227 // Does this element belong in the output
1224 bool shouldOutput(Element element) => true; 1228 bool shouldOutput(Element element) => true;
1225 1229
1226 /// Returns `true` if the `native` pseudo keyword is supported for [library]. 1230 /// Returns `true` if the `native` pseudo keyword is supported for [library].
1227 bool canLibraryUseNative(LibraryElement library) { 1231 bool canLibraryUseNative(LibraryElement library) {
1228 return native.maybeEnableNative(compiler, library); 1232 return native.maybeEnableNative(compiler, library);
1229 } 1233 }
1230 1234
1231 bool isTargetSpecificLibrary(LibraryElement library) { 1235 bool isTargetSpecificLibrary(LibraryElement library) {
1232 Uri canonicalUri = library.canonicalUri; 1236 Uri canonicalUri = library.canonicalUri;
1233 if (canonicalUri == BackendHelpers.DART_JS_HELPER || 1237 if (canonicalUri == Uris.dart__js_helper ||
1234 canonicalUri == BackendHelpers.DART_INTERCEPTORS) { 1238 canonicalUri == Uris.dart__interceptors) {
1235 return true; 1239 return true;
1236 } 1240 }
1237 return false; 1241 return false;
1238 } 1242 }
1239 1243
1240 /// Process backend specific annotations. 1244 /// Process backend specific annotations.
1241 void processAnnotations( 1245 void processAnnotations(
1242 Element element, ClosedWorldRefiner closedWorldRefiner) { 1246 Element element, ClosedWorldRefiner closedWorldRefiner) {
1243 if (element.isMalformed) { 1247 if (element.isMalformed) {
1244 // Elements that are marked as malformed during parsing or resolution 1248 // Elements that are marked as malformed during parsing or resolution
(...skipping 14 matching lines...) Expand all
1259 bool hasForceInline = false; 1263 bool hasForceInline = false;
1260 bool hasNoThrows = false; 1264 bool hasNoThrows = false;
1261 bool hasNoSideEffects = false; 1265 bool hasNoSideEffects = false;
1262 for (MetadataAnnotation metadata in element.implementation.metadata) { 1266 for (MetadataAnnotation metadata in element.implementation.metadata) {
1263 metadata.ensureResolved(resolution); 1267 metadata.ensureResolved(resolution);
1264 ConstantValue constantValue = 1268 ConstantValue constantValue =
1265 compiler.constants.getConstantValue(metadata.constant); 1269 compiler.constants.getConstantValue(metadata.constant);
1266 if (!constantValue.isConstructedObject) continue; 1270 if (!constantValue.isConstructedObject) continue;
1267 ObjectConstantValue value = constantValue; 1271 ObjectConstantValue value = constantValue;
1268 ClassElement cls = value.type.element; 1272 ClassElement cls = value.type.element;
1269 if (cls == helpers.forceInlineClass) { 1273 if (cls == commonElements.forceInlineClass) {
1270 hasForceInline = true; 1274 hasForceInline = true;
1271 if (VERBOSE_OPTIMIZER_HINTS) { 1275 if (VERBOSE_OPTIMIZER_HINTS) {
1272 reporter.reportHintMessage( 1276 reporter.reportHintMessage(
1273 element, MessageKind.GENERIC, {'text': "Must inline"}); 1277 element, MessageKind.GENERIC, {'text': "Must inline"});
1274 } 1278 }
1275 inlineCache.markAsMustInline(element); 1279 inlineCache.markAsMustInline(element);
1276 } else if (cls == helpers.noInlineClass) { 1280 } else if (cls == commonElements.noInlineClass) {
1277 hasNoInline = true; 1281 hasNoInline = true;
1278 if (VERBOSE_OPTIMIZER_HINTS) { 1282 if (VERBOSE_OPTIMIZER_HINTS) {
1279 reporter.reportHintMessage( 1283 reporter.reportHintMessage(
1280 element, MessageKind.GENERIC, {'text': "Cannot inline"}); 1284 element, MessageKind.GENERIC, {'text': "Cannot inline"});
1281 } 1285 }
1282 inlineCache.markAsNonInlinable(element); 1286 inlineCache.markAsNonInlinable(element);
1283 } else if (cls == helpers.noThrowsClass) { 1287 } else if (cls == commonElements.noThrowsClass) {
1284 hasNoThrows = true; 1288 hasNoThrows = true;
1285 if (!Elements.isStaticOrTopLevelFunction(element) && 1289 if (!Elements.isStaticOrTopLevelFunction(element) &&
1286 !element.isFactoryConstructor) { 1290 !element.isFactoryConstructor) {
1287 reporter.internalError( 1291 reporter.internalError(
1288 element, 1292 element,
1289 "@NoThrows() is currently limited to top-level" 1293 "@NoThrows() is currently limited to top-level"
1290 " or static functions and factory constructors."); 1294 " or static functions and factory constructors.");
1291 } 1295 }
1292 if (VERBOSE_OPTIMIZER_HINTS) { 1296 if (VERBOSE_OPTIMIZER_HINTS) {
1293 reporter.reportHintMessage( 1297 reporter.reportHintMessage(
1294 element, MessageKind.GENERIC, {'text': "Cannot throw"}); 1298 element, MessageKind.GENERIC, {'text': "Cannot throw"});
1295 } 1299 }
1296 closedWorldRefiner.registerCannotThrow(element); 1300 closedWorldRefiner.registerCannotThrow(element);
1297 } else if (cls == helpers.noSideEffectsClass) { 1301 } else if (cls == commonElements.noSideEffectsClass) {
1298 hasNoSideEffects = true; 1302 hasNoSideEffects = true;
1299 if (VERBOSE_OPTIMIZER_HINTS) { 1303 if (VERBOSE_OPTIMIZER_HINTS) {
1300 reporter.reportHintMessage( 1304 reporter.reportHintMessage(
1301 element, MessageKind.GENERIC, {'text': "Has no side effects"}); 1305 element, MessageKind.GENERIC, {'text': "Has no side effects"});
1302 } 1306 }
1303 closedWorldRefiner.registerSideEffectsFree(element); 1307 closedWorldRefiner.registerSideEffectsFree(element);
1304 } 1308 }
1305 } 1309 }
1306 if (hasForceInline && hasNoInline) { 1310 if (hasForceInline && hasNoInline) {
1307 reporter.internalError( 1311 reporter.internalError(
1308 element, "@ForceInline() must not be used with @NoInline."); 1312 element, "@ForceInline() must not be used with @NoInline.");
1309 } 1313 }
1310 if (hasNoThrows && !hasNoInline) { 1314 if (hasNoThrows && !hasNoInline) {
1311 reporter.internalError( 1315 reporter.internalError(
1312 element, "@NoThrows() should always be combined with @NoInline."); 1316 element, "@NoThrows() should always be combined with @NoInline.");
1313 } 1317 }
1314 if (hasNoSideEffects && !hasNoInline) { 1318 if (hasNoSideEffects && !hasNoInline) {
1315 reporter.internalError(element, 1319 reporter.internalError(element,
1316 "@NoSideEffects() should always be combined with @NoInline."); 1320 "@NoSideEffects() should always be combined with @NoInline.");
1317 } 1321 }
1318 } 1322 }
1319 1323
1320 MethodElement helperForBadMain() => helpers.badMain; 1324 MethodElement helperForBadMain() => commonElements.badMain;
1321 1325
1322 MethodElement helperForMissingMain() => helpers.missingMain; 1326 MethodElement helperForMissingMain() => commonElements.missingMain;
1323 1327
1324 MethodElement helperForMainArity() => helpers.mainHasTooManyParameters; 1328 MethodElement helperForMainArity() => commonElements.mainHasTooManyParameters;
1325 1329
1326 /// Returns the filename for the output-unit named [name]. 1330 /// Returns the filename for the output-unit named [name].
1327 /// 1331 ///
1328 /// The filename is of the form "<main output file>_<name>.part.js". 1332 /// The filename is of the form "<main output file>_<name>.part.js".
1329 /// If [addExtension] is false, the ".part.js" suffix is left out. 1333 /// If [addExtension] is false, the ".part.js" suffix is left out.
1330 String deferredPartFileName(String name, {bool addExtension: true}) { 1334 String deferredPartFileName(String name, {bool addExtension: true}) {
1331 assert(name != ""); 1335 assert(name != "");
1332 String outPath = compiler.options.outputUri != null 1336 String outPath = compiler.options.outputUri != null
1333 ? compiler.options.outputUri.path 1337 ? compiler.options.outputUri.path
1334 : "out"; 1338 : "out";
(...skipping 10 matching lines...) Expand all
1345 /// supported by the backend. 1349 /// supported by the backend.
1346 bool enableCodegenWithErrorsIfSupported(Spannable node) => true; 1350 bool enableCodegenWithErrorsIfSupported(Spannable node) => true;
1347 1351
1348 jsAst.Expression rewriteAsync( 1352 jsAst.Expression rewriteAsync(
1349 FunctionElement element, jsAst.Expression code) { 1353 FunctionElement element, jsAst.Expression code) {
1350 AsyncRewriterBase rewriter = null; 1354 AsyncRewriterBase rewriter = null;
1351 jsAst.Name name = namer.methodPropertyName(element); 1355 jsAst.Name name = namer.methodPropertyName(element);
1352 switch (element.asyncMarker) { 1356 switch (element.asyncMarker) {
1353 case AsyncMarker.ASYNC: 1357 case AsyncMarker.ASYNC:
1354 rewriter = new AsyncRewriter(reporter, element, 1358 rewriter = new AsyncRewriter(reporter, element,
1355 asyncHelper: emitter.staticFunctionAccess(helpers.asyncHelper), 1359 asyncHelper:
1356 wrapBody: emitter.staticFunctionAccess(helpers.wrapBody), 1360 emitter.staticFunctionAccess(commonElements.asyncHelper),
1357 newCompleter: 1361 wrapBody: emitter.staticFunctionAccess(commonElements.wrapBody),
1358 emitter.staticFunctionAccess(helpers.syncCompleterConstructor), 1362 newCompleter: emitter
1363 .staticFunctionAccess(commonElements.syncCompleterConstructor),
1359 safeVariableName: namer.safeVariablePrefixForAsyncRewrite, 1364 safeVariableName: namer.safeVariablePrefixForAsyncRewrite,
1360 bodyName: namer.deriveAsyncBodyName(name)); 1365 bodyName: namer.deriveAsyncBodyName(name));
1361 break; 1366 break;
1362 case AsyncMarker.SYNC_STAR: 1367 case AsyncMarker.SYNC_STAR:
1363 rewriter = new SyncStarRewriter(reporter, element, 1368 rewriter = new SyncStarRewriter(reporter, element,
1364 endOfIteration: 1369 endOfIteration:
1365 emitter.staticFunctionAccess(helpers.endOfIteration), 1370 emitter.staticFunctionAccess(commonElements.endOfIteration),
1366 newIterable: emitter 1371 newIterable: emitter.staticFunctionAccess(
1367 .staticFunctionAccess(helpers.syncStarIterableConstructor), 1372 commonElements.syncStarIterableConstructor),
1368 yieldStarExpression: 1373 yieldStarExpression:
1369 emitter.staticFunctionAccess(helpers.yieldStar), 1374 emitter.staticFunctionAccess(commonElements.yieldStar),
1370 uncaughtErrorExpression: 1375 uncaughtErrorExpression: emitter
1371 emitter.staticFunctionAccess(helpers.syncStarUncaughtError), 1376 .staticFunctionAccess(commonElements.syncStarUncaughtError),
1372 safeVariableName: namer.safeVariablePrefixForAsyncRewrite, 1377 safeVariableName: namer.safeVariablePrefixForAsyncRewrite,
1373 bodyName: namer.deriveAsyncBodyName(name)); 1378 bodyName: namer.deriveAsyncBodyName(name));
1374 break; 1379 break;
1375 case AsyncMarker.ASYNC_STAR: 1380 case AsyncMarker.ASYNC_STAR:
1376 rewriter = new AsyncStarRewriter(reporter, element, 1381 rewriter = new AsyncStarRewriter(reporter, element,
1377 asyncStarHelper: 1382 asyncStarHelper:
1378 emitter.staticFunctionAccess(helpers.asyncStarHelper), 1383 emitter.staticFunctionAccess(commonElements.asyncStarHelper),
1379 streamOfController: 1384 streamOfController:
1380 emitter.staticFunctionAccess(helpers.streamOfController), 1385 emitter.staticFunctionAccess(commonElements.streamOfController),
1381 wrapBody: emitter.staticFunctionAccess(helpers.wrapBody), 1386 wrapBody: emitter.staticFunctionAccess(commonElements.wrapBody),
1382 newController: emitter 1387 newController: emitter.staticFunctionAccess(
1383 .staticFunctionAccess(helpers.asyncStarControllerConstructor), 1388 commonElements.asyncStarControllerConstructor),
1384 safeVariableName: namer.safeVariablePrefixForAsyncRewrite, 1389 safeVariableName: namer.safeVariablePrefixForAsyncRewrite,
1385 yieldExpression: emitter.staticFunctionAccess(helpers.yieldSingle), 1390 yieldExpression:
1391 emitter.staticFunctionAccess(commonElements.yieldSingle),
1386 yieldStarExpression: 1392 yieldStarExpression:
1387 emitter.staticFunctionAccess(helpers.yieldStar), 1393 emitter.staticFunctionAccess(commonElements.yieldStar),
1388 bodyName: namer.deriveAsyncBodyName(name)); 1394 bodyName: namer.deriveAsyncBodyName(name));
1389 break; 1395 break;
1390 default: 1396 default:
1391 assert(element.asyncMarker == AsyncMarker.SYNC); 1397 assert(element.asyncMarker == AsyncMarker.SYNC);
1392 return code; 1398 return code;
1393 } 1399 }
1394 return rewriter.rewrite(code); 1400 return rewriter.rewrite(code);
1395 } 1401 }
1396 1402
1397 /// Creates an impact strategy to use for compilation. 1403 /// Creates an impact strategy to use for compilation.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 @override 1466 @override
1461 void onImpactUsed(ImpactUseCase impactUse) { 1467 void onImpactUsed(ImpactUseCase impactUse) {
1462 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { 1468 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) {
1463 // TODO(johnniwinther): Allow emptying when serialization has been 1469 // TODO(johnniwinther): Allow emptying when serialization has been
1464 // performed. 1470 // performed.
1465 resolution.emptyCache(); 1471 resolution.emptyCache();
1466 } 1472 }
1467 } 1473 }
1468 } 1474 }
1469 1475
1476 // TODO(efortuna): Merge with commonElements.
1470 class JavaScriptBackendClasses implements BackendClasses { 1477 class JavaScriptBackendClasses implements BackendClasses {
1471 final ElementEnvironment _env; 1478 final ElementEnvironment _env;
1472 final BackendHelpers helpers; 1479 final CommonElements _commonElements;
1473 final NativeBasicData _nativeData; 1480 final NativeBasicData _nativeData;
1474 1481
1475 JavaScriptBackendClasses(this._env, this.helpers, this._nativeData); 1482 JavaScriptBackendClasses(this._env, this._commonElements, this._nativeData);
1476 1483
1477 ClassEntity get intClass => helpers.jsIntClass; 1484 ClassEntity get intClass => _commonElements.jsIntClass;
1478 ClassEntity get uint32Class => helpers.jsUInt32Class; 1485 ClassEntity get uint32Class => _commonElements.jsUInt32Class;
1479 ClassEntity get uint31Class => helpers.jsUInt31Class; 1486 ClassEntity get uint31Class => _commonElements.jsUInt31Class;
1480 ClassEntity get positiveIntClass => helpers.jsPositiveIntClass; 1487 ClassEntity get positiveIntClass => _commonElements.jsPositiveIntClass;
1481 ClassEntity get doubleClass => helpers.jsDoubleClass; 1488 ClassEntity get doubleClass => _commonElements.jsDoubleClass;
1482 ClassEntity get numClass => helpers.jsNumberClass; 1489 ClassEntity get numClass => _commonElements.jsNumberClass;
1483 ClassEntity get stringClass => helpers.jsStringClass; 1490 ClassEntity get stringClass => _commonElements.jsStringClass;
1484 ClassEntity get listClass => helpers.jsArrayClass; 1491 ClassEntity get listClass => _commonElements.jsArrayClass;
1485 ClassEntity get mutableListClass => helpers.jsMutableArrayClass; 1492 ClassEntity get mutableListClass => _commonElements.jsMutableArrayClass;
1486 ClassEntity get constListClass => helpers.jsUnmodifiableArrayClass; 1493 ClassEntity get constListClass => _commonElements.jsUnmodifiableArrayClass;
1487 ClassEntity get fixedListClass => helpers.jsFixedArrayClass; 1494 ClassEntity get fixedListClass => _commonElements.jsFixedArrayClass;
1488 ClassEntity get growableListClass => helpers.jsExtendableArrayClass; 1495 ClassEntity get growableListClass => _commonElements.jsExtendableArrayClass;
1489 ClassEntity get mapClass => helpers.mapLiteralClass; 1496 ClassEntity get mapClass => _commonElements.mapLiteralClass;
1490 ClassEntity get constMapClass => helpers.constMapLiteralClass; 1497 ClassEntity get constMapClass => _commonElements.constMapLiteralClass;
1491 ClassEntity get typeClass => helpers.typeLiteralClass; 1498 ClassEntity get typeClass => _commonElements.typeLiteralClass;
1492 InterfaceType get typeType => _env.getRawType(typeClass); 1499 InterfaceType get typeType => _env.getRawType(typeClass);
1493 1500
1494 ClassEntity get boolClass => helpers.jsBoolClass; 1501 ClassEntity get boolClass => _commonElements.jsBoolClass;
1495 ClassEntity get nullClass => helpers.jsNullClass; 1502 ClassEntity get nullClass => _commonElements.jsNullClass;
1496 ClassEntity get syncStarIterableClass => helpers.syncStarIterable; 1503 ClassEntity get syncStarIterableClass => _commonElements.syncStarIterable;
1497 ClassEntity get asyncFutureClass => helpers.futureImplementation; 1504 ClassEntity get asyncFutureClass => _commonElements.futureImplementation;
1498 ClassEntity get asyncStarStreamClass => helpers.controllerStream; 1505 ClassEntity get asyncStarStreamClass => _commonElements.controllerStream;
1499 ClassEntity get functionClass => helpers.commonElements.functionClass; 1506 ClassEntity get functionClass => _commonElements.functionClass;
1500 ClassEntity get indexableClass => helpers.jsIndexableClass; 1507 ClassEntity get indexableClass => _commonElements.jsIndexableClass;
1501 ClassEntity get mutableIndexableClass => helpers.jsMutableIndexableClass; 1508 ClassEntity get mutableIndexableClass =>
1502 ClassEntity get indexingBehaviorClass => helpers.jsIndexingBehaviorInterface; 1509 _commonElements.jsMutableIndexableClass;
1503 ClassEntity get interceptorClass => helpers.jsInterceptorClass; 1510 ClassEntity get indexingBehaviorClass =>
1511 _commonElements.jsIndexingBehaviorInterface;
1512 ClassEntity get interceptorClass => _commonElements.jsInterceptorClass;
1504 1513
1505 bool isDefaultEqualityImplementation(MemberEntity element) { 1514 bool isDefaultEqualityImplementation(MemberEntity element) {
1506 assert(element.name == '=='); 1515 assert(element.name == '==');
1507 ClassEntity classElement = element.enclosingClass; 1516 ClassEntity classElement = element.enclosingClass;
1508 return classElement == helpers.commonElements.objectClass || 1517 return classElement == _commonElements.objectClass ||
1509 classElement == helpers.jsInterceptorClass || 1518 classElement == _commonElements.jsInterceptorClass ||
1510 classElement == helpers.jsNullClass; 1519 classElement == _commonElements.jsNullClass;
1511 } 1520 }
1512 1521
1513 @override 1522 @override
1514 bool isNativeClass(ClassEntity element) { 1523 bool isNativeClass(ClassEntity element) {
1515 return _nativeData.isNativeClass(element); 1524 return _nativeData.isNativeClass(element);
1516 } 1525 }
1517 1526
1518 InterfaceType getConstantMapTypeFor(InterfaceType sourceType, 1527 InterfaceType getConstantMapTypeFor(InterfaceType sourceType,
1519 {bool hasProtoKey: false, bool onlyStringKeys: false}) { 1528 {bool hasProtoKey: false, bool onlyStringKeys: false}) {
1520 ClassEntity classElement = onlyStringKeys 1529 ClassEntity classElement = onlyStringKeys
1521 ? (hasProtoKey 1530 ? (hasProtoKey
1522 ? helpers.constantProtoMapClass 1531 ? _commonElements.constantProtoMapClass
1523 : helpers.constantStringMapClass) 1532 : _commonElements.constantStringMapClass)
1524 : helpers.generalConstantMapClass; 1533 : _commonElements.generalConstantMapClass;
1525 List<DartType> typeArgument = sourceType.typeArguments; 1534 List<DartType> typeArgument = sourceType.typeArguments;
1526 if (sourceType.treatAsRaw) { 1535 if (sourceType.treatAsRaw) {
1527 return _env.getRawType(classElement); 1536 return _env.getRawType(classElement);
1528 } else { 1537 } else {
1529 return _env.createInterfaceType(classElement, typeArgument); 1538 return _env.createInterfaceType(classElement, typeArgument);
1530 } 1539 }
1531 } 1540 }
1532 1541
1533 @override 1542 @override
1534 FieldEntity get symbolField => helpers.symbolImplementationField; 1543 FieldEntity get symbolField => _commonElements.symbolImplementationField;
1535 1544
1536 @override 1545 @override
1537 InterfaceType get symbolType { 1546 InterfaceType get symbolType {
1538 return _env.getRawType(helpers.symbolImplementationClass); 1547 return _env.getRawType(_commonElements.symbolImplementationClass);
1539 } 1548 }
1540 } 1549 }
1541 1550
1542 class JavaScriptBackendTarget extends Target { 1551 class JavaScriptBackendTarget extends Target {
1543 final JavaScriptBackend _backend; 1552 final JavaScriptBackend _backend;
1544 1553
1545 JavaScriptBackendTarget(this._backend); 1554 JavaScriptBackendTarget(this._backend);
1546 1555
1547 @override 1556 @override
1548 bool isTargetSpecificLibrary(LibraryElement element) { 1557 bool isTargetSpecificLibrary(LibraryElement element) {
(...skipping 11 matching lines...) Expand all
1560 } 1569 }
1561 1570
1562 @override 1571 @override
1563 dynamic resolveForeignCall(Send node, Element element, 1572 dynamic resolveForeignCall(Send node, Element element,
1564 CallStructure callStructure, ForeignResolver resolver) { 1573 CallStructure callStructure, ForeignResolver resolver) {
1565 return _backend.resolveForeignCall(node, element, callStructure, resolver); 1574 return _backend.resolveForeignCall(node, element, callStructure, resolver);
1566 } 1575 }
1567 1576
1568 @override 1577 @override
1569 bool isDefaultNoSuchMethod(MethodElement element) { 1578 bool isDefaultNoSuchMethod(MethodElement element) {
1570 return _backend.helpers.isDefaultNoSuchMethodImplementation(element); 1579 return _backend.commonElements.isDefaultNoSuchMethodImplementation(element);
1571 } 1580 }
1572 1581
1573 @override 1582 @override
1574 ClassElement defaultSuperclass(ClassElement element) { 1583 ClassElement defaultSuperclass(ClassElement element) {
1575 return _backend.defaultSuperclass(element); 1584 return _backend.defaultSuperclass(element);
1576 } 1585 }
1577 1586
1578 @override 1587 @override
1579 bool isNativeClass(ClassEntity element) => 1588 bool isNativeClass(ClassEntity element) =>
1580 _backend.nativeBasicData.isNativeClass(element); 1589 _backend.nativeBasicData.isNativeClass(element);
(...skipping 19 matching lines...) Expand all
1600 1609
1601 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { 1610 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) {
1602 return !selector.isGetter; 1611 return !selector.isGetter;
1603 } 1612 }
1604 1613
1605 /// Returns `true` if [member] is called from a subclass via `super`. 1614 /// Returns `true` if [member] is called from a subclass via `super`.
1606 bool isAliasedSuperMember(MemberEntity member) { 1615 bool isAliasedSuperMember(MemberEntity member) {
1607 return _aliasedSuperMembers.contains(member); 1616 return _aliasedSuperMembers.contains(member);
1608 } 1617 }
1609 } 1618 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/annotations.dart ('k') | pkg/compiler/lib/src/js_backend/backend_helpers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698