Index: lib/compiler/implementation/ssa/bailout.dart |
diff --git a/lib/compiler/implementation/ssa/bailout.dart b/lib/compiler/implementation/ssa/bailout.dart |
index 8b57edf1baee946a43b8ddb02bd9114e5154dd6c..1df10d158e8420518cef115a02a8e3d55c46cc23 100644 |
--- a/lib/compiler/implementation/ssa/bailout.dart |
+++ b/lib/compiler/implementation/ssa/bailout.dart |
@@ -276,7 +276,9 @@ class SsaTypeGuardBuilder extends HBaseVisitor implements OptimizationPhase { |
} |
bool shouldCaptureEnvironment(HInstruction instruction) { |
- return instruction.type.isKnown() && !instruction.hasExpectedType(); |
+ HType propagatedType = instruction.propagatedType; |
+ return propagatedType.isUseful() |
+ && propagatedType != instruction.computeTypeFromInputTypes(); |
} |
void insertCapturedEnvironments() { |