Revision: 23191
Author:   [email protected]
Date:     Tue Aug 19 10:56:49 2014 UTC
Log: When marking dependent code for deoptimization print the group that is being deoptimized.

Otherwise it is impossible to figure out from the --trace-deoptimization output what is going on.

[email protected]

Review URL: https://codereview.chromium.org/467183002
http://code.google.com/p/v8/source/detail?r=23191

Modified:
 /branches/bleeding_edge/src/heap/mark-compact.cc
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/src/objects.h

=======================================
--- /branches/bleeding_edge/src/heap/mark-compact.cc Tue Aug 12 15:29:03 2014 UTC +++ /branches/bleeding_edge/src/heap/mark-compact.cc Tue Aug 19 10:56:49 2014 UTC
@@ -2724,7 +2724,8 @@
     DCHECK(entries->is_code_at(i));
     Code* code = entries->code_at(i);
     if (IsMarked(code) && !code->marked_for_deoptimization()) {
-      code->set_marked_for_deoptimization(true);
+      DependentCode::SetMarkedForDeoptimization(
+          code, static_cast<DependentCode::DependencyGroup>(g));
       code->InvalidateEmbeddedObjects();
       have_code_to_deoptimize_ = true;
     }
=======================================
--- /branches/bleeding_edge/src/objects.cc      Tue Aug 19 08:53:38 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc      Tue Aug 19 10:56:49 2014 UTC
@@ -11786,7 +11786,7 @@
     if (is_code_at(i)) {
       Code* code = code_at(i);
       if (!code->marked_for_deoptimization()) {
-        code->set_marked_for_deoptimization(true);
+        SetMarkedForDeoptimization(code, group);
         marked = true;
       }
     } else {
@@ -11835,6 +11835,51 @@
     set_object_at(i, *stub);
   }
 }
+
+
+void DependentCode::SetMarkedForDeoptimization(Code* code,
+                                               DependencyGroup group) {
+  code->set_marked_for_deoptimization(true);
+  if (FLAG_trace_deopt &&
+ (code->deoptimization_data() != code->GetHeap()->empty_fixed_array())) {
+    DeoptimizationInputData* deopt_data =
+        DeoptimizationInputData::cast(code->deoptimization_data());
+    CodeTracer::Scope scope(code->GetHeap()->isolate()->GetCodeTracer());
+    PrintF(scope.file(), "[marking dependent code 0x%08" V8PRIxPTR
+                         " (opt #%d) for deoptimization, reason: %s]\n",
+           reinterpret_cast<intptr_t>(code),
+ deopt_data->OptimizationId()->value(), DependencyGroupName(group));
+  }
+}
+
+
+const char* DependentCode::DependencyGroupName(DependencyGroup group) {
+  switch (group) {
+    case kWeakICGroup:
+      return "weak-ic";
+    case kWeakCodeGroup:
+      return "weak-code";
+    case kTransitionGroup:
+      return "transition";
+    case kPrototypeCheckGroup:
+      return "prototype-check";
+    case kElementsCantBeAddedGroup:
+      return "elements-cant-be-added";
+    case kPropertyCellChangedGroup:
+      return "property-cell-changed";
+    case kFieldTypeGroup:
+      return "field-type";
+    case kInitialMapChangedGroup:
+      return "initial-map-changed";
+    case kAllocationSiteTenuringChangedGroup:
+      return "allocation-site-tenuring-changed";
+    case kAllocationSiteTransitionChangedGroup:
+      return "allocation-site-transition-changed";
+    default:
+      UNREACHABLE();
+      return "?";
+  }
+}


 Handle<Map> Map::TransitionToPrototype(Handle<Map> map,
=======================================
--- /branches/bleeding_edge/src/objects.h       Tue Aug 19 08:14:01 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Tue Aug 19 10:56:49 2014 UTC
@@ -6006,6 +6006,9 @@
   static DependentCode* ForObject(Handle<HeapObject> object,
                                   DependencyGroup group);

+  static const char* DependencyGroupName(DependencyGroup group);
+ static void SetMarkedForDeoptimization(Code* code, DependencyGroup group);
+
  private:
   // Make a room at the end of the given group by moving out the first
   // code objects of the subsequent groups.

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to