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..323f8d115147fb5eaae5fec893ed378f62a3b447 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> instantiatedAbstractClasses; |
|
ngeoffray
2013/02/26 14:11:37
This name makes it think like it's an error. Maybe
karlklose
2013/02/27 10:12:58
Done.
|
| 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>(), |
| + instantiatedAbstractClasses = new Set<ClassElement>(), |
| rtiDependencies = new Map<ClassElement, Set<ClassElement>>(), |
| allFunctions = new FullFunctionSet(compiler), |
| this.compiler = compiler; |
| @@ -60,7 +62,6 @@ class World { |
| // (3) subclasses of (2) and (3). |
| void potentiallyAddForRti(ClassElement cls) { |
| - if (cls.typeVariables.isEmpty) return; |
|
ngeoffray
2013/02/26 14:11:37
Why are you removing this check?
karlklose
2013/02/27 10:12:58
That was an error. Restored.
|
| if (classesNeedingRti.contains(cls)) return; |
| classesNeedingRti.add(cls); |
| @@ -79,14 +80,32 @@ class World { |
| } |
| } |
| + Set<ClassElement> classesUsingTypeVariableTests = new Set<ClassElement>(); |
| + compiler.resolverWorld.isChecks.forEach((DartType type) { |
| + if (type is TypeVariableType) { |
|
ngeoffray
2013/02/26 14:11:37
Use the kind?
karlklose
2013/02/27 10:12:58
Done.
|
| + TypeVariableElement variable = type.element; |
| + classesUsingTypeVariableTests.add(variable.enclosingElement); |
| + } |
| + }); |
| + compiler.resolverWorld.addImplicitChecks(classesUsingTypeVariableTests); |
| compiler.resolverWorld.isChecks.forEach((DartType type) { |
| if (type is InterfaceType) { |
|
ngeoffray
2013/02/26 14:11:37
Use the kind?
karlklose
2013/02/27 10:12:58
Done.
|
| InterfaceType itf = type; |
| if (!itf.isRaw) { |
| potentiallyAddForRti(itf.element); |
| } |
| + } else if (type is TypeVariableType) { |
|
ngeoffray
2013/02/26 14:11:37
USe the kind?
karlklose
2013/02/27 10:12:58
Done.
|
| + 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. |
|
ngeoffray
2013/02/26 14:11:37
Isn't that in the rtiDependencies map? Thinking ab
karlklose
2013/02/27 10:12:58
How do we know the instantiated class (in general)
|
| + instantiatedAbstractClasses.forEach((ClassElement cls) { |
| + potentiallyAddForRti(cls); |
| + }); |
| } |
| void registerMixinUse(MixinApplicationElement mixinApplication, |
| @@ -112,7 +131,8 @@ class World { |
| } |
| bool needsRti(ClassElement cls) { |
| - return classesNeedingRti.contains(cls) || compiler.enabledRuntimeType; |
| + return classesNeedingRti.contains(cls) || |
| + compiler.enabledRuntimeType; |
|
ngeoffray
2013/02/26 14:11:37
Fits in one line.
karlklose
2013/02/27 10:12:58
Done.
|
| } |
| bool hasAnyUserDefinedGetter(Selector selector) { |
| @@ -170,4 +190,8 @@ class World { |
| .map((Element member) => member.getEnclosingClass()) |
| .where((ClassElement holder) => !identical(holder, objectClass)); |
| } |
| + |
| + void registerInstantiatedAbstractClass(ClassElement cls) { |
| + instantiatedAbstractClasses.add(cls); |
| + } |
| } |