Revision: 18160
Author:   [email protected]
Date:     Fri Nov 29 12:37:35 2013 UTC
Log:      Eliminate HCheckHeapObject instructions in check elimination.
BUG=
[email protected]

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

Modified:
 /branches/bleeding_edge/src/hydrogen-check-elimination.cc
 /branches/bleeding_edge/src/hydrogen-check-elimination.h

=======================================
--- /branches/bleeding_edge/src/hydrogen-check-elimination.cc Thu Nov 28 16:14:54 2013 UTC +++ /branches/bleeding_edge/src/hydrogen-check-elimination.cc Fri Nov 29 12:37:35 2013 UTC
@@ -97,6 +97,10 @@
         ReduceCheckMapValue(HCheckMapValue::cast(instr));
         break;
       }
+      case HValue::kCheckHeapObject: {
+        ReduceCheckHeapObject(HCheckHeapObject::cast(instr));
+        break;
+      }
       default: {
         // If the instruction changes maps uncontrollably, drop everything.
         if (instr->CheckGVNFlag(kChangesMaps) ||
@@ -105,7 +109,8 @@
         }
       }
       // Improvements possible:
-      // - eliminate HCheckSmi and HCheckHeapObject
+      // - eliminate redundant HCheckSmi, HCheckInstanceType instructions
+      // - track which values have been HCheckHeapObject'd
     }

     return this;
@@ -235,6 +240,14 @@
       Insert(object, map);
     }
   }
+
+  void ReduceCheckHeapObject(HCheckHeapObject* instr) {
+    if (FindMaps(instr->value()->ActualValue()) != NULL) {
+      // If the object has known maps, it's definitely a heap object.
+      instr->DeleteAndReplaceWith(instr->value());
+      INC_STAT(removed_cho_);
+    }
+  }

   void ReduceStoreNamedField(HStoreNamedField* instr) {
     HValue* object = instr->object()->ActualValue();
@@ -488,15 +501,19 @@
 // Are we eliminated yet?
 void HCheckEliminationPhase::PrintStats() {
 #if DEBUG
-  if (redundant_ > 0)      PrintF("  redundant   = %2d\n", redundant_);
-  if (removed_ > 0)        PrintF("  removed     = %2d\n", removed_);
-  if (narrowed_ > 0)       PrintF("  narrowed    = %2d\n", narrowed_);
-  if (loads_ > 0)          PrintF("  loads       = %2d\n", loads_);
-  if (empty_ > 0)          PrintF("  empty       = %2d\n", empty_);
-  if (compares_true_ > 0)  PrintF("  cmp_true    = %2d\n", compares_true_);
- if (compares_false_ > 0) PrintF(" cmp_false = %2d\n", compares_false_);
-  if (transitions_ > 0)    PrintF("  transitions = %2d\n", transitions_);
+  #define PRINT_STAT(x) if (x##_ > 0) PrintF(" %-16s = %2d\n", #x, x##_)
+#else
+  #define PRINT_STAT(x)
 #endif
+  PRINT_STAT(redundant);
+  PRINT_STAT(removed);
+  PRINT_STAT(removed_cho);
+  PRINT_STAT(narrowed);
+  PRINT_STAT(loads);
+  PRINT_STAT(empty);
+  PRINT_STAT(compares_true);
+  PRINT_STAT(compares_false);
+  PRINT_STAT(transitions);
 }

 } }  // namespace v8::internal
=======================================
--- /branches/bleeding_edge/src/hydrogen-check-elimination.h Thu Nov 28 15:50:54 2013 UTC +++ /branches/bleeding_edge/src/hydrogen-check-elimination.h Fri Nov 29 12:37:35 2013 UTC
@@ -43,6 +43,7 @@
       aliasing_(),
       redundant_(0),
       removed_(0),
+      removed_cho_(0),
       narrowed_(0),
       loads_(0),
       empty_(0),
@@ -60,6 +61,7 @@
   HAliasAnalyzer* aliasing_;
   int redundant_;
   int removed_;
+  int removed_cho_;
   int narrowed_;
   int loads_;
   int empty_;

--
--
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/groups/opt_out.

Reply via email to