dart2js: Emit fields in dump-info in more cases.

Previously we would omit a field if it was never the element
in a codegen WorkItem. However, almost all fields fail this test
because field getters are inlined in the optimizer.

Change-Id: I34de218dadb5937885d77dd429237584d1a8be2c
Reviewed-on: https://dart-review.googlesource.com/51581
Commit-Queue: Harry Terkelsen <het@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
This commit is contained in:
Harry Terkelsen 2018-04-19 22:14:18 +00:00 committed by commit-bot@chromium.org
parent 4fdf84e4f4
commit ffc1f607a1

View file

@ -128,7 +128,9 @@ class ElementInfoCollector {
compiler.globalInference.results.resultOfParameter(e);
FieldInfo visitField(FieldEntity field) {
if (!_hasBeenResolved(field)) return null;
if (!_hasBeenResolved(field)) {
return null;
}
TypeMask inferredType = _resultOfMember(field).type;
// If a field has an empty inferred type it is never used.
if (inferredType == null || inferredType.isEmpty) return null;
@ -163,6 +165,12 @@ class ElementInfoCollector {
return info;
}
bool _hasBeenResolved(MemberEntity entity) {
return compiler.globalInference.typesInferrerInternal.inferrer.types
.memberTypeInformations
.containsKey(entity);
}
ClassInfo visitClass(ClassEntity clazz) {
// Omit class if it is not needed.
if (!_hasClassBeenResolved(clazz)) return null;
@ -372,11 +380,6 @@ class ElementInfoCollector {
return _infoFromOutputUnit(outputUnit);
}
bool _hasBeenResolved(Entity entity) {
return compiler.enqueuer.codegenEnqueuerForTesting.processedEntities
.contains(entity);
}
bool _hasClassBeenResolved(ClassEntity cls) {
return compiler.backend.mirrorsData.isClassResolved(cls);
}