Skip to content

Commit b59b070

Browse files
rakudramaCommit Queue
authored andcommitted
[dart2js] Update includesClosureCallInDomain
Use `areDisjoint` as suggested in comment. Bug: #60895 Change-Id: I92b7e8b06703f078338a450bcc06b6e0790320bd Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434146 Reviewed-by: Mayank Patke <[email protected]> Commit-Queue: Stephen Adams <[email protected]>
1 parent ce27b47 commit b59b070

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

pkg/compiler/lib/src/js_model/js_world.dart

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -542,10 +542,6 @@ class JClosedWorld implements World {
542542
return false;
543543
}
544544

545-
late final ClassEntity _functionLub = getLubOfInstantiatedSubtypes(
546-
commonElements.functionClass,
547-
)!;
548-
549545
/// Returns `true` if [selector] on [receiver] can hit a `call` method on a
550546
/// subclass of `Closure` using the [abstractValueDomain].
551547
///
@@ -559,23 +555,9 @@ class JClosedWorld implements World {
559555
) {
560556
return selector.name == Identifiers.call &&
561557
(receiver == null ||
562-
// This is logically equivalent to the former implementation using
563-
// `abstractValueDomain.contains` (which wrapped `containsMask`).
564-
// The switch to `abstractValueDomain.containsType` is because
565-
// `contains` was generally unsound but happened to work correctly
566-
// here. See https://dart-review.googlesource.com/c/sdk/+/130565
567-
// for further discussion.
568-
//
569-
// This checks if the receiver mask contains the entire type cone
570-
// originating from [_functionLub] and may therefore be unsound if
571-
// the receiver mask contains only part of the type cone. (Is this
572-
// possible?)
573-
//
574-
// TODO(fishythefish): Use `isDisjoint` or equivalent instead of
575-
// `containsType` once we can ensure it's fast enough.
576558
abstractValueDomain
577-
.containsType(receiver, _functionLub)
578-
.isPotentiallyTrue);
559+
.areDisjoint(abstractValueDomain.functionType, receiver)
560+
.isPotentiallyFalse);
579561
}
580562

581563
/// Returns `true` if [selector] on [receiver] can hit a `call` method on a
@@ -591,9 +573,9 @@ class JClosedWorld implements World {
591573
Selector getSelector(ir.Expression node) => elementMap.getSelector(node);
592574

593575
/// Returns all the instance members that may be invoked with the [selector]
594-
/// on the given [receiver] using the [abstractValueDomain]. The returned elements may include noSuchMethod
595-
/// handlers that are potential targets indirectly through the noSuchMethod
596-
/// mechanism.
576+
/// on the given [receiver] using the [abstractValueDomain]. The returned
577+
/// elements may include noSuchMethod handlers that are potential targets
578+
/// indirectly through the noSuchMethod mechanism.
597579
Iterable<MemberEntity> locateMembersInDomain(
598580
Selector selector,
599581
AbstractValue? receiver,

0 commit comments

Comments
 (0)