Index: runtime/vm/flow_graph_optimizer.cc |
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc |
index 421ff45e2782d026f022a4749d8174503c4b4111..feb72c182727dddb0a72b8a412e2644f09e3e015 100644 |
--- a/runtime/vm/flow_graph_optimizer.cc |
+++ b/runtime/vm/flow_graph_optimizer.cc |
@@ -4654,10 +4654,14 @@ void FlowGraphOptimizer::VisitStoreInstanceField( |
} |
} |
field.set_is_unboxing_candidate(false); |
- // Delay deoptimization of dependent code to the code installation time. |
- // The invalidation of the background compilation result occurs only |
- // when the deoptimization is triggered at code installation. |
- flow_graph()->deoptimize_dependent_code().Add(&field); |
+ if (Compiler::IsBackgroundCompilation()) { |
+ // Delay deoptimization of dependent code to the code installation time. |
+ // The invalidation of the background compilation result occurs only |
+ // when the deoptimization is triggered at code installation. |
+ flow_graph()->deoptimize_dependent_code().Add(&field); |
+ } else { |
+ field.DeoptimizeDependentCode(); |
+ } |
} else { |
FlowGraph::AddToGuardedFields(flow_graph_->guarded_fields(), &field); |
} |