Reviewers: alph, loislo, ulan,

Message:
This change fixes test failure found in
https://codereview.chromium.org/117483002/

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

Please review this at https://codereview.chromium.org/112623005/

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

Affected files (+2, -1 lines):
  M src/heap-snapshot-generator-inl.h


Index: src/heap-snapshot-generator-inl.h
diff --git a/src/heap-snapshot-generator-inl.h b/src/heap-snapshot-generator-inl.h index 43002d2d2b170346dd124093783bd65c64682b5a..e16d309969d77299b80835a0efee3e75a483a11f 100644
--- a/src/heap-snapshot-generator-inl.h
+++ b/src/heap-snapshot-generator-inl.h
@@ -59,7 +59,8 @@ int HeapEntry::set_children_index(int index) {

 HeapGraphEdge** HeapEntry::children_arr() {
   ASSERT(children_index_ >= 0);
-  return &snapshot_->children()[children_index_];
+  SLOW_ASSERT(children_index_ <= snapshot_->children().length());
+  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