Chromium Code Reviews| 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 |