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

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

Issue 104893007: Trace lists when they are stored into other lists. (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 30937)
+++ sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart (working copy)
@@ -416,7 +416,7 @@
/// The maximum number of times we allow a node in the graph to
/// change types. If a node reaches that limit, we give up
/// inferencing on it and give it the dynamic type.
- final int MAX_CHANGE_COUNT = 5;
+ final int MAX_CHANGE_COUNT = 6;
int overallRefineCount = 0;
int addedInGraph = 0;
@@ -424,6 +424,23 @@
TypeGraphInferrerEngine(Compiler compiler, this.mainElement)
: super(compiler, new TypeInformationSystem(compiler));
+ void analyzeContainer(ContainerTypeInformation info) {
+ if (info.analyzed) return;
+ info.analyzed = true;
+ ContainerTracerVisitor tracer = new ContainerTracerVisitor(info, this);
+ List<TypeInformation> newAssignments = tracer.run();
+ if (newAssignments == null) {
+ return;
+ }
+ info.bailedOut = false;
+ info.elementType.inferred = true;
+ TypeMask fixedListType = compiler.typesTask.fixedListType;
+ if (info.originalContainerType.forwardTo == fixedListType) {
+ info.checksGrowable = tracer.callsGrowableMethod;
+ }
+ newAssignments.forEach(info.elementType.addAssignment);
+ }
+
void runOverAllElements() {
if (compiler.disableTypeInference) return;
compiler.progress.reset();
@@ -446,16 +463,8 @@
// Try to infer element types of lists.
types.allocatedContainers.values.forEach((ContainerTypeInformation info) {
if (info.elementType.inferred) return;
- ContainerTracerVisitor tracer = new ContainerTracerVisitor(info, this);
- List<TypeInformation> newAssignments = tracer.run();
- if (newAssignments == null) return;
-
- info.elementType.inferred = true;
- TypeMask fixedListType = compiler.typesTask.fixedListType;
- if (info.originalContainerType.forwardTo == fixedListType) {
- info.checksGrowable = tracer.callsGrowableMethod;
- }
- newAssignments.forEach(info.elementType.addAssignment);
+ analyzeContainer(info);
+ if (info.bailedOut) return;
workQueue.add(info);
workQueue.add(info.elementType);
});
@@ -493,12 +502,12 @@
if (analyzedElements.contains(element)) return;
analyzedElements.add(element);
- var visitor;
- if (compiler.irBuilder.hasIr(element)) {
- visitor = new IrTypeInferrerVisitor(compiler, element, this);
- } else {
- visitor = new SimpleTypeInferrerVisitor(element, compiler, this);
- }
+ var visitor;
+ if (compiler.irBuilder.hasIr(element)) {
+ visitor = new IrTypeInferrerVisitor(compiler, element, this);
+ } else {
+ visitor = new SimpleTypeInferrerVisitor(element, compiler, this);
+ }
TypeInformation type;
compiler.withCurrentElement(element, () {
type = visitor.run();

Powered by Google App Engine
This is Rietveld 408576698