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

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

Issue 2729383002: Prepare for late creation of ResolutionEnqueuer (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library js_backend.backend; 5 library js_backend.backend;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
10 10
(...skipping 11 matching lines...) Expand all
22 import '../constants/values.dart'; 22 import '../constants/values.dart';
23 import '../common_elements.dart' show CommonElements, ElementEnvironment; 23 import '../common_elements.dart' show CommonElements, ElementEnvironment;
24 import '../deferred_load.dart' show DeferredLoadTask; 24 import '../deferred_load.dart' show DeferredLoadTask;
25 import '../dump_info.dart' show DumpInfoTask; 25 import '../dump_info.dart' show DumpInfoTask;
26 import '../elements/elements.dart'; 26 import '../elements/elements.dart';
27 import '../elements/entities.dart'; 27 import '../elements/entities.dart';
28 import '../elements/resolution_types.dart'; 28 import '../elements/resolution_types.dart';
29 import '../elements/types.dart'; 29 import '../elements/types.dart';
30 import '../enqueue.dart' 30 import '../enqueue.dart'
31 show 31 show
32 DirectEnqueuerStrategy,
32 Enqueuer, 33 Enqueuer,
33 EnqueuerListener, 34 EnqueuerListener,
34 EnqueueTask, 35 EnqueueTask,
35 ResolutionEnqueuer, 36 ResolutionEnqueuer,
37 ResolutionWorkItemBuilder,
36 TreeShakingEnqueuerStrategy; 38 TreeShakingEnqueuerStrategy;
37 import '../io/multi_information.dart' show MultiSourceInformationStrategy; 39 import '../io/multi_information.dart' show MultiSourceInformationStrategy;
38 import '../io/position_information.dart' show PositionSourceInformationStrategy; 40 import '../io/position_information.dart' show PositionSourceInformationStrategy;
39 import '../io/source_information.dart' show SourceInformationStrategy; 41 import '../io/source_information.dart' show SourceInformationStrategy;
40 import '../io/start_end_information.dart' 42 import '../io/start_end_information.dart'
41 show StartEndSourceInformationStrategy; 43 show StartEndSourceInformationStrategy;
42 import '../js/js.dart' as jsAst; 44 import '../js/js.dart' as jsAst;
43 import '../js/js.dart' show js; 45 import '../js/js.dart' show js;
44 import '../js/js_source_mapping.dart' show JavaScriptSourceInformationStrategy; 46 import '../js/js_source_mapping.dart' show JavaScriptSourceInformationStrategy;
45 import '../js/rewrite_async.dart'; 47 import '../js/rewrite_async.dart';
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 NativeDataBuilder get nativeDataBuilder => _nativeData; 439 NativeDataBuilder get nativeDataBuilder => _nativeData;
438 final NativeDataResolver _nativeDataResolver; 440 final NativeDataResolver _nativeDataResolver;
439 InterceptorDataBuilder _interceptorDataBuilder; 441 InterceptorDataBuilder _interceptorDataBuilder;
440 InterceptorData _interceptorData; 442 InterceptorData _interceptorData;
441 OneShotInterceptorData _oneShotInterceptorData; 443 OneShotInterceptorData _oneShotInterceptorData;
442 BackendUsage _backendUsage; 444 BackendUsage _backendUsage;
443 BackendUsageBuilder _backendUsageBuilder; 445 BackendUsageBuilder _backendUsageBuilder;
444 MirrorsData mirrorsData; 446 MirrorsData mirrorsData;
445 CheckedModeHelpers _checkedModeHelpers; 447 CheckedModeHelpers _checkedModeHelpers;
446 448
447 ResolutionEnqueuerListener _resolutionEnqueuerListener;
448
449 native.NativeResolutionEnqueuer _nativeResolutionEnqueuer; 449 native.NativeResolutionEnqueuer _nativeResolutionEnqueuer;
450 native.NativeCodegenEnqueuer _nativeCodegenEnqueuer; 450 native.NativeCodegenEnqueuer _nativeCodegenEnqueuer;
451 451
452 BackendHelpers helpers; 452 BackendHelpers helpers;
453 BackendImpacts impacts; 453 BackendImpacts impacts;
454 454
455 /// Common classes used by the backend. 455 /// Common classes used by the backend.
456 BackendClasses backendClasses; 456 BackendClasses backendClasses;
457 457
458 /// Backend access to the front-end. 458 /// Backend access to the front-end.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 544
545 noSuchMethodRegistry = new NoSuchMethodRegistry(this); 545 noSuchMethodRegistry = new NoSuchMethodRegistry(this);
546 kernelTask = new KernelTask(compiler); 546 kernelTask = new KernelTask(compiler);
547 impactTransformer = new JavaScriptImpactTransformer(this); 547 impactTransformer = new JavaScriptImpactTransformer(this);
548 patchResolverTask = new PatchResolverTask(compiler); 548 patchResolverTask = new PatchResolverTask(compiler);
549 functionCompiler = 549 functionCompiler =
550 new SsaFunctionCompiler(this, sourceInformationStrategy, useKernel); 550 new SsaFunctionCompiler(this, sourceInformationStrategy, useKernel);
551 serialization = new JavaScriptBackendSerialization(nativeData); 551 serialization = new JavaScriptBackendSerialization(nativeData);
552 _interceptorDataBuilder = new InterceptorDataBuilderImpl( 552 _interceptorDataBuilder = new InterceptorDataBuilderImpl(
553 nativeClassData, helpers, commonElements, compiler.resolution); 553 nativeClassData, helpers, commonElements, compiler.resolution);
554 _resolutionEnqueuerListener = new ResolutionEnqueuerListener(
555 kernelTask,
556 compiler.options,
557 compiler.elementEnvironment,
558 commonElements,
559 helpers,
560 impacts,
561 nativeClassData,
562 _interceptorDataBuilder,
563 _backendUsageBuilder,
564 _rtiNeedBuilder,
565 mirrorsData,
566 noSuchMethodRegistry,
567 customElementsResolutionAnalysis,
568 lookupMapLibraryAccess,
569 mirrorsAnalysis,
570 typeVariableAnalysis,
571 _nativeResolutionEnqueuer);
572 } 554 }
573 555
574 /// The [ConstantSystem] used to interpret compile-time constants for this 556 /// The [ConstantSystem] used to interpret compile-time constants for this
575 /// backend. 557 /// backend.
576 ConstantSystem get constantSystem => constants.constantSystem; 558 ConstantSystem get constantSystem => constants.constantSystem;
577 559
578 DiagnosticReporter get reporter => compiler.reporter; 560 DiagnosticReporter get reporter => compiler.reporter;
579 561
580 CommonElements get commonElements => compiler.commonElements; 562 CommonElements get commonElements => compiler.commonElements;
581 563
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 RuntimeTypesSubstitutions get rtiSubstitutions => _rti; 622 RuntimeTypesSubstitutions get rtiSubstitutions => _rti;
641 623
642 RuntimeTypesEncoder get rtiEncoder { 624 RuntimeTypesEncoder get rtiEncoder {
643 assert(invariant(NO_LOCATION_SPANNABLE, _rtiEncoder != null, 625 assert(invariant(NO_LOCATION_SPANNABLE, _rtiEncoder != null,
644 message: "RuntimeTypesEncoder has not been created.")); 626 message: "RuntimeTypesEncoder has not been created."));
645 return _rtiEncoder; 627 return _rtiEncoder;
646 } 628 }
647 629
648 CheckedModeHelpers get checkedModeHelpers => _checkedModeHelpers; 630 CheckedModeHelpers get checkedModeHelpers => _checkedModeHelpers;
649 631
650 EnqueuerListener get resolutionEnqueuerListener =>
651 _resolutionEnqueuerListener;
652
653 /// Returns constant environment for the JavaScript interpretation of the 632 /// Returns constant environment for the JavaScript interpretation of the
654 /// constants. 633 /// constants.
655 JavaScriptConstantCompiler get constants { 634 JavaScriptConstantCompiler get constants {
656 return constantCompilerTask.jsConstantCompiler; 635 return constantCompilerTask.jsConstantCompiler;
657 } 636 }
658 637
659 bool isDefaultNoSuchMethod(MethodElement element) { 638 bool isDefaultNoSuchMethod(MethodElement element) {
660 return noSuchMethodRegistry.isDefaultNoSuchMethodImplementation(element); 639 return noSuchMethodRegistry.isDefaultNoSuchMethodImplementation(element);
661 } 640 }
662 641
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 reporter.reportErrorMessage( 901 reporter.reportErrorMessage(
923 node, MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT); 902 node, MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT);
924 } 903 }
925 // No native behavior for this call. 904 // No native behavior for this call.
926 return null; 905 return null;
927 } 906 }
928 907
929 bool isComplexNoSuchMethod(FunctionElement element) => 908 bool isComplexNoSuchMethod(FunctionElement element) =>
930 noSuchMethodRegistry.isComplex(element); 909 noSuchMethodRegistry.isComplex(element);
931 910
911 ResolutionEnqueuer createResolutionEnqueuer(
912 CompilerTask task, Compiler compiler) {
913 return new ResolutionEnqueuer(
914 task,
915 compiler.options,
916 compiler.reporter,
917 compiler.options.analyzeOnly && compiler.options.analyzeMain
918 ? const DirectEnqueuerStrategy()
919 : const TreeShakingEnqueuerStrategy(),
920 new ResolutionEnqueuerListener(
921 kernelTask,
922 compiler.options,
923 compiler.elementEnvironment,
924 commonElements,
925 helpers,
926 impacts,
927 nativeClassData,
928 _interceptorDataBuilder,
929 _backendUsageBuilder,
930 _rtiNeedBuilder,
931 mirrorsData,
932 noSuchMethodRegistry,
933 customElementsResolutionAnalysis,
934 lookupMapLibraryAccess,
935 mirrorsAnalysis,
936 typeVariableAnalysis,
937 _nativeResolutionEnqueuer),
938 new ElementResolutionWorldBuilder(
939 this, compiler.resolution, const OpenWorldStrategy()),
940 new ResolutionWorkItemBuilder(compiler.resolution));
941 }
942
932 /// Creates an [Enqueuer] for code generation specific to this backend. 943 /// Creates an [Enqueuer] for code generation specific to this backend.
933 CodegenEnqueuer createCodegenEnqueuer( 944 CodegenEnqueuer createCodegenEnqueuer(
934 CompilerTask task, Compiler compiler, ClosedWorld closedWorld) { 945 CompilerTask task, Compiler compiler, ClosedWorld closedWorld) {
935 return new CodegenEnqueuer( 946 return new CodegenEnqueuer(
936 task, 947 task,
937 compiler.options, 948 compiler.options,
938 const TreeShakingEnqueuerStrategy(), 949 const TreeShakingEnqueuerStrategy(),
939 new CodegenWorldBuilderImpl( 950 new CodegenWorldBuilderImpl(
940 nativeClassData, closedWorld, const TypeMaskStrategy()), 951 nativeClassData, closedWorld, const TypeMaskStrategy()),
941 new CodegenWorkItemBuilder(this, compiler.options), 952 new CodegenWorkItemBuilder(this, compiler.options),
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 return _backend.defaultSuperclass(element); 1623 return _backend.defaultSuperclass(element);
1613 } 1624 }
1614 1625
1615 @override 1626 @override
1616 bool isNativeClass(ClassEntity element) => 1627 bool isNativeClass(ClassEntity element) =>
1617 _backend.nativeClassData.isNativeClass(element); 1628 _backend.nativeClassData.isNativeClass(element);
1618 1629
1619 @override 1630 @override
1620 bool isForeign(Element element) => _backend.isForeign(element); 1631 bool isForeign(Element element) => _backend.isForeign(element);
1621 } 1632 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698