Index: runtime/vm/intermediate_language.cc |
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc |
index 956797c49bf934dbaad44a68e0871532cf068a4b..8f2bc4cfc34ed63491cf9b6eb3abe04ec6656b29 100644 |
--- a/runtime/vm/intermediate_language.cc |
+++ b/runtime/vm/intermediate_language.cc |
@@ -2065,7 +2065,13 @@ Definition* UnboxIntegerInstr::Canonicalize(FlowGraph* flow_graph) { |
box_defn->value()->CopyWithType(), |
(representation() == kUnboxedInt32) ? |
GetDeoptId() : Isolate::kNoDeoptId); |
- if ((representation() == kUnboxedInt32) && is_truncating()) { |
+ // TODO(vegorov): marking resulting converted as truncating when |
+ // unboxing can't deoptimize is a work-around missing |
+ // deoptimization environment in case when we insert converter after |
+ // EliminateEnvironments and there is mismatch between predicates |
+ // UnboxIntConverterInstr::CanDeoptimize and UnboxInt32::CanDeoptimize. |
+ if ((representation() == kUnboxedInt32) && |
+ (is_truncating() || !CanDeoptimize())) { |
converter->mark_truncating(); |
} |
flow_graph->InsertBefore(this, converter, env(), FlowGraph::kValue); |