v8/src/heap-snapshot-generator-inl.h
yurys@chromium.org 269c46ee80 Simplify synthetic roots creation in heap snapshot
The synthetic roots exist in every snapshot and there are no actual objects corresponding to them (there was attempt to create some virtual objects to reuse existing snapshot builder but it just complicated the things).

Previously synthetic root wouldn't have been added if it was empty. Current implementation always adds all synthetic roots in the snapshot no matter if they are empty or not.

BUG=None
LOG=N
R=alph@chromium.org, mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/590833002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24124 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-09-22 14:40:59 +00:00

49 lines
1.1 KiB
C++

// Copyright 2013 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_HEAP_SNAPSHOT_GENERATOR_INL_H_
#define V8_HEAP_SNAPSHOT_GENERATOR_INL_H_
#include "src/heap-snapshot-generator.h"
namespace v8 {
namespace internal {
HeapEntry* HeapGraphEdge::from() const {
return &snapshot()->entries()[from_index_];
}
HeapSnapshot* HeapGraphEdge::snapshot() const {
return to_entry_->snapshot();
}
int HeapEntry::index() const {
return static_cast<int>(this - &snapshot_->entries().first());
}
int HeapEntry::set_children_index(int index) {
children_index_ = index;
int next_index = index + children_count_;
children_count_ = 0;
return next_index;
}
HeapGraphEdge** HeapEntry::children_arr() {
DCHECK(children_index_ >= 0);
SLOW_DCHECK(children_index_ < snapshot_->children().length() ||
(children_index_ == snapshot_->children().length() &&
children_count_ == 0));
return &snapshot_->children().first() + children_index_;
}
} } // namespace v8::internal
#endif // V8_HEAP_SNAPSHOT_GENERATOR_INL_H_