Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(914)

Unified Diff: runtime/vm/flow_graph_inliner.cc

Issue 70183010: Fixes a couple problems with GC of unoptimized code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,10 @@
return false;
}
+ // Allocate a ZoneHandle so that the unoptimized code is not collected
+ // while we are trying to inline its function.
+ const Code& unoptimized_code =
Ivan Posva 2013/11/16 00:06:21 We should probably keep the code in a local handle
zra 2013/11/18 18:54:33 Done.
+ Code::ZoneHandle(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 +549,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
+ // 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 +671,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;

Powered by Google App Engine
This is Rietveld 408576698