Perf. Add fused Listener.handleSendWithoutArguments and handleInvocationWithoutTypeArguments.
Replace common sequences of handleNoTypeArguments, handleNoArguments,
and handleSend with two specialized listener events. This reduces
analyzer parse time by about 3.7%, and about 0.5% less perf
instructions during end-to-end benchmark.
Consider a bare identifier `x`. Before:
```text
initial stack: [..., x]
handleNoTypeArguments:
push TypeArgumentsAbsent
stack: [..., x, TypeArgumentsAbsent]
handleNoArguments:
push ArgumentsAbsent
stack: [..., x, TypeArgumentsAbsent, ArgumentsAbsent]
handleSend:
pop ArgumentsAbsent
pop TypeArgumentsAbsent
argumentList == null
doPropertyGet() // empty in analyzer AstBuilder
final stack: [..., x]
```
The entire transaction after `handleIdentifier` has no semantic effect.
The compound analyzer handler is consequently:
```dart
void handleNoTypeArgumentsAndNoArgumentsSend(...) {}
```
It eliminates:
- Three listener callbacks, replacing them with one.
- Two stack pushes.
- Two stack pops.
- Two array writes for the pushes.
- Two array reads and two clearing writes for the pops.
- Stack-length increments and decrements.
- Capacity checks on the pushes.
- `NullValue` type tests and sentinel comparisons on the pops.
- Nullable casts in `handleSend`.
- The `argumentList != null` branch.
- A call to the empty `doPropertyGet()`.
There normally are no eliminated allocations: the absent values are
shared sentinels and the stack array already exists. Occasional
stack-array growth could be avoided, but that is probably secondary. The
primary effects are fewer calls, fewer branches, and less stack-array
traffic.
Change-Id: If4854afb8c9e08c3471355eb750fe0274c1514fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/541780
Reviewed-by: Johnni Winther <johnniwinther@google.com>
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com> K
Konstantin Shcheglov committed
a48bd2a7d60f7177b4e99f109c7d6e6a7eef6cf9
Parent: f8ce5e2
Committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com <dart-scoped@luci-project-accounts.iam.gserviceaccount.com>
on 8/31/2026, 3:25:29 PM