[dart2wasm] Fix inlining issue after introducing unchecked entrypoints
The dart2wasm compiler has a very crude way of avoiding recursive
inlining: It checks whether the target to be called is currently in the
inlining stack. Though it does so based on [Member]s instead of
[Reference]s or other abstraction.
Make the recursive inlining detection not check when it's about to
consider the body function for inlining, as the recursion detection is
sufficient for the checked/unchecked entry functions.
=> This recovers some regressions accidentally introduced when splitting
functions into checked/unchecked entry functions that call body
functions.
Change-Id: Ic32a8ac93edbda8c8be4eae0c5e416c4ea9bc3fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408181
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
diff --git a/pkg/dart2wasm/lib/translator.dart b/pkg/dart2wasm/lib/translator.dart
index 4eab4c0..871dc47 100644
--- a/pkg/dart2wasm/lib/translator.dart
+++ b/pkg/dart2wasm/lib/translator.dart
@@ -1520,10 +1520,16 @@
if (membersContainingInnerFunctions.contains(member)) return false;
if (membersBeingGenerated.contains(member)) {
// Guard against recursive inlining.
+ //
// Though we allow inlining calls to constructor initializer & body
// functions while generating the constructor.
+ //
+ // We also allow inlining calls to the member body functions as any
+ // recursive inlining would call to checked or unchecked entry which would
+ // disallow it.
if (!target.isInitializerReference &&
- !target.isConstructorBodyReference) {
+ !target.isConstructorBodyReference &&
+ !target.isBodyReference) {
return false;
}
}