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

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

Issue 2745133002: Create LookupMapAnalysis late. (Closed)
Patch Set: Updated cf. comment. 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
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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 CustomElementsResolutionAnalysis customElementsResolutionAnalysis; 390 CustomElementsResolutionAnalysis customElementsResolutionAnalysis;
391 391
392 /// Codegen support for generating table of interceptors and 392 /// Codegen support for generating table of interceptors and
393 /// constructors for custom elements. 393 /// constructors for custom elements.
394 CustomElementsCodegenAnalysis customElementsCodegenAnalysis; 394 CustomElementsCodegenAnalysis customElementsCodegenAnalysis;
395 395
396 /// Resolution support for tree-shaking entries of `LookupMap`. 396 /// Resolution support for tree-shaking entries of `LookupMap`.
397 LookupMapLibraryAccess lookupMapLibraryAccess; 397 LookupMapLibraryAccess lookupMapLibraryAccess;
398 398
399 /// Codegen support for tree-shaking entries of `LookupMap`. 399 /// Codegen support for tree-shaking entries of `LookupMap`.
400 LookupMapAnalysis lookupMapAnalysis; 400 LookupMapAnalysis _lookupMapAnalysis;
401 401
402 /// Codegen support for typed JavaScript interop. 402 /// Codegen support for typed JavaScript interop.
403 JsInteropAnalysis jsInteropAnalysis; 403 JsInteropAnalysis jsInteropAnalysis;
404 404
405 /// Support for classifying `noSuchMethod` implementations. 405 /// Support for classifying `noSuchMethod` implementations.
406 NoSuchMethodRegistry noSuchMethodRegistry; 406 NoSuchMethodRegistry noSuchMethodRegistry;
407 407
408 /// Resolution and codegen support for computing reflectable elements. 408 /// Resolution and codegen support for computing reflectable elements.
409 MirrorsAnalysis mirrorsAnalysis; 409 MirrorsAnalysis mirrorsAnalysis;
410 410
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 compiler.resolution, 530 compiler.resolution,
531 constantSystem, 531 constantSystem,
532 commonElements, 532 commonElements,
533 backendClasses, 533 backendClasses,
534 helpers, 534 helpers,
535 nativeClassData); 535 nativeClassData);
536 jsInteropAnalysis = new JsInteropAnalysis(this); 536 jsInteropAnalysis = new JsInteropAnalysis(this);
537 mirrorsAnalysis = new MirrorsAnalysis(this, compiler.resolution); 537 mirrorsAnalysis = new MirrorsAnalysis(this, compiler.resolution);
538 lookupMapLibraryAccess = 538 lookupMapLibraryAccess =
539 new LookupMapLibraryAccess(reporter, compiler.elementEnvironment); 539 new LookupMapLibraryAccess(reporter, compiler.elementEnvironment);
540 lookupMapAnalysis = new LookupMapAnalysis(this, compiler.options, reporter,
541 compiler.elementEnvironment, commonElements, helpers, backendClasses);
542 540
543 noSuchMethodRegistry = new NoSuchMethodRegistry(this); 541 noSuchMethodRegistry = new NoSuchMethodRegistry(this);
544 kernelTask = new KernelTask(compiler); 542 kernelTask = new KernelTask(compiler);
545 impactTransformer = new JavaScriptImpactTransformer( 543 impactTransformer = new JavaScriptImpactTransformer(
546 compiler.options, 544 compiler.options,
547 compiler.resolution, 545 compiler.resolution,
548 compiler.elementEnvironment, 546 compiler.elementEnvironment,
549 commonElements, 547 commonElements,
550 impacts, 548 impacts,
551 nativeClassData, 549 nativeClassData,
(...skipping 16 matching lines...) Expand all
568 ConstantSystem get constantSystem => constants.constantSystem; 566 ConstantSystem get constantSystem => constants.constantSystem;
569 567
570 DiagnosticReporter get reporter => compiler.reporter; 568 DiagnosticReporter get reporter => compiler.reporter;
571 569
572 CommonElements get commonElements => compiler.commonElements; 570 CommonElements get commonElements => compiler.commonElements;
573 571
574 Resolution get resolution => compiler.resolution; 572 Resolution get resolution => compiler.resolution;
575 573
576 Target get target => _target; 574 Target get target => _target;
577 575
576 /// Codegen support for tree-shaking entries of `LookupMap`.
577 LookupMapAnalysis get lookupMapAnalysis {
578 assert(invariant(NO_LOCATION_SPANNABLE, _lookupMapAnalysis != null,
579 message: "LookupMapAnalysis has not been created yet."));
580 return _lookupMapAnalysis;
581 }
582
578 InterceptorData get interceptorData { 583 InterceptorData get interceptorData {
579 assert(invariant(NO_LOCATION_SPANNABLE, _interceptorData != null, 584 assert(invariant(NO_LOCATION_SPANNABLE, _interceptorData != null,
580 message: "InterceptorData has not been computed yet.")); 585 message: "InterceptorData has not been computed yet."));
581 return _interceptorData; 586 return _interceptorData;
582 } 587 }
583 588
584 InterceptorDataBuilder get interceptorDataBuilder { 589 InterceptorDataBuilder get interceptorDataBuilder {
585 assert(invariant(NO_LOCATION_SPANNABLE, _interceptorData == null, 590 assert(invariant(NO_LOCATION_SPANNABLE, _interceptorData == null,
586 message: "InterceptorData has already been computed.")); 591 message: "InterceptorData has already been computed."));
587 return _interceptorDataBuilder; 592 return _interceptorDataBuilder;
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 typeVariableAnalysis, 882 typeVariableAnalysis,
878 _nativeResolutionEnqueuer), 883 _nativeResolutionEnqueuer),
879 new ElementResolutionWorldBuilder( 884 new ElementResolutionWorldBuilder(
880 this, compiler.resolution, const OpenWorldStrategy()), 885 this, compiler.resolution, const OpenWorldStrategy()),
881 new ResolutionWorkItemBuilder(compiler.resolution)); 886 new ResolutionWorkItemBuilder(compiler.resolution));
882 } 887 }
883 888
884 /// Creates an [Enqueuer] for code generation specific to this backend. 889 /// Creates an [Enqueuer] for code generation specific to this backend.
885 CodegenEnqueuer createCodegenEnqueuer( 890 CodegenEnqueuer createCodegenEnqueuer(
886 CompilerTask task, Compiler compiler, ClosedWorld closedWorld) { 891 CompilerTask task, Compiler compiler, ClosedWorld closedWorld) {
892 _lookupMapAnalysis = new LookupMapAnalysis(
893 reporter,
894 constantSystem,
895 constants,
896 compiler.elementEnvironment,
897 commonElements,
898 helpers,
899 backendClasses,
900 lookupMapLibraryAccess);
887 return new CodegenEnqueuer( 901 return new CodegenEnqueuer(
888 task, 902 task,
889 compiler.options, 903 compiler.options,
890 const TreeShakingEnqueuerStrategy(), 904 const TreeShakingEnqueuerStrategy(),
891 new CodegenWorldBuilderImpl( 905 new CodegenWorldBuilderImpl(
892 nativeClassData, closedWorld, constants, const TypeMaskStrategy()), 906 nativeClassData, closedWorld, constants, const TypeMaskStrategy()),
893 new CodegenWorkItemBuilder(this, compiler.options), 907 new CodegenWorkItemBuilder(this, compiler.options),
894 new CodegenEnqueuerListener( 908 new CodegenEnqueuerListener(
895 compiler.dumpInfoTask, 909 compiler.dumpInfoTask,
896 compiler.elementEnvironment, 910 compiler.elementEnvironment,
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 1148
1135 List<jsAst.Expression> arguments = <jsAst.Expression>[use1, record]; 1149 List<jsAst.Expression> arguments = <jsAst.Expression>[use1, record];
1136 MethodElement helper = helpers.isJsIndexable; 1150 MethodElement helper = helpers.isJsIndexable;
1137 jsAst.Expression helperExpression = emitter.staticFunctionAccess(helper); 1151 jsAst.Expression helperExpression = emitter.staticFunctionAccess(helper);
1138 return new jsAst.Call(helperExpression, arguments); 1152 return new jsAst.Call(helperExpression, arguments);
1139 } 1153 }
1140 1154
1141 /// Called after the queue is closed. [onQueueEmpty] may be called multiple 1155 /// Called after the queue is closed. [onQueueEmpty] may be called multiple
1142 /// times, but [onQueueClosed] is only called once. 1156 /// times, but [onQueueClosed] is only called once.
1143 void onQueueClosed() { 1157 void onQueueClosed() {
1144 lookupMapAnalysis.onQueueClosed();
1145 jsInteropAnalysis.onQueueClosed(); 1158 jsInteropAnalysis.onQueueClosed();
1146 } 1159 }
1147 1160
1148 // TODO(johnniwinther): Create a CodegenPhase object for the backend to hold 1161 // TODO(johnniwinther): Create a CodegenPhase object for the backend to hold
1149 // data only available during code generation. 1162 // data only available during code generation.
1150 ClosedWorld _closedWorldCache; 1163 ClosedWorld _closedWorldCache;
1151 ClosedWorld get _closedWorld { 1164 ClosedWorld get _closedWorld {
1152 assert(invariant(NO_LOCATION_SPANNABLE, _closedWorldCache != null, 1165 assert(invariant(NO_LOCATION_SPANNABLE, _closedWorldCache != null,
1153 message: "ClosedWorld has not be set yet.")); 1166 message: "ClosedWorld has not be set yet."));
1154 return _closedWorldCache; 1167 return _closedWorldCache;
(...skipping 21 matching lines...) Expand all
1176 checkedModeHelpers, 1189 checkedModeHelpers,
1177 nativeData, 1190 nativeData,
1178 rtiNeed, 1191 rtiNeed,
1179 nativeCodegenEnqueuer, 1192 nativeCodegenEnqueuer,
1180 namer, 1193 namer,
1181 mirrorsData, 1194 mirrorsData,
1182 oneShotInterceptorData, 1195 oneShotInterceptorData,
1183 lookupMapAnalysis, 1196 lookupMapAnalysis,
1184 customElementsCodegenAnalysis, 1197 customElementsCodegenAnalysis,
1185 rtiChecksBuilder); 1198 rtiChecksBuilder);
1186 lookupMapAnalysis.onCodegenStart(lookupMapLibraryAccess);
1187 return const WorldImpact(); 1199 return const WorldImpact();
1188 } 1200 }
1189 1201
1190 /// Called when code generation has been completed. 1202 /// Called when code generation has been completed.
1191 void onCodegenEnd() { 1203 void onCodegenEnd() {
1192 sourceInformationStrategy.onComplete(); 1204 sourceInformationStrategy.onComplete();
1193 tracer.close(); 1205 tracer.close();
1194 } 1206 }
1195 1207
1196 // Does this element belong in the output 1208 // Does this element belong in the output
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 return _backend.defaultSuperclass(element); 1585 return _backend.defaultSuperclass(element);
1574 } 1586 }
1575 1587
1576 @override 1588 @override
1577 bool isNativeClass(ClassEntity element) => 1589 bool isNativeClass(ClassEntity element) =>
1578 _backend.nativeClassData.isNativeClass(element); 1590 _backend.nativeClassData.isNativeClass(element);
1579 1591
1580 @override 1592 @override
1581 bool isForeign(Element element) => _backend.isForeign(element); 1593 bool isForeign(Element element) => _backend.isForeign(element);
1582 } 1594 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/js_backend/codegen_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698