Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 9690389

Browse files
mralephcommit-bot@chromium.org
authored andcommitted
[compiler] Fix EmitTestAndCall for a complete call of a Smi method.
In rare circumstances we can generate a complete monomorphic PolymorphicInstanceCall targeting a method of Smi class. In this case we don't need to check anything - we can simply emit a static call. (This fixes a bug in the incorrect fix submitted earlier as c67b9f2 - even if call is complete we still need to check for a smi receiver if there are more possible receiver classes) Fixes #37019 Bug: 37019 Change-Id: If0250ba2811f00cc4fe595bf7cd03a7c0d820076 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103809 Reviewed-by: Vyacheslav Egorov <[email protected]> Commit-Queue: Vyacheslav Egorov <[email protected]>
1 parent 3a2bc9b commit 9690389

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

runtime/vm/compiler/backend/flow_graph_compiler.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2140,7 +2140,10 @@ void FlowGraphCompiler::EmitTestAndCall(const CallTargets& targets,
21402140

21412141
if (smi_case != kNoCase) {
21422142
Label after_smi_test;
2143-
if (!complete) {
2143+
// If the call is complete and there are no other possible receiver
2144+
// classes - then receiver can only be a smi value and we don't need
2145+
// to check if it is a smi.
2146+
if (!(complete && non_smi_length == 0)) {
21442147
EmitTestAndCallSmiBranch(non_smi_length == 0 ? failed : &after_smi_test,
21452148
/* jump_if_smi= */ false);
21462149
}

0 commit comments

Comments
 (0)