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

Unified Diff: pkg/compiler/lib/src/inferrer/type_graph_dump.dart

Issue 2762493002: Type tracing bug fix for issue 28919. (Closed)
Patch Set: need to test number of arguments Created 3 years, 9 months 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: pkg/compiler/lib/src/inferrer/type_graph_dump.dart
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_dump.dart b/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
index 5f786caa1fd25a65ebb33098e6e7a3134a082790..13a7e7b19a8ed9fefab8b6c6b976e9873fd8528d 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
@@ -8,6 +8,7 @@ import '../elements/elements.dart';
import '../types/types.dart';
import 'inferrer_engine.dart';
import 'type_graph_nodes.dart';
+import 'debug.dart';
/// Dumps the type inference graph in Graphviz Dot format into the `typegraph`
/// subfolder of the current working directory. Each function body is dumped in
@@ -79,7 +80,7 @@ class TypeGraphDump {
.outputProvider('$outputDir/$name', 'dot', OutputType.debug);
_GraphGenerator visitor = new _GraphGenerator(this, element, output);
for (TypeInformation node in nodes[element]) {
- node.accept(visitor);
+ visitor.visit(node);
}
visitor.addMissingNodes();
visitor.finish();
@@ -169,11 +170,15 @@ class _GraphGenerator extends TypeInformationVisitor {
while (worklist.isNotEmpty) {
TypeInformation node = worklist.removeLast();
assert(nodeId.containsKey(node));
- if (seen.contains(node)) continue;
- node.accept(this);
+ visit(node);
}
}
+ void visit(TypeInformation info) {
+ if (seen.contains(info)) return;
+ info.accept(this);
+ }
+
void append(String string) {
output..add(string)..add('\n');
}
@@ -311,14 +316,25 @@ class _GraphGenerator extends TypeInformationVisitor {
}
}
}
+ if (PRINT_GRAPH_ALL_NODES) {
+ for (TypeInformation user in node.users) {
+ if (!isExternal(user)) {
+ visit(user);
+ }
+ }
+ }
}
void visitNarrowTypeInformation(NarrowTypeInformation info) {
+ // Omit unused Narrows.
+ if (!PRINT_GRAPH_ALL_NODES && info.users.isEmpty) return;
addNode(info, 'Narrow\n${formatType(info.typeAnnotation)}',
color: narrowColor);
}
void visitPhiElementTypeInformation(PhiElementTypeInformation info) {
+ // Omit unused Phis.
+ if (!PRINT_GRAPH_ALL_NODES && info.users.isEmpty) return;
addNode(info, 'Phi ${info.variable?.name ?? ''}', color: phiColor);
}

Powered by Google App Engine
This is Rietveld 408576698