Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/world.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/world.dart b/sdk/lib/_internal/compiler/implementation/world.dart |
| index 271629bf64132666df45a3b3aba08074886ca86e..4eafbf72229bb9f3388676120ff3c74955f66ccd 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/world.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/world.dart |
| @@ -10,6 +10,7 @@ class World { |
| final Map<ClassElement, Set<MixinApplicationElement>> mixinUses; |
| final Map<ClassElement, Set<ClassElement>> typesImplementedBySubclasses; |
| final Set<ClassElement> classesNeedingRti; |
| + final Set<ClassElement> usedFactoriesOfAbstractClasses; |
|
ngeoffray
2013/02/27 12:36:28
Store the factories instead, as implied by the nam
karlklose
2013/02/27 16:11:32
Obsolete.
|
| final Map<ClassElement, Set<ClassElement>> rtiDependencies; |
| final FullFunctionSet allFunctions; |
| @@ -19,6 +20,7 @@ class World { |
| typesImplementedBySubclasses = |
| new Map<ClassElement, Set<ClassElement>>(), |
| classesNeedingRti = new Set<ClassElement>(), |
| + usedFactoriesOfAbstractClasses = new Set<ClassElement>(), |
| rtiDependencies = new Map<ClassElement, Set<ClassElement>>(), |
| allFunctions = new FullFunctionSet(compiler), |
| this.compiler = compiler; |
| @@ -79,14 +81,32 @@ class World { |
| } |
| } |
| + Set<ClassElement> classesUsingTypeVariableTests = new Set<ClassElement>(); |
| compiler.resolverWorld.isChecks.forEach((DartType type) { |
| - if (type is InterfaceType) { |
| + if (type.kind == TypeKind.TYPE_VARIABLE) { |
| + TypeVariableElement variable = type.element; |
| + classesUsingTypeVariableTests.add(variable.enclosingElement); |
| + } |
| + }); |
| + compiler.resolverWorld.addImplicitChecks(classesUsingTypeVariableTests); |
| + compiler.resolverWorld.isChecks.forEach((DartType type) { |
| + if (type.kind == TypeKind.INTERFACE) { |
| InterfaceType itf = type; |
| if (!itf.isRaw) { |
| potentiallyAddForRti(itf.element); |
| } |
| + } else if (type.kind == TypeKind.TYPE_VARIABLE) { |
| + TypeVariableElement variable = type.element; |
| + potentiallyAddForRti(variable.enclosingElement); |
| } |
| }); |
| + |
| + // TODO(karlklose): if we know all targets of factories for the abstract |
| + // class, we should check whether one of these targets needs runtime type |
| + // information before adding the class. |
| + usedFactoriesOfAbstractClasses.forEach((ClassElement cls) { |
| + potentiallyAddForRti(cls); |
| + }); |
| } |
| void registerMixinUse(MixinApplicationElement mixinApplication, |
| @@ -170,4 +190,8 @@ class World { |
| .map((Element member) => member.getEnclosingClass()) |
| .where((ClassElement holder) => !identical(holder, objectClass)); |
| } |
| + |
| + void registerUsedFactoriesOfAbstractClasses(ClassElement cls) { |
| + usedFactoriesOfAbstractClasses.add(cls); |
| + } |
| } |