Chromium Code Reviews| Index: runtime/vm/code_generator.cc |
| =================================================================== |
| --- runtime/vm/code_generator.cc (revision 11533) |
| +++ runtime/vm/code_generator.cc (working copy) |
| @@ -26,6 +26,8 @@ |
| namespace dart { |
| +DEFINE_FLAG(bool, deoptimize_alot, false, |
| + "Deoptimizes all live frames at runtime and native entries."); |
|
siva
2012/08/30 01:37:30
Deoptimizes all live frames when we are about to r
srdjan
2012/08/30 17:16:16
Done, removed reference to runtime.
|
| DEFINE_FLAG(bool, inline_cache, true, "Enable inline caches"); |
| DEFINE_FLAG(bool, trace_deopt, false, "Trace deoptimization"); |
| DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); |
| @@ -1395,7 +1397,30 @@ |
| } |
| +// Currently checks only that all optimized frames have kDeoptIndex |
| +// and unoptimized code has the kDeoptAfter. |
| +void DeoptimizeAll() { |
| + DartFrameIterator iterator; |
| + StackFrame* frame = iterator.NextFrame(); |
|
siva
2012/08/30 01:37:30
Code& optimized_code = Code::Handle();
Function& f
srdjan
2012/08/30 17:16:16
Done.
|
| + while (frame != NULL) { |
| + const Code& optimized_code = Code::Handle(frame->LookupDartCode()); |
|
siva
2012/08/30 01:37:30
optimized_code = frame->LookupDartCode();
srdjan
2012/08/30 17:16:16
Done.
|
| + if (optimized_code.is_optimized()) { |
| + intptr_t deopt_id, deopt_reason, deopt_index; |
| + GetDeoptIxDescrAtPc(optimized_code, frame->pc(), |
| + &deopt_id, &deopt_reason, &deopt_index); |
| + ASSERT(deopt_id != Isolate::kNoDeoptId); |
| + const Function& function = Function::Handle(optimized_code.function()); |
|
siva
2012/08/30 01:37:30
function = optimized_code.function();
unoptimized_
srdjan
2012/08/30 17:16:16
Done.
|
| + const Code& unoptimized_code = Code::Handle(function.unoptimized_code()); |
| + ASSERT(!unoptimized_code.IsNull()); |
| + uword continue_at_pc = |
| + unoptimized_code.GetDeoptAfterPcAtDeoptId(deopt_id); |
| + ASSERT(continue_at_pc != 0); |
|
siva
2012/08/30 01:37:30
Maybe also assert that
continue_at_pc > unoptimize
srdjan
2012/08/30 17:16:16
This check belongs in GetDeoptAfterPcAtDeoptId. Ad
|
| + } |
| + frame = iterator.NextFrame(); |
| + } |
| +} |
| + |
| // Copy saved registers into the isolate buffer. |
| static void CopySavedRegisters(intptr_t* saved_registers_address) { |
| intptr_t* registers_copy = new intptr_t[kNumberOfCpuRegisters]; |
| @@ -1563,7 +1588,7 @@ |
| GetDeoptIxDescrAtPc(optimized_code, caller_frame->pc(), |
| &deopt_id, &deopt_reason, &deopt_index); |
| ASSERT(deopt_id != Isolate::kNoDeoptId); |
| - uword continue_at_pc = unoptimized_code.GetDeoptPcAtDeoptId(deopt_id); |
| + uword continue_at_pc = unoptimized_code.GetDeoptBeforePcAtDeoptId(deopt_id); |
|
siva
2012/08/30 01:37:30
I am a little confused I thought unoptimized_code
srdjan
2012/08/30 17:16:16
DeoptBefore an DeoptAfter are continuation points
|
| if (FLAG_trace_deopt) { |
| OS::Print(" -> continue at 0x%x\n", continue_at_pc); |
| // TODO(srdjan): If we could allow GC, we could print the line where |