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

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

Issue 1775253004: Revert "dart2js: Destroy some type inference graph edges after type inference." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
index 974e2d89d039f4677862f8bc8f9011fae6bb0339..98a9309d35567c9fd3ce8f42a27751f82b804289 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
@@ -237,12 +237,6 @@ abstract class TypeInformation {
abandonInferencing = false;
doNotEnqueue = false;
}
-
- /// Destroys information not needed after type inference.
- void cleanup() {
- users = null;
- _assignments = null;
- }
}
abstract class ApplyableTypeInformation implements TypeInformation {
@@ -391,10 +385,6 @@ class MemberTypeInformation extends ElementTypeInformation
*/
int closurizedCount = 0;
- // Strict `bool` value is computed in cleanup(). Also used as a flag to see if
- // cleanup has been called.
- bool _isCalledOnce = null;
-
/**
* This map contains the callers of [element]. It stores all unique call sites
* to enable counting the global number of call sites of [element].
@@ -402,23 +392,18 @@ class MemberTypeInformation extends ElementTypeInformation
* A call site is either an AST [ast.Node], a [cps_ir.Node] or in the case of
* synthesized calls, an [Element] (see uses of [synthesizeForwardingCall]
* in [SimpleTypeInferrerVisitor]).
- *
- * The global information is summarized in [cleanup], after which [_callers]
- * is set to `null`.
*/
- Map<Element, Setlet<Spannable>> _callers;
+ final Map<Element, Setlet<Spannable>> _callers = new Map<Element, Setlet>();
MemberTypeInformation._internal(Element element)
: super._internal(null, element);
void addCall(Element caller, Spannable node) {
assert(node is ast.Node || node is cps_ir.Node || node is Element);
- _callers ??= <Element, Setlet>{};
_callers.putIfAbsent(caller, () => new Setlet()).add(node);
}
void removeCall(Element caller, node) {
- if (_callers == null) return;
Setlet calls = _callers[caller];
if (calls == null) return;
calls.remove(node);
@@ -427,20 +412,9 @@ class MemberTypeInformation extends ElementTypeInformation
}
}
- Iterable<Element> get callers {
- // TODO(sra): This is called only from an unused API. If it becomes used,
- // [cleanup] will need to copy `_caller.keys`.
- assert(false); // Unused.
- return _callers.keys;
- }
+ Iterable<Element> get callers => _callers.keys;
bool isCalledOnce() {
- assert(_isCalledOnce != null);
- return _isCalledOnce;
- }
-
- bool _computeIsCalledOnce() {
- if (_callers == null) return false;
int count = 0;
for (var set in _callers.values) {
count += set.length;
@@ -556,13 +530,6 @@ class MemberTypeInformation extends ElementTypeInformation
return super.hasStableType(inferrer);
}
-
- void cleanup() {
- if (_isCalledOnce != null) return;
- _isCalledOnce = _computeIsCalledOnce();
- _callers = null;
- super.cleanup();
- }
}
/**
@@ -1352,12 +1319,6 @@ class ListTypeInformation extends TypeInformation
}
TypeMask safeType(TypeGraphInferrerEngine inferrer) => originalType;
-
- void cleanup() {
- super.cleanup();
- elementType.cleanup();
- _flowsInto = null;
- }
}
/**
@@ -1521,16 +1482,6 @@ class MapTypeInformation extends TypeInformation
super.hasStableType(inferrer);
}
- void cleanup() {
- super.cleanup();
- keyType.cleanup();
- valueType.cleanup();
- for (TypeInformation info in typeInfoMap.values) {
- info.cleanup();
- }
- _flowsInto = null;
- }
-
String toString() {
return 'Map $type (K:$keyType, V:$valueType) contents $typeInfoMap';
}
« no previous file with comments | « pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698