Chromium Code Reviews| Index: runtime/vm/code_generator.cc |
| diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc |
| index 7e96333cb67938709e21e6c212f31826b218adc0..2c5869dcb004a5403c94ceb504aa95e4ec28873b 100644 |
| --- a/runtime/vm/code_generator.cc |
| +++ b/runtime/vm/code_generator.cc |
| @@ -60,6 +60,8 @@ DECLARE_FLAG(bool, report_usage_count); |
| DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); |
| DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); |
| +DECLARE_FLAG(charp, deoptimize_filter); |
| + |
| DEFINE_RUNTIME_ENTRY(TraceFunctionEntry, 1) { |
| const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); |
| @@ -1223,6 +1225,26 @@ DEFINE_RUNTIME_ENTRY(StackOverflow, 0) { |
| frame->set_pc(optimized_entry); |
| } |
| } |
| + |
| + if (FLAG_deoptimize_filter != NULL) { |
| + DartFrameIterator iterator; |
| + StackFrame* frame = iterator.NextFrame(); |
| + ASSERT(frame != NULL); |
| + const Code& code = Code::ZoneHandle(frame->LookupDartCode()); |
|
srdjan
2014/04/04 17:55:23
'code' can be Code::Handle as code does not escape
|
| + ASSERT(!code.IsNull()); |
| + if (code.is_optimized()) { |
| + const Function& function = Function::Handle(code.function()); |
| + ASSERT(!function.IsNull()); |
| + if (strstr(function.ToFullyQualifiedCString(), |
| + FLAG_deoptimize_filter) != NULL) { |
| + if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
| + OS::PrintErr("*** Forcing deoptimization (%s)\n", |
| + function.ToFullyQualifiedCString()); |
| + DeoptimizeAll(); |
| + } |
| + } |
| + } |
| + } |
| } |