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

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

Issue 2826083002: Remove backend dependency from TypeTestRegistry (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/runtime_types.dart » ('j') | 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 '../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 CodegenImpact, CodegenWorkItem; 10 import '../common/codegen.dart' show CodegenImpact, CodegenWorkItem;
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 result.add(emitter); 360 result.add(emitter);
361 result.add(patchResolverTask); 361 result.add(patchResolverTask);
362 result.add(kernelTask); 362 result.add(kernelTask);
363 return result; 363 return result;
364 } 364 }
365 365
366 final RuntimeTypesNeedBuilder _rtiNeedBuilder = 366 final RuntimeTypesNeedBuilder _rtiNeedBuilder =
367 new _RuntimeTypesNeedBuilder(); 367 new _RuntimeTypesNeedBuilder();
368 RuntimeTypesNeed _rtiNeed; 368 RuntimeTypesNeed _rtiNeed;
369 final _RuntimeTypes _rti; 369 final _RuntimeTypes _rti;
370 RuntimeTypesChecks _rtiChecks;
371 370
372 RuntimeTypesEncoder _rtiEncoder; 371 RuntimeTypesEncoder _rtiEncoder;
373 372
374 /// True if the html library has been loaded. 373 /// True if the html library has been loaded.
375 bool htmlLibraryIsLoaded = false; 374 bool htmlLibraryIsLoaded = false;
376 375
377 /// Resolution analysis for tracking reflective access to type variables. 376 /// Resolution analysis for tracking reflective access to type variables.
378 TypeVariableResolutionAnalysis _typeVariableResolutionAnalysis; 377 TypeVariableResolutionAnalysis _typeVariableResolutionAnalysis;
379 378
380 /// Codegen handler for reflective access to type variables. 379 /// Codegen handler for reflective access to type variables.
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 message: "RuntimeTypesNeed has not been computed yet.")); 630 message: "RuntimeTypesNeed has not been computed yet."));
632 return _rtiNeed; 631 return _rtiNeed;
633 } 632 }
634 633
635 RuntimeTypesNeedBuilder get rtiNeedBuilder { 634 RuntimeTypesNeedBuilder get rtiNeedBuilder {
636 assert(invariant(NO_LOCATION_SPANNABLE, _rtiNeed == null, 635 assert(invariant(NO_LOCATION_SPANNABLE, _rtiNeed == null,
637 message: "RuntimeTypesNeed has already been computed.")); 636 message: "RuntimeTypesNeed has already been computed."));
638 return _rtiNeedBuilder; 637 return _rtiNeedBuilder;
639 } 638 }
640 639
641 RuntimeTypesChecks get rtiChecks {
642 assert(invariant(NO_LOCATION_SPANNABLE, _rtiChecks != null,
643 message: "RuntimeTypesChecks has not been computed yet."));
644 return _rtiChecks;
645 }
646
647 RuntimeTypesChecksBuilder get rtiChecksBuilder { 640 RuntimeTypesChecksBuilder get rtiChecksBuilder {
648 assert(invariant(NO_LOCATION_SPANNABLE, _rtiChecks == null, 641 assert(invariant(NO_LOCATION_SPANNABLE, !_rti.rtiChecksBuilderClosed,
649 message: "RuntimeTypesChecks has already been computed.")); 642 message: "RuntimeTypesChecks has already been computed."));
650 return _rti; 643 return _rti;
651 } 644 }
652 645
653 RuntimeTypesSubstitutions get rtiSubstitutions => _rti; 646 RuntimeTypesSubstitutions get rtiSubstitutions => _rti;
654 647
655 RuntimeTypesEncoder get rtiEncoder { 648 RuntimeTypesEncoder get rtiEncoder {
656 assert(invariant(NO_LOCATION_SPANNABLE, _rtiEncoder != null, 649 assert(invariant(NO_LOCATION_SPANNABLE, _rtiEncoder != null,
657 message: "RuntimeTypesEncoder has not been created.")); 650 message: "RuntimeTypesEncoder has not been created."));
658 return _rtiEncoder; 651 return _rtiEncoder;
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 /** 1021 /**
1029 * Unit test hook that returns code of an element as a String. 1022 * Unit test hook that returns code of an element as a String.
1030 * 1023 *
1031 * Invariant: [element] must be a declaration element. 1024 * Invariant: [element] must be a declaration element.
1032 */ 1025 */
1033 String getGeneratedCode(Element element) { 1026 String getGeneratedCode(Element element) {
1034 assert(invariant(element, element.isDeclaration)); 1027 assert(invariant(element, element.isDeclaration));
1035 return jsAst.prettyPrint(generatedCode[element], compiler.options); 1028 return jsAst.prettyPrint(generatedCode[element], compiler.options);
1036 } 1029 }
1037 1030
1038 /// Called to finalize the [RuntimeTypesChecks] information.
1039 void finalizeRti() {
1040 _rtiChecks = rtiChecksBuilder.computeRequiredChecks();
1041 }
1042
1043 /// Generates the output and returns the total size of the generated code. 1031 /// Generates the output and returns the total size of the generated code.
1044 int assembleProgram(ClosedWorld closedWorld) { 1032 int assembleProgram(ClosedWorld closedWorld) {
1045 int programSize = emitter.assembleProgram(namer, closedWorld); 1033 int programSize = emitter.assembleProgram(namer, closedWorld);
1046 noSuchMethodRegistry.emitDiagnostic(reporter); 1034 noSuchMethodRegistry.emitDiagnostic(reporter);
1047 int totalMethodCount = generatedCode.length; 1035 int totalMethodCount = generatedCode.length;
1048 if (totalMethodCount != mirrorsCodegenAnalysis.preMirrorsMethodCount) { 1036 if (totalMethodCount != mirrorsCodegenAnalysis.preMirrorsMethodCount) {
1049 int mirrorCount = 1037 int mirrorCount =
1050 totalMethodCount - mirrorsCodegenAnalysis.preMirrorsMethodCount; 1038 totalMethodCount - mirrorsCodegenAnalysis.preMirrorsMethodCount;
1051 double percentage = (mirrorCount / totalMethodCount) * 100; 1039 double percentage = (mirrorCount / totalMethodCount) * 100;
1052 DiagnosticMessage hint = 1040 DiagnosticMessage hint =
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 1473
1486 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { 1474 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) {
1487 return !selector.isGetter; 1475 return !selector.isGetter;
1488 } 1476 }
1489 1477
1490 /// Returns `true` if [member] is called from a subclass via `super`. 1478 /// Returns `true` if [member] is called from a subclass via `super`.
1491 bool isAliasedSuperMember(MemberEntity member) { 1479 bool isAliasedSuperMember(MemberEntity member) {
1492 return _aliasedSuperMembers.contains(member); 1480 return _aliasedSuperMembers.contains(member);
1493 } 1481 }
1494 } 1482 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/runtime_types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698