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

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

Issue 1086413002: dart2js: reify type variables as result of class enqueueing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/type_variable_handler.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 part of js_backend; 5 part of js_backend;
6 6
7 const VERBOSE_OPTIMIZER_HINTS = false; 7 const VERBOSE_OPTIMIZER_HINTS = false;
8 8
9 class JavaScriptItemCompilationContext extends ItemCompilationContext { 9 class JavaScriptItemCompilationContext extends ItemCompilationContext {
10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>();
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 bool enabledNoSuchMethod = false; 599 bool enabledNoSuchMethod = false;
600 600
601 JavaScriptBackend(Compiler compiler, bool generateSourceMap) 601 JavaScriptBackend(Compiler compiler, bool generateSourceMap)
602 : namer = determineNamer(compiler), 602 : namer = determineNamer(compiler),
603 oneShotInterceptors = new Map<String, Selector>(), 603 oneShotInterceptors = new Map<String, Selector>(),
604 interceptedElements = new Map<String, Set<Element>>(), 604 interceptedElements = new Map<String, Set<Element>>(),
605 rti = new RuntimeTypes(compiler), 605 rti = new RuntimeTypes(compiler),
606 specializedGetInterceptors = new Map<String, Set<ClassElement>>(), 606 specializedGetInterceptors = new Map<String, Set<ClassElement>>(),
607 super(compiler) { 607 super(compiler) {
608 emitter = new CodeEmitterTask(compiler, namer, generateSourceMap); 608 emitter = new CodeEmitterTask(compiler, namer, generateSourceMap);
609 typeVariableHandler = new TypeVariableHandler(this); 609 typeVariableHandler = new TypeVariableHandler(compiler);
610 customElementsAnalysis = new CustomElementsAnalysis(this); 610 customElementsAnalysis = new CustomElementsAnalysis(this);
611 noSuchMethodRegistry = new NoSuchMethodRegistry(this); 611 noSuchMethodRegistry = new NoSuchMethodRegistry(this);
612 constantCompilerTask = new JavaScriptConstantTask(compiler); 612 constantCompilerTask = new JavaScriptConstantTask(compiler);
613 resolutionCallbacks = new JavaScriptResolutionCallbacks(this); 613 resolutionCallbacks = new JavaScriptResolutionCallbacks(this);
614 patchResolverTask = new PatchResolverTask(compiler); 614 patchResolverTask = new PatchResolverTask(compiler);
615 functionCompiler = compiler.useCpsIr 615 functionCompiler = compiler.useCpsIr
616 ? new CpsFunctionCompiler( 616 ? new CpsFunctionCompiler(
617 compiler, this, generateSourceMap: generateSourceMap) 617 compiler, this, generateSourceMap: generateSourceMap)
618 : new SsaFunctionCompiler(this, generateSourceMap); 618 : new SsaFunctionCompiler(this, generateSourceMap);
619 } 619 }
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 assert(registry.isForResolution); 957 assert(registry.isForResolution);
958 ConstantValue constant = constants.getConstantForMetadata(metadata).value; 958 ConstantValue constant = constants.getConstantForMetadata(metadata).value;
959 registerCompileTimeConstant(constant, registry); 959 registerCompileTimeConstant(constant, registry);
960 metadataConstants.add(new Dependency(constant, annotatedElement)); 960 metadataConstants.add(new Dependency(constant, annotatedElement));
961 } 961 }
962 962
963 void registerInstantiatedClass(ClassElement cls, 963 void registerInstantiatedClass(ClassElement cls,
964 Enqueuer enqueuer, 964 Enqueuer enqueuer,
965 Registry registry) { 965 Registry registry) {
966 if (!cls.typeVariables.isEmpty) { 966 if (!cls.typeVariables.isEmpty) {
967 typeVariableHandler.registerClassWithTypeVariables(cls); 967 typeVariableHandler.registerClassWithTypeVariables(cls, enqueuer,
968 registry);
968 } 969 }
969 970
970 // Register any helper that will be needed by the backend. 971 // Register any helper that will be needed by the backend.
971 if (enqueuer.isResolutionQueue) { 972 if (enqueuer.isResolutionQueue) {
972 if (cls == compiler.intClass 973 if (cls == compiler.intClass
973 || cls == compiler.doubleClass 974 || cls == compiler.doubleClass
974 || cls == compiler.numClass) { 975 || cls == compiler.numClass) {
975 // The backend will try to optimize number operations and use the 976 // The backend will try to optimize number operations and use the
976 // `iae` helper directly. 977 // `iae` helper directly.
977 enqueue(enqueuer, findHelper('iae'), registry); 978 enqueue(enqueuer, findHelper('iae'), registry);
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 ClassElement get mapImplementation => mapLiteralClass; 1847 ClassElement get mapImplementation => mapLiteralClass;
1847 ClassElement get constMapImplementation => constMapLiteralClass; 1848 ClassElement get constMapImplementation => constMapLiteralClass;
1848 ClassElement get typeImplementation => typeLiteralClass; 1849 ClassElement get typeImplementation => typeLiteralClass;
1849 ClassElement get boolImplementation => jsBoolClass; 1850 ClassElement get boolImplementation => jsBoolClass;
1850 ClassElement get nullImplementation => jsNullClass; 1851 ClassElement get nullImplementation => jsNullClass;
1851 1852
1852 void registerStaticUse(Element element, Enqueuer enqueuer) { 1853 void registerStaticUse(Element element, Enqueuer enqueuer) {
1853 if (element == disableTreeShakingMarker) { 1854 if (element == disableTreeShakingMarker) {
1854 compiler.disableTypeInferenceForMirrors = true; 1855 compiler.disableTypeInferenceForMirrors = true;
1855 isTreeShakingDisabled = true; 1856 isTreeShakingDisabled = true;
1856 typeVariableHandler.onTreeShakingDisabled(enqueuer);
1857 } else if (element == preserveNamesMarker) { 1857 } else if (element == preserveNamesMarker) {
1858 mustPreserveNames = true; 1858 mustPreserveNames = true;
1859 } else if (element == preserveMetadataMarker) { 1859 } else if (element == preserveMetadataMarker) {
1860 mustRetainMetadata = true; 1860 mustRetainMetadata = true;
1861 } else if (element == preserveUrisMarker) { 1861 } else if (element == preserveUrisMarker) {
1862 if (compiler.preserveUris) mustPreserveUris = true; 1862 if (compiler.preserveUris) mustPreserveUris = true;
1863 } else if (element == preserveLibraryNamesMarker) { 1863 } else if (element == preserveLibraryNamesMarker) {
1864 mustRetainLibraryNames = true; 1864 mustRetainLibraryNames = true;
1865 } else if (element == getIsolateAffinityTagMarker) { 1865 } else if (element == getIsolateAffinityTagMarker) {
1866 needToInitializeIsolateAffinityTag = true; 1866 needToInitializeIsolateAffinityTag = true;
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
2886 } 2886 }
2887 } 2887 }
2888 2888
2889 /// Records that [constant] is used by the element behind [registry]. 2889 /// Records that [constant] is used by the element behind [registry].
2890 class Dependency { 2890 class Dependency {
2891 final ConstantValue constant; 2891 final ConstantValue constant;
2892 final Element annotatedElement; 2892 final Element annotatedElement;
2893 2893
2894 const Dependency(this.constant, this.annotatedElement); 2894 const Dependency(this.constant, this.annotatedElement);
2895 } 2895 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/type_variable_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698