| Index: sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart
|
| ===================================================================
|
| --- sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart (revision 31270)
|
| +++ sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart (working copy)
|
| @@ -59,9 +59,8 @@
|
| final Map<Node, TypeInformation> allocatedLists =
|
| new Map<Node, TypeInformation>();
|
|
|
| - /// [ClosureTypeInformation] for allocated closures.
|
| - final Map<Node, TypeInformation> allocatedClosures =
|
| - new Map<Node, TypeInformation>();
|
| + /// Closures found during the analysis.
|
| + final Set<TypeInformation> allocatedClosures = new Set<TypeInformation>();
|
|
|
| /// Cache of [ConcreteTypeInformation].
|
| final Map<TypeMask, TypeInformation> concreteTypes =
|
| @@ -307,8 +306,9 @@
|
| }
|
|
|
| TypeInformation allocateClosure(Node node, Element element) {
|
| - return allocatedClosures[node] =
|
| - new ClosureTypeInformation(node, element);
|
| + TypeInformation result = new ClosureTypeInformation(node, element);
|
| + allocatedClosures.add(result);
|
| + return result;
|
| }
|
|
|
| TypeInformation allocateMap(TypeInformation keyType,
|
| @@ -486,8 +486,10 @@
|
| workQueue.add(info.elementType);
|
| });
|
|
|
| - types.allocatedClosures.values.forEach((ClosureTypeInformation info) {
|
| - ClosureTracerVisitor tracer = new ClosureTracerVisitor(info, this);
|
| + types.allocatedClosures.forEach((info) {
|
| + ClosureTracerVisitor tracer = info is ClosureTypeInformation
|
| + ? new ClosureTracerVisitor(info.element, info, this)
|
| + : new StaticTearOffClosureTracerVisitor(info.element, info, this);
|
| tracer.run();
|
| if (!tracer.continueAnalyzing) return;
|
| FunctionElement element = info.element;
|
| @@ -626,7 +628,7 @@
|
| void buildWorkQueue() {
|
| workQueue.addAll(types.typeInformations.values);
|
| workQueue.addAll(types.allocatedTypes);
|
| - workQueue.addAll(types.allocatedClosures.values);
|
| + workQueue.addAll(types.allocatedClosures);
|
| workQueue.addAll(allocatedCalls);
|
| }
|
|
|
| @@ -659,11 +661,14 @@
|
| info.closurizedCount--;
|
| } else {
|
| info.closurizedCount++;
|
| + if (Elements.isStaticOrTopLevel(callee)) {
|
| + types.allocatedClosures.add(info);
|
| + }
|
| FunctionElement function = callee.implementation;
|
| FunctionSignature signature = function.computeSignature(compiler);
|
| signature.forEachParameter((Element parameter) {
|
| ElementTypeInformation info = types.getInferredTypeOf(parameter);
|
| - info.giveUp(this);
|
| + info.giveUp(this, clearAssignments: false);
|
| if (addToQueue) workQueue.addAll(info.users);
|
| });
|
| }
|
|
|