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

Unified Diff: pkg/compiler/lib/src/dump_info.dart

Issue 2569733002: Even less reliance on Compiler.closedWorld (Closed)
Patch Set: Updated cf. comments. Created 4 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
« no previous file with comments | « pkg/compiler/lib/src/core_types.dart ('k') | pkg/compiler/lib/src/elements/elements.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/dump_info.dart
diff --git a/pkg/compiler/lib/src/dump_info.dart b/pkg/compiler/lib/src/dump_info.dart
index 523186ccf2616d5cb0d11d07900327696afc5e7f..5bda2f3797b24aef47aa4dc301fb2b3601ea43a0 100644
--- a/pkg/compiler/lib/src/dump_info.dart
+++ b/pkg/compiler/lib/src/dump_info.dart
@@ -24,16 +24,18 @@ import 'types/types.dart' show TypeMask;
import 'universe/world_builder.dart' show ReceiverConstraint;
import 'universe/world_impact.dart'
show ImpactUseCase, WorldImpact, WorldImpactVisitorImpl;
+import 'world.dart' show ClosedWorld;
class ElementInfoCollector extends BaseElementVisitor<Info, dynamic> {
final Compiler compiler;
+ final ClosedWorld closedWorld;
final AllInfo result = new AllInfo();
final Map<Element, Info> _elementToInfo = <Element, Info>{};
final Map<ConstantValue, Info> _constantToInfo = <ConstantValue, Info>{};
final Map<OutputUnit, OutputUnitInfo> _outputToInfo = {};
- ElementInfoCollector(this.compiler);
+ ElementInfoCollector(this.compiler, this.closedWorld);
void run() {
compiler.dumpInfoTask._constantToNode.forEach((constant, node) {
@@ -260,12 +262,11 @@ class ElementInfoCollector extends BaseElementVisitor<Info, dynamic> {
// TODO(sigmund): why all these checks?
if (element.isInstanceMember &&
!element.isAbstract &&
- compiler.closedWorld.allFunctions.contains(element)) {
+ closedWorld.allFunctions.contains(element)) {
returnType = '${element.type.returnType}';
}
String inferredReturnType = '${_resultOf(element).returnType}';
- String sideEffects =
- '${compiler.closedWorld.getSideEffectsOfElement(element)}';
+ String sideEffects = '${closedWorld.getSideEffectsOfElement(element)}';
int inlinedCount = compiler.dumpInfoTask.inlineCount[element];
if (inlinedCount == null) inlinedCount = 0;
@@ -442,7 +443,7 @@ class DumpInfoTask extends CompilerTask implements InfoReporter {
* [element]. Each [Selection] contains an element that is
* used and the selector that selected the element.
*/
- Iterable<Selection> getRetaining(Element element) {
+ Iterable<Selection> getRetaining(Element element, ClosedWorld closedWorld) {
WorldImpact impact = impacts[element];
if (impact == null) return const <Selection>[];
@@ -451,7 +452,7 @@ class DumpInfoTask extends CompilerTask implements InfoReporter {
element,
impact,
new WorldImpactVisitorImpl(visitDynamicUse: (dynamicUse) {
- selections.addAll(compiler.closedWorld.allFunctions
+ selections.addAll(closedWorld.allFunctions
.filter(dynamicUse.selector, dynamicUse.mask)
.map((e) => new Selection(e, dynamicUse.mask)));
}, visitStaticUse: (staticUse) {
@@ -528,18 +529,18 @@ class DumpInfoTask extends CompilerTask implements InfoReporter {
return sb.toString();
}
- void dumpInfo() {
+ void dumpInfo(ClosedWorld closedWorld) {
measure(() {
- infoCollector = new ElementInfoCollector(compiler)..run();
+ infoCollector = new ElementInfoCollector(compiler, closedWorld)..run();
StringBuffer jsonBuffer = new StringBuffer();
- dumpInfoJson(jsonBuffer);
+ dumpInfoJson(jsonBuffer, closedWorld);
compiler.outputProvider('', 'info.json')
..add(jsonBuffer.toString())
..close();
});
}
- void dumpInfoJson(StringSink buffer) {
+ void dumpInfoJson(StringSink buffer, ClosedWorld closedWorld) {
JsonEncoder encoder = const JsonEncoder.withIndent(' ');
Stopwatch stopwatch = new Stopwatch();
stopwatch.start();
@@ -549,7 +550,7 @@ class DumpInfoTask extends CompilerTask implements InfoReporter {
infoCollector._elementToInfo.keys.where((k) => k is FunctionElement);
for (FunctionElement element in functionElements) {
FunctionInfo info = infoCollector._elementToInfo[element];
- Iterable<Selection> uses = getRetaining(element);
+ Iterable<Selection> uses = getRetaining(element, closedWorld);
// Don't bother recording an empty list of dependencies.
for (Selection selection in uses) {
// Don't register dart2js builtin functions that are not recorded.
« no previous file with comments | « pkg/compiler/lib/src/core_types.dart ('k') | pkg/compiler/lib/src/elements/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698