[dart2wasm] More precise inlining

This reduces e main module by around -0.3%.

We make the inliner have more precision when estimating the
callee size, especially around constructors but also other
cases.

We are also less generous with budget for iterators, modulo list
iterators which we want to be always inlined.

We also print the inlining decisions in `--print-wasm`

In deferred loading scenario this now inlines constructor bodies
more often than before as the size estimate is better. That in
return avoids us e.g. exporting empty constructor body functions
in the main module to be imported by other modules.

CoreLibraryReviewExempt: Backend-specific function changes.
Change-Id: I320db6f976a5d8c036b40908a5f72e7019d420ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498562
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This commit is contained in:
Martin Kustermann
2026-04-29 05:16:01 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 5a6b815789
commit 1d8d507384
16 changed files with 378 additions and 175 deletions
@@ -21,7 +21,6 @@ class BoxedInt {
String toString() => _jsBigIntToString(this, 10);
}
@pragma("wasm:prefer-inline")
String _jsBigIntToString(int i, int radix) {
final upperBits = (i >> 31);
final result = (upperBits == -1 || upperBits == 0)
+1
View File
@@ -116,6 +116,7 @@ class _BottomType extends _Type {
@pragma("wasm:entry-point")
class _TopType extends _Type {
@pragma("wasm:entry-point")
final int _kind;
// Values for the `_kind` field. Must match the definitions in `TopTypeKind`.
+1
View File
@@ -355,6 +355,7 @@ class ListIterator<E> implements Iterator<E> {
_length = iterable.length,
_index = 0;
@pragma("wasm:prefer-inline")
E get current => _current as E;
@pragma("vm:prefer-inline")