From a263aeee33c72898e51c3d0845f96018c56577e9 Mon Sep 17 00:00:00 2001 From: Nate Biggs Date: Tue, 20 Sep 2022 19:54:35 +0000 Subject: [PATCH] [dart2js] Add methods to closed world for call graph generation. Change-Id: I22240a93e785eea0505d3594fbc41306890e24ba Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260241 Reviewed-by: Mayank Patke Commit-Queue: Nate Biggs --- pkg/compiler/lib/src/js_model/js_world.dart | 3 +++ pkg/compiler/lib/src/world.dart | 1 + pkg/compiler/lib/src/world_interfaces.dart | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/pkg/compiler/lib/src/js_model/js_world.dart b/pkg/compiler/lib/src/js_model/js_world.dart index 0e949b5fcf6..776ae850a63 100644 --- a/pkg/compiler/lib/src/js_model/js_world.dart +++ b/pkg/compiler/lib/src/js_model/js_world.dart @@ -475,6 +475,9 @@ class JsClosedWorld implements JClosedWorld { return includesClosureCallInDomain(selector, receiver, abstractValueDomain); } + @override + Selector getSelector(ir.Expression node) => elementMap.getSelector(node); + @override AbstractValue computeReceiverType(Selector selector, AbstractValue receiver) { _ensureFunctionSet(); diff --git a/pkg/compiler/lib/src/world.dart b/pkg/compiler/lib/src/world.dart index 793554649e0..69a0cc8628a 100644 --- a/pkg/compiler/lib/src/world.dart +++ b/pkg/compiler/lib/src/world.dart @@ -82,6 +82,7 @@ abstract class JClosedWorld implements interfaces.JClosedWorld { @override AnnotationsData get annotationsData; + @override ClosureData get closureDataLookup; OutputUnitData get outputUnitData; diff --git a/pkg/compiler/lib/src/world_interfaces.dart b/pkg/compiler/lib/src/world_interfaces.dart index 1bde083dd9e..14defda0a03 100644 --- a/pkg/compiler/lib/src/world_interfaces.dart +++ b/pkg/compiler/lib/src/world_interfaces.dart @@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'closure.dart'; +import 'package:kernel/ast.dart' as ir; import 'common/elements.dart'; import 'elements/entities.dart'; import 'elements/types.dart'; @@ -29,6 +31,8 @@ abstract class JClosedWorld implements World { AnnotationsData get annotationsData; + ClosureData get closureDataLookup; + Iterable get liveInstanceMembers; bool isUsedAsMixin(ClassEntity cls); @@ -39,6 +43,8 @@ abstract class JClosedWorld implements World { Selector selector, AbstractValue? receiver); bool fieldNeverChanges(MemberEntity element); + + Selector getSelector(ir.Expression node); } // TODO(48820): Move back to `world.dart` when migrated.