diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc index eb9a885663f..0dd758140a5 100644 --- a/runtime/vm/code_generator.cc +++ b/runtime/vm/code_generator.cc @@ -1299,26 +1299,6 @@ DEFINE_RUNTIME_ENTRY(StackOverflow, 0) { } -static void PrintCaller(const char* msg) { - DartFrameIterator iterator; - StackFrame* top_frame = iterator.NextFrame(); - ASSERT(top_frame != NULL); - const Function& top_function = Function::Handle( - top_frame->LookupDartFunction()); - OS::PrintErr("Failed: '%s' %s @ %#"Px"\n", - msg, top_function.ToFullyQualifiedCString(), top_frame->pc()); - StackFrame* caller_frame = iterator.NextFrame(); - if (caller_frame != NULL) { - const Function& caller_function = Function::Handle( - caller_frame->LookupDartFunction()); - const Code& code = Code::Handle(caller_frame->LookupDartCode()); - OS::PrintErr(" -> caller: %s (%s)\n", - caller_function.ToFullyQualifiedCString(), - code.is_optimized() ? "optimized" : "unoptimized"); - } -} - - DEFINE_RUNTIME_ENTRY(TraceICCall, 2) { ASSERT(arguments.ArgCount() == kTraceICCallRuntimeEntry.argument_count()); @@ -1356,7 +1336,8 @@ DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { if (function.deoptimization_counter() >= FLAG_deoptimization_counter_threshold) { if (FLAG_trace_failed_optimization_attempts) { - PrintCaller("Too Many Deoptimizations"); + OS::PrintErr("Too Many Deoptimizations: %s\n", + function.ToFullyQualifiedCString()); } // TODO(srdjan): Investigate excessive deoptimization. function.set_usage_counter(kLowInvocationCount); diff --git a/runtime/vm/deopt_instructions.cc b/runtime/vm/deopt_instructions.cc index e03160989b6..1de66d0f045 100644 --- a/runtime/vm/deopt_instructions.cc +++ b/runtime/vm/deopt_instructions.cc @@ -14,6 +14,7 @@ namespace dart { DEFINE_FLAG(bool, compress_deopt_info, true, "Compress the size of the deoptimization info for optimized code."); +DECLARE_FLAG(bool, trace_deoptimization); DeoptimizationContext::DeoptimizationContext(intptr_t* to_frame_start, intptr_t to_frame_size, @@ -450,6 +451,11 @@ class DeoptPcMarkerInstr : public DeoptInstr { // Increment the deoptimization counter. This effectively increments each // function occurring in the optimized frame. function.set_deoptimization_counter(function.deoptimization_counter() + 1); + if (FLAG_trace_deoptimization) { + OS::PrintErr("Deoptimizing inlined %s (count %d)\n", + function.ToFullyQualifiedCString(), + function.deoptimization_counter()); + } // Clear invocation counter so that hopefully the function gets reoptimized // only after more feedback has been collected. function.set_usage_counter(0);