Files
sdk/pkg/compiler/lib
Stephen Adams e962350dd6 [dart2js] Simply is-test when type parameters not needed
Sometimes the type expression of a is-test can be widened to one that
does not use type variables:

```dart
void addAll(Iterable<E> items) {
  if (items is List<E>) {
    ... items[i] ...  // code specialized to lists
  }
  ...
}
```

Changing `is List<E>` to `is List` is more efficient, but not possible
at the source level since the explicit type parameter is needed for
type promotion.

This change uses a predicate provided by the Kernel package to widen
an interface type when generating the CFG instructions for the
is-test. This can lead to knock-on optimizations like compiling `is X`
to `instanceof`.



Bug: #54998
Change-Id: I956b9d9b8a31ae40aee86e31def475baa9ab5cfe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408124
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2025-02-06 16:54:50 -08:00
..