Fix printing of deoptimized function.

Review URL: https://codereview.chromium.org//11886008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17002 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
srdjan@google.com 2013-01-12 00:44:16 +00:00
parent a02f310d91
commit faeb58ba40
2 changed files with 8 additions and 21 deletions

View file

@ -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);

View file

@ -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);