Files
sdk/pkg/dev_compiler/lib
Nicholas Shahan 14bb2be360 [ddc] Optimize building type environments at runtime
* Avoids retrieving the instance type in more cases. In static class
  methods (including constructor tear offs)
  `dart_rti.instanceType(this)` was being used as the base of the
  environment binding. In these cases the result was the reified type
  of the JavaScript function. This worked as long as the base type of
  the binding is ignored, but it was not intuitive and had to fall
  through all the other cases before settling on that result.

* Avoids parsing a recipe for the `dynamic` every time when we already
  can have it available in our type table.

Compiled code examples:
Building the type `A<R, S>` from function type parameters `R` and `S`:

Now:
  `T.dynamic()[_bind](R)[_bind](S)[_eval]("A<1,2>")`
Previously:
  `dart_rti.instanceType(this)[_bind](R)[_bind](S)[_eval]("A<1,2>")`

Building the type `B<R>` from function type parameters `R`:

Now:
  `R[_eval]("B<0>")`
Previously:
  `dart_rti.instanceType(this)[_bind](R)[_eval]("B<N+1>")`
   where N is the number of type arguments of the enclosing class.

``
Change-Id: I213666edd7c6427f0d42d958541e53a798e8877c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439460
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2025-07-10 13:08:45 -07:00
..
2025-06-05 10:40:57 -07:00