| Index: runtime/vm/code_generator.cc
|
| diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
|
| index 7e96333cb67938709e21e6c212f31826b218adc0..923587480c83ad15e5092ec1b31250dfd0c8ac2d 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,28 @@ 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::Handle(frame->LookupDartCode());
|
| + 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());
|
| + // TODO(turnidge): Consider changing to DeoptimizeAt for
|
| + // just the top frame.
|
| + DeoptimizeAll();
|
| + }
|
| + }
|
| + }
|
| + }
|
| }
|
|
|
|
|
|
|