Revision: 18378
Author:   [email protected]
Date:     Fri Dec 20 07:33:22 2013 UTC
Log:      Avoid SLOW_ASSERT when calling HeapGraphNode::GetChildrenCount

It may occur that GetChildrenCount is called on the node which has no children and stored last in the internal nodes array. In that case HeapEntry::children_arr() would fail when taking address of the element at index children_index_ which is past the last element in the children's array.

BUG=None
LOG=N
[email protected], [email protected]

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

Modified:
 /branches/bleeding_edge/src/heap-snapshot-generator-inl.h

=======================================
--- /branches/bleeding_edge/src/heap-snapshot-generator-inl.h Fri Nov 22 13:50:39 2013 UTC +++ /branches/bleeding_edge/src/heap-snapshot-generator-inl.h Fri Dec 20 07:33:22 2013 UTC
@@ -59,7 +59,10 @@

 HeapGraphEdge** HeapEntry::children_arr() {
   ASSERT(children_index_ >= 0);
-  return &snapshot_->children()[children_index_];
+  SLOW_ASSERT(children_index_ < snapshot_->children().length() ||
+      (children_index_ == snapshot_->children().length() &&
+       children_count_ == 0));
+  return &snapshot_->children().first() + children_index_;
 }


--
--
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