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

Unified Diff: runtime/vm/code_generator.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/code_generator.cc
===================================================================
--- runtime/vm/code_generator.cc (revision 30197)
+++ runtime/vm/code_generator.cc (working copy)
@@ -1343,9 +1343,15 @@
if (FLAG_use_osr && (interrupt_bits == 0)) {
DartFrameIterator iterator;
StackFrame* frame = iterator.NextFrame();
- const Function& function = Function::Handle(frame->LookupDartFunction());
+ const Code& code = Code::ZoneHandle(frame->LookupDartCode());
+ const Function& function = Function::Handle(code.function());
ASSERT(!function.IsNull());
- if (!CanOptimizeFunction(function, isolate)) return;
+ if (!function.HasCode()) {
Ivan Posva 2013/11/16 00:06:21 Code should not be detachable as it is live on the
zra 2013/11/18 18:54:33 Changed to ASSERT.
+ function.ReattachCode(code);
+ }
+ if (!CanOptimizeFunction(function, isolate)) {
+ return;
+ }
intptr_t osr_id =
Code::Handle(function.unoptimized_code()).GetDeoptIdForOsr(frame->pc());
if (FLAG_trace_osr) {
@@ -1356,9 +1362,12 @@
}
const Code& original_code = Code::Handle(function.CurrentCode());
+ ASSERT(!original_code.IsNull());
const Error& error =
Error::Handle(Compiler::CompileOptimizedFunction(function, osr_id));
- if (!error.IsNull()) Exceptions::PropagateError(error);
+ if (!error.IsNull()) {
+ Exceptions::PropagateError(error);
+ }
const Code& optimized_code = Code::Handle(function.CurrentCode());
// The current code will not be changed in the case that the compiler

Powered by Google App Engine
This is Rietveld 408576698