LCOV - code coverage report
Current view: top level - src/profiler - heap-snapshot-generator-inl.h (source / functions) Hit Total Coverage
Test: app.info Lines: 18 18 100.0 %
Date: 2019-01-20 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright 2013 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_PROFILER_HEAP_SNAPSHOT_GENERATOR_INL_H_
       6             : #define V8_PROFILER_HEAP_SNAPSHOT_GENERATOR_INL_H_
       7             : 
       8             : #include "src/profiler/heap-snapshot-generator.h"
       9             : 
      10             : #include "src/profiler/heap-profiler.h"
      11             : #include "src/string-hasher-inl.h"
      12             : 
      13             : namespace v8 {
      14             : namespace internal {
      15             : 
      16    21931082 : HeapEntry* HeapGraphEdge::from() const {
      17    21931082 :   return &snapshot()->entries()[from_index()];
      18             : }
      19             : 
      20     6007900 : Isolate* HeapGraphEdge::isolate() const { return to_entry_->isolate(); }
      21             : 
      22             : HeapSnapshot* HeapGraphEdge::snapshot() const {
      23    10965541 :   return to_entry_->snapshot();
      24             : }
      25             : 
      26             : int HeapEntry::set_children_index(int index) {
      27             :   // Note: children_count_ and children_end_index_ are parts of a union.
      28     3075705 :   int next_index = index + children_count_;
      29     3075705 :   children_end_index_ = index;
      30             :   return next_index;
      31             : }
      32             : 
      33             : void HeapEntry::add_child(HeapGraphEdge* edge) {
      34    10965201 :   snapshot_->children()[children_end_index_++] = edge;
      35             : }
      36             : 
      37    12829446 : HeapGraphEdge* HeapEntry::child(int i) { return children_begin()[i]; }
      38             : 
      39             : std::vector<HeapGraphEdge*>::iterator HeapEntry::children_begin() const {
      40     6778919 :   return index_ == 0 ? snapshot_->children().begin()
      41     6778919 :                      : snapshot_->entries()[index_ - 1].children_end();
      42             : }
      43             : 
      44             : std::vector<HeapGraphEdge*>::iterator HeapEntry::children_end() const {
      45             :   DCHECK_GE(children_end_index_, 0);
      46     7141798 :   return snapshot_->children().begin() + children_end_index_;
      47             : }
      48             : 
      49      363757 : int HeapEntry::children_count() const {
      50      727514 :   return static_cast<int>(children_end() - children_begin());
      51             : }
      52             : 
      53     6009015 : Isolate* HeapEntry::isolate() const { return snapshot_->profiler()->isolate(); }
      54             : 
      55             : uint32_t HeapSnapshotJSONSerializer::StringHash(const void* string) {
      56             :   const char* s = reinterpret_cast<const char*>(string);
      57      896061 :   int len = static_cast<int>(strlen(s));
      58             :   return StringHasher::HashSequentialString(s, len,
      59      896061 :                                             v8::internal::kZeroHashSeed);
      60             : }
      61             : 
      62             : int HeapSnapshotJSONSerializer::to_node_index(const HeapEntry* e) {
      63      962329 :   return to_node_index(e->index());
      64             : }
      65             : 
      66             : int HeapSnapshotJSONSerializer::to_node_index(int entry_index) {
      67      753633 :   return entry_index * kNodeFieldsCount;
      68             : }
      69             : 
      70             : }  // namespace internal
      71             : }  // namespace v8
      72             : 
      73             : #endif  // V8_PROFILER_HEAP_SNAPSHOT_GENERATOR_INL_H_

Generated by: LCOV version 1.10