Chromium Code Reviews| Index: runtime/vm/flow_graph_inliner.cc |
| =================================================================== |
| --- runtime/vm/flow_graph_inliner.cc (revision 30197) |
| +++ runtime/vm/flow_graph_inliner.cc (working copy) |
| @@ -486,6 +486,9 @@ |
| return false; |
| } |
| + // Make a handle for the unoptimized code so that it is not disconnected |
| + // from the function while we are trying to inline it. |
| + const Code& unoptimized_code = Code::Handle(function.unoptimized_code()); |
| // Abort if the inlinable bit on the function is low. |
| if (!function.IsInlineable()) { |
| TRACE_INLINING(OS::Print(" Bailout: not inlinable\n")); |
| @@ -545,12 +548,12 @@ |
| // Load IC data for the callee. |
| Array& ic_data_array = Array::Handle(); |
| - if (function.HasCode()) { |
| - const Code& unoptimized_code = |
| - Code::Handle(function.unoptimized_code()); |
| - ic_data_array = unoptimized_code.ExtractTypeFeedbackArray(); |
| - } |
| + // IsInlineable above checked HasCode. Creating a ZoneHandle for the code |
|
srdjan
2013/11/19 19:18:29
s/ZoneHandle/Handle/ since you stored it into a sc
zra
2013/11/22 17:18:54
Done.
|
| + // should have kept GC from detaching, but let's assert just to make sure. |
| + ASSERT(function.HasCode()); |
| + ic_data_array = unoptimized_code.ExtractTypeFeedbackArray(); |
| + |
| // Build the callee graph. |
| InlineExitCollector* exit_collector = |
| new InlineExitCollector(caller_graph_, call); |
| @@ -667,7 +670,9 @@ |
| collected_call_sites_->FindCallSites(callee_graph, inlining_depth_); |
| // Add the function to the cache. |
| - if (!in_cache) function_cache_.Add(parsed_function); |
| + if (!in_cache) { |
| + function_cache_.Add(parsed_function); |
| + } |
| // Build succeeded so we restore the bailout jump. |
| inlined_ = true; |
| @@ -686,6 +691,9 @@ |
| (*callee_graph->guarded_fields())[i]); |
| } |
| + // We allocate a ZoneHandle for the unoptimized code so that it cannot be |
| + // disconnected from its function during the rest of compilation. |
| + Code::ZoneHandle(unoptimized_code.raw()); |
| TRACE_INLINING(OS::Print(" Success\n")); |
| return true; |
| } else { |