Reviewers: Kevin Millikin,

Description:
Only invoke reaching definitions if there are >0 variables and >0 definitions.


Please review this at http://codereview.chromium.org/885004

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/compiler.cc
  M     src/data-flow.cc


Index: src/data-flow.cc
===================================================================
--- src/data-flow.cc    (revision 4119)
+++ src/data-flow.cc    (working copy)
@@ -2061,7 +2061,7 @@


 void ReachingDefinitions::Compute() {
-  if (definitions_->is_empty()) return;
+  ASSERT(!definitions_->is_empty());

   int variable_count = variables_.length();
   int definition_count = definitions_->length();
Index: src/compiler.cc
===================================================================
--- src/compiler.cc     (revision 4119)
+++ src/compiler.cc     (working copy)
@@ -95,10 +95,12 @@
     if (!builder.HasStackOverflow()) {
       int variable_count =
function->num_parameters() + function->scope()->num_stack_slots();
-      ReachingDefinitions rd(builder.postorder(),
-                             builder.definitions(),
-                             variable_count);
-      rd.Compute();
+      if (variable_count > 0 && builder.definitions()->length() > 0) {
+        ReachingDefinitions rd(builder.postorder(),
+                               builder.definitions(),
+                               variable_count);
+        rd.Compute();
+      }
     }

 #ifdef DEBUG
@@ -497,10 +499,12 @@
     if (!builder.HasStackOverflow()) {
       int variable_count =
           literal->num_parameters() + literal->scope()->num_stack_slots();
-      ReachingDefinitions rd(builder.postorder(),
-                             builder.definitions(),
-                             variable_count);
-      rd.Compute();
+      if (variable_count > 0 && builder.definitions()->length() > 0) {
+        ReachingDefinitions rd(builder.postorder(),
+                               builder.definitions(),
+                               variable_count);
+        rd.Compute();
+      }
     }

 #ifdef DEBUG


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

Reply via email to