Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: src/visitors.h

Issue 2801073006: Decouple root visitors from object visitors. (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/v8threads.cc ('k') | src/visitors.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 kPartialSnapshotCache,
50 kWeakCollections
51 };
52
53 // Abstract base class for visiting, and optionally modifying, the
54 // pointers contained in roots. Used in GC and serialization/deserialization.
55 class RootVisitor BASE_EMBEDDED {
56 public:
57 virtual ~RootVisitor() {}
58
59 // Visits a contiguous arrays of pointers in the half-open range
60 // [start, end). Any or all of the values may be modified on return.
61 virtual void VisitRootPointers(Root root, Object** start, Object** end) = 0;
62
63 // Handy shorthand for visiting a single pointer.
64 virtual void VisitRootPointer(Root root, Object** p) {
65 VisitRootPointers(root, p, p + 1);
66 }
67
68 // Intended for serialization/deserialization checking: insert, or
69 // check for the presence of, a tag at this position in the stream.
70 // Also used for marking up GC roots in heap snapshots.
71 // TODO(ulan): Remove this.
72 virtual void Synchronize(VisitorSynchronization::SyncTag tag) {}
73 };
74
75 } // namespace internal
76 } // namespace v8
77
78 #endif // V8_VISITORS_H_
OLDNEW
« no previous file with comments | « src/v8threads.cc ('k') | src/visitors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698