[dart2wasm] Don't assign offsets to selectors for dynamic calls
With a06f10c we started to generate direct calls in dynamic invocations
so we no longer need dispatch table entries for members that are only
invoked in dynamic invocations.
Change-Id: I29efd7f1486126c91f4286c84878b16db9c36a05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271880
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
diff --git a/pkg/dart2wasm/lib/dispatch_table.dart b/pkg/dart2wasm/lib/dispatch_table.dart
index be735f4..2bce954 100644
--- a/pkg/dart2wasm/lib/dispatch_table.dart
+++ b/pkg/dart2wasm/lib/dispatch_table.dart
@@ -59,9 +59,6 @@
/// Number of non-abstract references in [targets].
late final int targetCount;
- /// Whether this selector's member is invoked in a dynamic invocation.
- bool _calledDynamically = false;
-
/// When [targetCount] is 1, this holds the only non-abstract target of the
/// selector.
late final Reference? singularTarget;
@@ -304,7 +301,6 @@
_selectorMetadata[selectorId].callCount, paramInfo, returnCount));
selector.paramInfo.merge(paramInfo);
selector._returnCount = max(selector._returnCount, returnCount);
- selector._calledDynamically |= calledDynamically;
if (calledDynamically) {
if (isGetter) {
(_dynamicGets[member.name.text] ??= []).add(selector);
@@ -412,7 +408,7 @@
// Assign selector offsets
- /// Whether the selector will be used in a dynamic or instance invocation.
+ /// Whether the selector will be used in an instance invocation.
///
/// If not, then we don't add the selector to the dispatch table and don't
/// assign it a dispatch table offset.
@@ -421,7 +417,6 @@
/// invocations of `objectNoSuchMethod` in dynamic calls, so keep it alive
/// even if there was no references to it from the Dart code.
bool needsDispatch(SelectorInfo selector) =>
- (selector._calledDynamically && selector.targetCount > 0) ||
(selector.callCount > 0 && selector.targetCount > 1) ||
(selector.paramInfo.member! == translator.objectNoSuchMethod);