Skip to content

Commit 37a1f79

Browse files
rakudramacommit-bot@chromium.org
authored andcommitted
[dart2js] Move letBindings to StackFrame
This makes letBindings safe for recursive inlining. Change-Id: I1ffddbc33f75a62c651adf7b6166e2695556578a Reviewed-on: https://dart-review.googlesource.com/c/91243 Commit-Queue: Stephen Adams <[email protected]> Reviewed-by: Sigmund Cherem <[email protected]>
1 parent ec34316 commit 37a1f79

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pkg/compiler/lib/src/ssa/builder_kernel.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ class StackFrame {
6363
final MemberEntity member;
6464
final AsyncMarker asyncMarker;
6565
final KernelToLocalsMap localsMap;
66+
// [ir.Let] and [ir.LocalInitializer] bindings.
67+
final Map<ir.VariableDeclaration, HInstruction> letBindings;
6668
final KernelToTypeInferenceMap typeInferenceMap;
6769
final SourceInformationBuilder sourceInformationBuilder;
6870
final StaticTypeProvider staticTypeProvider;
@@ -72,6 +74,7 @@ class StackFrame {
7274
this.member,
7375
this.asyncMarker,
7476
this.localsMap,
77+
this.letBindings,
7578
this.typeInferenceMap,
7679
this.sourceInformationBuilder,
7780
this.staticTypeProvider);
@@ -115,10 +118,6 @@ class KernelSsaGraphBuilder extends ir.Visitor
115118

116119
final NativeEmitter nativeEmitter;
117120

118-
// [ir.Let] and [ir.LocalInitializer] bindings.
119-
final Map<ir.VariableDeclaration, HInstruction> letBindings =
120-
<ir.VariableDeclaration, HInstruction>{};
121-
122121
/// True if we are visiting the expression of a throw statement; we assume
123122
/// this is a slow path.
124123
bool _inExpressionOfThrow = false;
@@ -160,6 +159,9 @@ class KernelSsaGraphBuilder extends ir.Visitor
160159

161160
KernelToLocalsMap get localsMap => _currentFrame.localsMap;
162161

162+
Map<ir.VariableDeclaration, HInstruction> get letBindings =>
163+
_currentFrame.letBindings;
164+
163165
JCommonElements get _commonElements => _elementMap.commonElements;
164166

165167
KernelToTypeInferenceMap get _typeInferenceMap =>
@@ -192,6 +194,7 @@ class KernelSsaGraphBuilder extends ir.Visitor
192194
member,
193195
asyncMarker,
194196
closedWorld.globalLocalsMap.getLocalsMap(member),
197+
{},
195198
new KernelToTypeInferenceMapImpl(member, globalInferenceResults),
196199
_currentFrame != null
197200
? _currentFrame.sourceInformationBuilder
@@ -5044,8 +5047,7 @@ class KernelSsaGraphBuilder extends ir.Visitor
50445047
}
50455048

50465049
bool heuristicSayGoodToGo() {
5047-
// Don't inline recursively, directly or indirectly.
5048-
if (function == targetElement) return false;
5050+
// Don't inline recursively,
50495051
if (_inliningStack.any((entry) => entry.function == function)) {
50505052
return false;
50515053
}

0 commit comments

Comments
 (0)