Revision: 9414
Author:   [email protected]
Date:     Fri Sep 23 05:13:27 2011
Log: Make --trace-deopt --code-comments print the Lithium instruction that caused deoptimization.

This saves us from manually searching the disassembled code for the bailout id
when looking for the reason for deoptimization.
Review URL: http://codereview.chromium.org/8008013
http://code.google.com/p/v8/source/detail?r=9414

Modified:
 /branches/bleeding_edge/src/deoptimizer.cc

=======================================
--- /branches/bleeding_edge/src/deoptimizer.cc  Tue Sep 20 00:14:30 2011
+++ /branches/bleeding_edge/src/deoptimizer.cc  Fri Sep 23 05:13:27 2011
@@ -347,6 +347,26 @@
   if (type == EAGER) {
     ASSERT(from == NULL);
     optimized_code_ = function_->code();
+    if (FLAG_trace_deopt && FLAG_code_comments) {
+      // Print instruction associated with this bailout.
+      const char* last_comment = NULL;
+      int mask = RelocInfo::ModeMask(RelocInfo::COMMENT)
+          | RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY);
+ for (RelocIterator it(optimized_code_, mask); !it.done(); it.next()) {
+        RelocInfo* info = it.rinfo();
+        if (info->rmode() == RelocInfo::COMMENT) {
+          last_comment = reinterpret_cast<const char*>(info->data());
+        }
+        if (info->rmode() == RelocInfo::RUNTIME_ENTRY) {
+          unsigned id = Deoptimizer::GetDeoptimizationId(
+              info->target_address(), Deoptimizer::EAGER);
+          if (id == bailout_id && last_comment != NULL) {
+            PrintF("            %s\n", last_comment);
+            break;
+          }
+        }
+      }
+    }
   } else if (type == LAZY) {
     optimized_code_ = FindDeoptimizingCodeFromAddress(from);
     ASSERT(optimized_code_ != NULL);

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to