Index: runtime/vm/deopt_instructions.cc |
diff --git a/runtime/vm/deopt_instructions.cc b/runtime/vm/deopt_instructions.cc |
index ffa87d77454e60d2480910da861c1ebe91377c9d..b1bf125b59447c60db82edf30dfa415c8239253b 100644 |
--- a/runtime/vm/deopt_instructions.cc |
+++ b/runtime/vm/deopt_instructions.cc |
@@ -10,6 +10,7 @@ |
#include "vm/locations.h" |
#include "vm/parser.h" |
#include "vm/stack_frame.h" |
+#include "vm/trace_buffer.h" |
namespace dart { |
@@ -339,12 +340,16 @@ intptr_t DeoptContext::MaterializeDeferredObjects() { |
// Since this is the only step where GC can occur during deoptimization, |
// use it to report the source line where deoptimization occured. |
+ DartFrameIterator iterator; |
+ StackFrame* top_frame = iterator.NextFrame(); |
+ ASSERT(top_frame != NULL); |
+ const Code& code = Code::Handle(top_frame->LookupDartCode()); |
turnidge
2014/04/14 16:41:17
Instead of using a DartFrameIterator to get the co
Cutch
2014/04/15 20:47:58
Done.
|
+ const Function& top_function = Function::Handle(code.function()); |
+ top_function.log()->TraceF("Deoptimized (reason %" Pd " '%s')", |
+ static_cast<intptr_t>(deopt_reason()), |
+ DeoptReasonToText(deopt_reason())); |
turnidge
2014/04/14 16:41:17
We should eventually include which code object was
Cutch
2014/04/15 20:47:58
Done.
|
+ |
if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
- DartFrameIterator iterator; |
- StackFrame* top_frame = iterator.NextFrame(); |
- ASSERT(top_frame != NULL); |
- const Code& code = Code::Handle(top_frame->LookupDartCode()); |
- const Function& top_function = Function::Handle(code.function()); |
const Script& script = Script::Handle(top_function.script()); |
const intptr_t token_pos = code.GetTokenIndexOfPC(top_frame->pc()); |
intptr_t line, column; |
@@ -353,6 +358,9 @@ intptr_t DeoptContext::MaterializeDeferredObjects() { |
OS::PrintErr(" Function: %s\n", top_function.ToFullyQualifiedCString()); |
OS::PrintErr(" Line %" Pd ": '%s'\n", line, line_string.ToCString()); |
OS::PrintErr(" Deopt args: %" Pd "\n", deopt_arg_count); |
+ top_function.log()->TraceF("Deoptimized at line %" Pd ": '%s'", |
+ line, |
+ line_string.ToCString()); |
} |
return deopt_arg_count; |