Index: src/crankshaft/hydrogen.cc |
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc |
index fd83081de556af8122405ca851099e015ed40555..fd7f5e6b93a00d2867f4a00f3d40b905038e250b 100644 |
--- a/src/crankshaft/hydrogen.cc |
+++ b/src/crankshaft/hydrogen.cc |
@@ -8411,13 +8411,6 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target, |
} |
} |
- // Generate the deoptimization data for the unoptimized version of |
- // the target function if we don't already have it. |
- if (!Compiler::EnsureDeoptimizationSupport(&target_info)) { |
- TraceInline(target, caller, "could not generate deoptimization info"); |
- return false; |
- } |
- |
// In strong mode it is an error to call a function with too few arguments. |
// In that case do not inline because then the arity check would be skipped. |
if (is_strong(function->language_mode()) && |
@@ -8427,6 +8420,17 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target, |
return false; |
} |
+ // Generate the deoptimization data for the unoptimized version of |
+ // the target function if we don't already have it. |
+ if (!Compiler::EnsureDeoptimizationSupport(&target_info)) { |
+ TraceInline(target, caller, "could not generate deoptimization info"); |
+ return false; |
+ } |
+ // Remember that we inlined this function. This needs to be called right |
+ // after the EnsureDeoptimizationSupport call so that the code flusher |
+ // does not remove the code with the deoptimization support. |
+ top_info()->AddInlinedFunction(target_info.shared_info()); |
+ |
// ---------------------------------------------------------------- |
// After this point, we've made a decision to inline this function (so |
// TryInline should always return true). |