Skip to content

Commit 20f9d4d

Browse files
alexmarkovcommit-bot@chromium.org
authored andcommitted
[vm,bytecode] Omit initialization of delayed type arguments for non-generic closures
Delayed type arguments are only used by generic closure functions, so their initialization can be omitted for non-generic closures. This is the follow-up for 1f58504. Change-Id: I61b05a4a4e2af4d2d8a543f6eec985a47b811761 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121924 Reviewed-by: Vyacheslav Egorov <vegorov@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
1 parent 1c2dc77 commit 20f9d4d

File tree

4 files changed

+234
-351
lines changed

4 files changed

+234
-351
lines changed

pkg/vm/lib/bytecode/gen_bytecode.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2614,9 +2614,12 @@ class BytecodeGenerator extends RecursiveVisitor<Null> {
26142614
_genPushFunctionTypeArguments();
26152615
asm.emitStoreFieldTOS(cp.addInstanceField(closureFunctionTypeArguments));
26162616

2617-
asm.emitPush(temp);
2618-
asm.emitPushConstant(cp.addEmptyTypeArguments());
2619-
asm.emitStoreFieldTOS(cp.addInstanceField(closureDelayedTypeArguments));
2617+
// Delayed type arguments are only used by generic closures.
2618+
if (function.typeParameters.isNotEmpty) {
2619+
asm.emitPush(temp);
2620+
asm.emitPushConstant(cp.addEmptyTypeArguments());
2621+
asm.emitStoreFieldTOS(cp.addInstanceField(closureDelayedTypeArguments));
2622+
}
26202623

26212624
asm.emitPush(temp);
26222625
asm.emitPushConstant(closureFunctionIndex);

0 commit comments

Comments
 (0)