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

Commit c67b9f2

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. Fixes dart-lang/sdk#37019 Change-Id: I6a0d0f30e191d887eb57bc00b868526b84f5083d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103807 Commit-Queue: Vyacheslav Egorov <[email protected]> Commit-Queue: Daco Harkes <[email protected]> Auto-Submit: Vyacheslav Egorov <[email protected]> Reviewed-by: Daco Harkes <[email protected]>
1 parent b3a06c1 commit c67b9f2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

runtime/vm/compiler/backend/flow_graph_compiler.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,6 +2105,7 @@ void FlowGraphCompiler::EmitTestAndCall(const CallTargets& targets,
21052105
intptr_t total_ic_calls,
21062106
Code::EntryKind entry_kind) {
21072107
ASSERT(is_optimizing());
2108+
ASSERT(complete || (failed != nullptr)); // Complete calls can't fail.
21082109

21092110
const Array& arguments_descriptor =
21102111
Array::ZoneHandle(zone(), args_info.ToArgumentsDescriptor());
@@ -2139,8 +2140,10 @@ void FlowGraphCompiler::EmitTestAndCall(const CallTargets& targets,
21392140

21402141
if (smi_case != kNoCase) {
21412142
Label after_smi_test;
2142-
EmitTestAndCallSmiBranch(non_smi_length == 0 ? failed : &after_smi_test,
2143-
/* jump_if_smi= */ false);
2143+
if (!complete) {
2144+
EmitTestAndCallSmiBranch(non_smi_length == 0 ? failed : &after_smi_test,
2145+
/* jump_if_smi= */ false);
2146+
}
21442147

21452148
// Do not use the code from the function, but let the code be patched so
21462149
// that we can record the outgoing edges to other code.

0 commit comments

Comments
 (0)