Fix DCHECK in ScopeInfo::Print().
authorben <ben@strongloop.com>
Mon, 28 Sep 2015 14:12:35 +0000 (07:12 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 28 Sep 2015 14:12:54 +0000 (14:12 +0000)
Review URL: https://codereview.chromium.org/1369913002

Cr-Commit-Position: refs/heads/master@{#30978}

src/scopeinfo.cc

index 75938c3..732908a 100644 (file)
@@ -813,19 +813,15 @@ void ScopeInfo::Print() {
   }
   PrintF("{");
 
-  PrintList("parameters", 0,
-            ParameterEntriesIndex(),
-            ParameterEntriesIndex() + ParameterCount(),
-            this);
-  PrintList("stack slots", 0,
-            StackLocalEntriesIndex(),
-            StackLocalEntriesIndex() + StackLocalCount(),
-            this);
-  PrintList("context slots",
-            Context::MIN_CONTEXT_SLOTS,
-            ContextLocalNameEntriesIndex(),
-            ContextLocalNameEntriesIndex() + ContextLocalCount(),
-            this);
+  if (length() > 0) {
+    PrintList("parameters", 0, ParameterEntriesIndex(),
+              ParameterEntriesIndex() + ParameterCount(), this);
+    PrintList("stack slots", 0, StackLocalEntriesIndex(),
+              StackLocalEntriesIndex() + StackLocalCount(), this);
+    PrintList("context slots", Context::MIN_CONTEXT_SLOTS,
+              ContextLocalNameEntriesIndex(),
+              ContextLocalNameEntriesIndex() + ContextLocalCount(), this);
+  }
 
   PrintF("}\n");
 }