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

Unified Diff: sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart

Issue 112103007: Trace static tear-off closures. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
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);
});
}

Powered by Google App Engine
This is Rietveld 408576698