Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2111)

Unified Diff: runtime/vm/code_generator.cc

Issue 8588002: Better tracing of deoptimization (added a reason id and printing of source). Fix a bug with exces... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/code_generator.cc
===================================================================
--- runtime/vm/code_generator.cc (revision 1585)
+++ runtime/vm/code_generator.cc (working copy)
@@ -865,8 +865,9 @@
// pc in the unoptimized code.
// Since both unoptimized and optimized code have the same layout, we need only
// to patch the pc of the Dart frame and to disable/enable appropriate code.
-DEFINE_RUNTIME_ENTRY(Deoptimize, 0) {
+DEFINE_RUNTIME_ENTRY(Deoptimize, 1) {
ASSERT(arguments.Count() == kDeoptimizeRuntimeEntry.argument_count());
+ const Smi& deoptimization_reason_id = Smi::CheckedHandle(arguments.At(0));
DartFrameIterator iterator;
DartFrame* caller_frame = iterator.NextFrame();
ASSERT(caller_frame != NULL);
@@ -883,9 +884,11 @@
ASSERT(!descriptors.IsNull());
// Locate node id at deoptimization point inside optimized code.
intptr_t deopt_node_id = AstNode::kNoId;
+ intptr_t deopt_token_index = 0;
for (int i = 0; i < descriptors.Length(); i++) {
if (static_cast<uword>(descriptors.PC(i)) == caller_frame->pc()) {
deopt_node_id = descriptors.NodeId(i);
+ deopt_token_index = descriptors.TokenIndex(i);
break;
}
}
@@ -894,9 +897,19 @@
unoptimized_code.GetDeoptPcAtNodeId(deopt_node_id);
ASSERT(continue_at_pc != 0);
if (FLAG_trace_deopt) {
- OS::Print("Deoptimizing at pc 0x%x id %d '%s' -> continue at 0x%x \n",
- caller_frame->pc(), deopt_node_id, function.ToFullyQualifiedCString(),
+ OS::Print("Deoptimizing (reason %d) at pc 0x%x id %d '%s' "
+ "-> continue at 0x%x \n",
+ deoptimization_reason_id.Value(),
+ caller_frame->pc(),
+ deopt_node_id,
+ function.ToFullyQualifiedCString(),
continue_at_pc);
+ const Class& cls = Class::Handle(function.owner());
+ const Script& script = Script::Handle(cls.script());
+ intptr_t line, column;
+ script.GetTokenLocation(deopt_token_index, &line, &column);
+ OS::Print(" Line: %d Column: %d ", line, column);
+ OS::Print(">> %s\n", String::Handle(script.GetLine(line)).ToCString());
}
caller_frame->set_pc(continue_at_pc);
// Clear invocation counter so that the function gets optimized after

Powered by Google App Engine
This is Rietveld 408576698