LCOV - code coverage report
Current view: top level - src - visitors.h (source / functions) Hit Total Coverage
Test: app.info Lines: 6 6 100.0 %
Date: 2017-04-26 Functions: 2 4 50.0 %

          Line data    Source code
       1             : // Copyright 2017 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_VISITORS_H_
       6             : #define V8_VISITORS_H_
       7             : 
       8             : #include "src/allocation.h"
       9             : 
      10             : namespace v8 {
      11             : namespace internal {
      12             : 
      13             : class Object;
      14             : 
      15             : #define ROOT_ID_LIST(V)                                                    \
      16             :   V(kStringTable, "string_table", "(Internalized strings)")                \
      17             :   V(kExternalStringsTable, "external_strings_table", "(External strings)") \
      18             :   V(kStrongRootList, "strong_root_list", "(Strong roots)")                 \
      19             :   V(kSmiRootList, "smi_root_list", "(Smi roots)")                          \
      20             :   V(kBootstrapper, "bootstrapper", "(Bootstrapper)")                       \
      21             :   V(kTop, "top", "(Isolate)")                                              \
      22             :   V(kRelocatable, "relocatable", "(Relocatable)")                          \
      23             :   V(kDebug, "debug", "(Debugger)")                                         \
      24             :   V(kCompilationCache, "compilationcache", "(Compilation cache)")          \
      25             :   V(kHandleScope, "handlescope", "(Handle scope)")                         \
      26             :   V(kDispatchTable, "dispatchtable", "(Dispatch table)")                   \
      27             :   V(kBuiltins, "builtins", "(Builtins)")                                   \
      28             :   V(kGlobalHandles, "globalhandles", "(Global handles)")                   \
      29             :   V(kEternalHandles, "eternalhandles", "(Eternal handles)")                \
      30             :   V(kThreadManager, "threadmanager", "(Thread manager)")                   \
      31             :   V(kStrongRoots, "strong roots", "(Strong roots)")                        \
      32             :   V(kExtensions, "Extensions", "(Extensions)")
      33             : 
      34             : class VisitorSynchronization : public AllStatic {
      35             :  public:
      36             : #define DECLARE_ENUM(enum_item, ignore1, ignore2) enum_item,
      37             :   enum SyncTag { ROOT_ID_LIST(DECLARE_ENUM) kNumberOfSyncTags };
      38             : #undef DECLARE_ENUM
      39             : 
      40             :   static const char* const kTags[kNumberOfSyncTags];
      41             :   static const char* const kTagNames[kNumberOfSyncTags];
      42             : };
      43             : 
      44             : enum class Root {
      45             : #define DECLARE_ENUM(enum_item, ignore1, ignore2) enum_item,
      46             :   ROOT_ID_LIST(DECLARE_ENUM)
      47             : #undef DECLARE_ENUM
      48             :   // TODO(ulan): Merge with the ROOT_ID_LIST.
      49             :   kCodeFlusher,
      50             :   kPartialSnapshotCache,
      51             :   kWeakCollections
      52             : };
      53             : 
      54             : // Abstract base class for visiting, and optionally modifying, the
      55             : // pointers contained in roots. Used in GC and serialization/deserialization.
      56      644409 : class RootVisitor BASE_EMBEDDED {
      57             :  public:
      58      452152 :   virtual ~RootVisitor() {}
      59             : 
      60             :   // Visits a contiguous arrays of pointers in the half-open range
      61             :   // [start, end). Any or all of the values may be modified on return.
      62             :   virtual void VisitRootPointers(Root root, Object** start, Object** end) = 0;
      63             : 
      64             :   // Handy shorthand for visiting a single pointer.
      65    85523394 :   virtual void VisitRootPointer(Root root, Object** p) {
      66    85523394 :     VisitRootPointers(root, p, p + 1);
      67    85523395 :   }
      68             : 
      69             :   // Intended for serialization/deserialization checking: insert, or
      70             :   // check for the presence of, a tag at this position in the stream.
      71             :   // Also used for marking up GC roots in heap snapshots.
      72             :   // TODO(ulan): Remove this.
      73     2276725 :   virtual void Synchronize(VisitorSynchronization::SyncTag tag) {}
      74             : };
      75             : 
      76             : }  // namespace internal
      77             : }  // namespace v8
      78             : 
      79             : #endif  // V8_VISITORS_H_

Generated by: LCOV version 1.10