Chromium Code Reviews| Index: runtime/vm/debugger.cc |
| =================================================================== |
| --- runtime/vm/debugger.cc (revision 5364) |
| +++ runtime/vm/debugger.cc (working copy) |
| @@ -485,7 +485,24 @@ |
| } |
| -void Debugger::InstrumentForStepping(const Function &target_function) { |
| +// Deoptimize function if necessary. Does not patch return addresses on the |
| +// stack. If there are activation frames of this function on the stack, |
| +// the optimized code will be executed when the callee returns. |
| +void Debugger::EnsureFunctionIsDeoptimized(const Function& func) { |
| + if (func.HasOptimizedCode()) { |
| + if (verbose) { |
| + printf("Deoptimizing function %s\n", |
|
srdjan
2012/03/13 17:11:35
OS::Print
hausner
2012/03/13 20:45:03
Done.
|
| + String::Handle(func.name()).ToCString()); |
| + } |
| + func.set_usage_counter(0); |
| + func.set_deoptimization_counter(func.deoptimization_counter() + 1); |
|
srdjan
2012/03/13 17:11:35
Don't increase the counter otherwise setting and c
hausner
2012/03/13 20:45:03
Done.
|
| + Compiler::CompileFunction(func); |
| + ASSERT(!func.HasOptimizedCode()); |
| + } |
| +} |
| + |
| + |
| +void Debugger::InstrumentForStepping(const Function& target_function) { |
| if (!target_function.HasCode()) { |
| Compiler::CompileFunction(target_function); |
| // If there were any errors, ignore them silently and return without |
| @@ -493,8 +510,9 @@ |
| if (!target_function.HasCode()) { |
| return; |
| } |
| + } else { |
| + EnsureFunctionIsDeoptimized(target_function); |
|
srdjan
2012/03/13 17:11:35
I rather think positive:
if (target.HasCode()) {
hausner
2012/03/13 20:45:03
The glass is now half full.
On 2012/03/13 17:11:3
|
| } |
| - ASSERT(!target_function.HasOptimizedCode()); |
| Code& code = Code::Handle(target_function.unoptimized_code()); |
| ASSERT(!code.IsNull()); |
| PcDescriptors& desc = PcDescriptors::Handle(code.pc_descriptors()); |
| @@ -563,6 +581,7 @@ |
| // The given token position is not within the target function. |
| return NULL; |
| } |
| + EnsureFunctionIsDeoptimized(target_function); |
| SourceBreakpoint* bpt = GetSourceBreakpoint(target_function, token_index); |
| if (bpt != NULL) { |
| // A breakpoint for this location already exists, return it. |