libv8-node 16.10.0.0-x86_64-darwin

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/ext/libv8-node/.location.yml +1 -0
  3. data/ext/libv8-node/location.rb +76 -0
  4. data/ext/libv8-node/paths.rb +34 -0
  5. data/lib/libv8/node/version.rb +7 -0
  6. data/lib/libv8/node.rb +11 -0
  7. data/lib/libv8-node.rb +1 -0
  8. data/vendor/v8/include/cppgc/allocation.h +232 -0
  9. data/vendor/v8/include/cppgc/common.h +29 -0
  10. data/vendor/v8/include/cppgc/cross-thread-persistent.h +384 -0
  11. data/vendor/v8/include/cppgc/custom-space.h +97 -0
  12. data/vendor/v8/include/cppgc/default-platform.h +75 -0
  13. data/vendor/v8/include/cppgc/ephemeron-pair.h +30 -0
  14. data/vendor/v8/include/cppgc/explicit-management.h +82 -0
  15. data/vendor/v8/include/cppgc/garbage-collected.h +117 -0
  16. data/vendor/v8/include/cppgc/heap-consistency.h +236 -0
  17. data/vendor/v8/include/cppgc/heap-state.h +70 -0
  18. data/vendor/v8/include/cppgc/heap-statistics.h +120 -0
  19. data/vendor/v8/include/cppgc/heap.h +201 -0
  20. data/vendor/v8/include/cppgc/internal/api-constants.h +47 -0
  21. data/vendor/v8/include/cppgc/internal/atomic-entry-flag.h +48 -0
  22. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +68 -0
  23. data/vendor/v8/include/cppgc/internal/compiler-specific.h +38 -0
  24. data/vendor/v8/include/cppgc/internal/finalizer-trait.h +90 -0
  25. data/vendor/v8/include/cppgc/internal/gc-info.h +76 -0
  26. data/vendor/v8/include/cppgc/internal/logging.h +50 -0
  27. data/vendor/v8/include/cppgc/internal/name-trait.h +111 -0
  28. data/vendor/v8/include/cppgc/internal/persistent-node.h +172 -0
  29. data/vendor/v8/include/cppgc/internal/pointer-policies.h +175 -0
  30. data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +30 -0
  31. data/vendor/v8/include/cppgc/internal/write-barrier.h +396 -0
  32. data/vendor/v8/include/cppgc/liveness-broker.h +74 -0
  33. data/vendor/v8/include/cppgc/macros.h +26 -0
  34. data/vendor/v8/include/cppgc/member.h +286 -0
  35. data/vendor/v8/include/cppgc/name-provider.h +65 -0
  36. data/vendor/v8/include/cppgc/object-size-trait.h +58 -0
  37. data/vendor/v8/include/cppgc/persistent.h +365 -0
  38. data/vendor/v8/include/cppgc/platform.h +153 -0
  39. data/vendor/v8/include/cppgc/prefinalizer.h +52 -0
  40. data/vendor/v8/include/cppgc/process-heap-statistics.h +36 -0
  41. data/vendor/v8/include/cppgc/sentinel-pointer.h +32 -0
  42. data/vendor/v8/include/cppgc/source-location.h +92 -0
  43. data/vendor/v8/include/cppgc/testing.h +99 -0
  44. data/vendor/v8/include/cppgc/trace-trait.h +116 -0
  45. data/vendor/v8/include/cppgc/type-traits.h +247 -0
  46. data/vendor/v8/include/cppgc/visitor.h +377 -0
  47. data/vendor/v8/include/libplatform/libplatform-export.h +29 -0
  48. data/vendor/v8/include/libplatform/libplatform.h +117 -0
  49. data/vendor/v8/include/libplatform/v8-tracing.h +334 -0
  50. data/vendor/v8/include/v8-cppgc.h +325 -0
  51. data/vendor/v8/include/v8-fast-api-calls.h +791 -0
  52. data/vendor/v8/include/v8-inspector-protocol.h +13 -0
  53. data/vendor/v8/include/v8-inspector.h +348 -0
  54. data/vendor/v8/include/v8-internal.h +499 -0
  55. data/vendor/v8/include/v8-metrics.h +202 -0
  56. data/vendor/v8/include/v8-platform.h +709 -0
  57. data/vendor/v8/include/v8-profiler.h +1123 -0
  58. data/vendor/v8/include/v8-unwinder-state.h +30 -0
  59. data/vendor/v8/include/v8-util.h +652 -0
  60. data/vendor/v8/include/v8-value-serializer-version.h +24 -0
  61. data/vendor/v8/include/v8-version-string.h +38 -0
  62. data/vendor/v8/include/v8-version.h +20 -0
  63. data/vendor/v8/include/v8-wasm-trap-handler-posix.h +31 -0
  64. data/vendor/v8/include/v8-wasm-trap-handler-win.h +28 -0
  65. data/vendor/v8/include/v8.h +12648 -0
  66. data/vendor/v8/include/v8config.h +515 -0
  67. data/vendor/v8/x86_64-darwin/libv8/obj/libv8_monolith.a +0 -0
  68. metadata +138 -0
@@ -0,0 +1,117 @@
1
+ // Copyright 2020 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 INCLUDE_CPPGC_GARBAGE_COLLECTED_H_
6
+ #define INCLUDE_CPPGC_GARBAGE_COLLECTED_H_
7
+
8
+ #include <type_traits>
9
+
10
+ #include "cppgc/internal/api-constants.h"
11
+ #include "cppgc/platform.h"
12
+ #include "cppgc/trace-trait.h"
13
+ #include "cppgc/type-traits.h"
14
+
15
+ namespace cppgc {
16
+
17
+ class Visitor;
18
+
19
+ namespace internal {
20
+
21
+ class GarbageCollectedBase {
22
+ public:
23
+ // Must use MakeGarbageCollected.
24
+ void* operator new(size_t) = delete;
25
+ void* operator new[](size_t) = delete;
26
+ // The garbage collector is taking care of reclaiming the object. Also,
27
+ // virtual destructor requires an unambiguous, accessible 'operator delete'.
28
+ void operator delete(void*) {
29
+ #ifdef V8_ENABLE_CHECKS
30
+ internal::Abort();
31
+ #endif // V8_ENABLE_CHECKS
32
+ }
33
+ void operator delete[](void*) = delete;
34
+
35
+ protected:
36
+ GarbageCollectedBase() = default;
37
+ };
38
+
39
+ } // namespace internal
40
+
41
+ /**
42
+ * Base class for managed objects. Only descendent types of `GarbageCollected`
43
+ * can be constructed using `MakeGarbageCollected()`. Must be inherited from as
44
+ * left-most base class.
45
+ *
46
+ * Types inheriting from GarbageCollected must provide a method of
47
+ * signature `void Trace(cppgc::Visitor*) const` that dispatchs all managed
48
+ * pointers to the visitor and delegates to garbage-collected base classes.
49
+ * The method must be virtual if the type is not directly a child of
50
+ * GarbageCollected and marked as final.
51
+ *
52
+ * \code
53
+ * // Example using final class.
54
+ * class FinalType final : public GarbageCollected<FinalType> {
55
+ * public:
56
+ * void Trace(cppgc::Visitor* visitor) const {
57
+ * // Dispatch using visitor->Trace(...);
58
+ * }
59
+ * };
60
+ *
61
+ * // Example using non-final base class.
62
+ * class NonFinalBase : public GarbageCollected<NonFinalBase> {
63
+ * public:
64
+ * virtual void Trace(cppgc::Visitor*) const {}
65
+ * };
66
+ *
67
+ * class FinalChild final : public NonFinalBase {
68
+ * public:
69
+ * void Trace(cppgc::Visitor* visitor) const final {
70
+ * // Dispatch using visitor->Trace(...);
71
+ * NonFinalBase::Trace(visitor);
72
+ * }
73
+ * };
74
+ * \endcode
75
+ */
76
+ template <typename T>
77
+ class GarbageCollected : public internal::GarbageCollectedBase {
78
+ public:
79
+ using IsGarbageCollectedTypeMarker = void;
80
+ using ParentMostGarbageCollectedType = T;
81
+
82
+ protected:
83
+ GarbageCollected() = default;
84
+ };
85
+
86
+ /**
87
+ * Base class for managed mixin objects. Such objects cannot be constructed
88
+ * directly but must be mixed into the inheritance hierarchy of a
89
+ * GarbageCollected object.
90
+ *
91
+ * Types inheriting from GarbageCollectedMixin must override a virtual method
92
+ * of signature `void Trace(cppgc::Visitor*) const` that dispatchs all managed
93
+ * pointers to the visitor and delegates to base classes.
94
+ *
95
+ * \code
96
+ * class Mixin : public GarbageCollectedMixin {
97
+ * public:
98
+ * void Trace(cppgc::Visitor* visitor) const override {
99
+ * // Dispatch using visitor->Trace(...);
100
+ * }
101
+ * };
102
+ * \endcode
103
+ */
104
+ class GarbageCollectedMixin : public internal::GarbageCollectedBase {
105
+ public:
106
+ using IsGarbageCollectedMixinTypeMarker = void;
107
+
108
+ /**
109
+ * This Trace method must be overriden by objects inheriting from
110
+ * GarbageCollectedMixin.
111
+ */
112
+ virtual void Trace(cppgc::Visitor*) const {}
113
+ };
114
+
115
+ } // namespace cppgc
116
+
117
+ #endif // INCLUDE_CPPGC_GARBAGE_COLLECTED_H_
@@ -0,0 +1,236 @@
1
+ // Copyright 2020 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 INCLUDE_CPPGC_HEAP_CONSISTENCY_H_
6
+ #define INCLUDE_CPPGC_HEAP_CONSISTENCY_H_
7
+
8
+ #include <cstddef>
9
+
10
+ #include "cppgc/internal/write-barrier.h"
11
+ #include "cppgc/macros.h"
12
+ #include "cppgc/trace-trait.h"
13
+ #include "v8config.h" // NOLINT(build/include_directory)
14
+
15
+ namespace cppgc {
16
+
17
+ class HeapHandle;
18
+
19
+ namespace subtle {
20
+
21
+ /**
22
+ * **DO NOT USE: Use the appropriate managed types.**
23
+ *
24
+ * Consistency helpers that aid in maintaining a consistent internal state of
25
+ * the garbage collector.
26
+ */
27
+ class HeapConsistency final {
28
+ public:
29
+ using WriteBarrierParams = internal::WriteBarrier::Params;
30
+ using WriteBarrierType = internal::WriteBarrier::Type;
31
+
32
+ /**
33
+ * Gets the required write barrier type for a specific write.
34
+ *
35
+ * \param slot Slot containing the pointer to the object. The slot itself
36
+ * must reside in an object that has been allocated using
37
+ * `MakeGarbageCollected()`.
38
+ * \param value The pointer to the object. May be an interior pointer to an
39
+ * interface of the actual object.
40
+ * \param params Parameters that may be used for actual write barrier calls.
41
+ * Only filled if return value indicates that a write barrier is needed. The
42
+ * contents of the `params` are an implementation detail.
43
+ * \returns whether a write barrier is needed and which barrier to invoke.
44
+ */
45
+ static V8_INLINE WriteBarrierType GetWriteBarrierType(
46
+ const void* slot, const void* value, WriteBarrierParams& params) {
47
+ return internal::WriteBarrier::GetWriteBarrierType(slot, value, params);
48
+ }
49
+
50
+ /**
51
+ * Gets the required write barrier type for a specific write.
52
+ *
53
+ * \param slot Slot to some part of an object. The object must not necessarily
54
+ have been allocated using `MakeGarbageCollected()` but can also live
55
+ off-heap or on stack.
56
+ * \param params Parameters that may be used for actual write barrier calls.
57
+ * Only filled if return value indicates that a write barrier is needed. The
58
+ * contents of the `params` are an implementation detail.
59
+ * \param callback Callback returning the corresponding heap handle. The
60
+ * callback is only invoked if the heap cannot otherwise be figured out. The
61
+ * callback must not allocate.
62
+ * \returns whether a write barrier is needed and which barrier to invoke.
63
+ */
64
+ template <typename HeapHandleCallback>
65
+ static V8_INLINE WriteBarrierType
66
+ GetWriteBarrierType(const void* slot, WriteBarrierParams& params,
67
+ HeapHandleCallback callback) {
68
+ return internal::WriteBarrier::GetWriteBarrierType(slot, params, callback);
69
+ }
70
+
71
+ /**
72
+ * Conservative Dijkstra-style write barrier that processes an object if it
73
+ * has not yet been processed.
74
+ *
75
+ * \param params The parameters retrieved from `GetWriteBarrierType()`.
76
+ * \param object The pointer to the object. May be an interior pointer to a
77
+ * an interface of the actual object.
78
+ */
79
+ static V8_INLINE void DijkstraWriteBarrier(const WriteBarrierParams& params,
80
+ const void* object) {
81
+ internal::WriteBarrier::DijkstraMarkingBarrier(params, object);
82
+ }
83
+
84
+ /**
85
+ * Conservative Dijkstra-style write barrier that processes a range of
86
+ * elements if they have not yet been processed.
87
+ *
88
+ * \param params The parameters retrieved from `GetWriteBarrierType()`.
89
+ * \param first_element Pointer to the first element that should be processed.
90
+ * The slot itself must reside in an object that has been allocated using
91
+ * `MakeGarbageCollected()`.
92
+ * \param element_size Size of the element in bytes.
93
+ * \param number_of_elements Number of elements that should be processed,
94
+ * starting with `first_element`.
95
+ * \param trace_callback The trace callback that should be invoked for each
96
+ * element if necessary.
97
+ */
98
+ static V8_INLINE void DijkstraWriteBarrierRange(
99
+ const WriteBarrierParams& params, const void* first_element,
100
+ size_t element_size, size_t number_of_elements,
101
+ TraceCallback trace_callback) {
102
+ internal::WriteBarrier::DijkstraMarkingBarrierRange(
103
+ params, first_element, element_size, number_of_elements,
104
+ trace_callback);
105
+ }
106
+
107
+ /**
108
+ * Steele-style write barrier that re-processes an object if it has already
109
+ * been processed.
110
+ *
111
+ * \param params The parameters retrieved from `GetWriteBarrierType()`.
112
+ * \param object The pointer to the object which must point to an object that
113
+ * has been allocated using `MakeGarbageCollected()`. Interior pointers are
114
+ * not supported.
115
+ */
116
+ static V8_INLINE void SteeleWriteBarrier(const WriteBarrierParams& params,
117
+ const void* object) {
118
+ internal::WriteBarrier::SteeleMarkingBarrier(params, object);
119
+ }
120
+
121
+ /**
122
+ * Generational barrier for maintaining consistency when running with multiple
123
+ * generations.
124
+ *
125
+ * \param params The parameters retrieved from `GetWriteBarrierType()`.
126
+ * \param slot Slot containing the pointer to the object. The slot itself
127
+ * must reside in an object that has been allocated using
128
+ * `MakeGarbageCollected()`.
129
+ */
130
+ static V8_INLINE void GenerationalBarrier(const WriteBarrierParams& params,
131
+ const void* slot) {
132
+ internal::WriteBarrier::GenerationalBarrier(params, slot);
133
+ }
134
+
135
+ private:
136
+ HeapConsistency() = delete;
137
+ };
138
+
139
+ /**
140
+ * Disallows garbage collection finalizations. Any garbage collection triggers
141
+ * result in a crash when in this scope.
142
+ *
143
+ * Note that the garbage collector already covers paths that can lead to garbage
144
+ * collections, so user code does not require checking
145
+ * `IsGarbageCollectionAllowed()` before allocations.
146
+ */
147
+ class V8_EXPORT V8_NODISCARD DisallowGarbageCollectionScope final {
148
+ CPPGC_STACK_ALLOCATED();
149
+
150
+ public:
151
+ /**
152
+ * \returns whether garbage collections are currently allowed.
153
+ */
154
+ static bool IsGarbageCollectionAllowed(HeapHandle& heap_handle);
155
+
156
+ /**
157
+ * Enters a disallow garbage collection scope. Must be paired with `Leave()`.
158
+ * Prefer a scope instance of `DisallowGarbageCollectionScope`.
159
+ *
160
+ * \param heap_handle The corresponding heap.
161
+ */
162
+ static void Enter(HeapHandle& heap_handle);
163
+
164
+ /**
165
+ * Leaves a disallow garbage collection scope. Must be paired with `Enter()`.
166
+ * Prefer a scope instance of `DisallowGarbageCollectionScope`.
167
+ *
168
+ * \param heap_handle The corresponding heap.
169
+ */
170
+ static void Leave(HeapHandle& heap_handle);
171
+
172
+ /**
173
+ * Constructs a scoped object that automatically enters and leaves a disallow
174
+ * garbage collection scope based on its lifetime.
175
+ *
176
+ * \param heap_handle The corresponding heap.
177
+ */
178
+ explicit DisallowGarbageCollectionScope(HeapHandle& heap_handle);
179
+ ~DisallowGarbageCollectionScope();
180
+
181
+ DisallowGarbageCollectionScope(const DisallowGarbageCollectionScope&) =
182
+ delete;
183
+ DisallowGarbageCollectionScope& operator=(
184
+ const DisallowGarbageCollectionScope&) = delete;
185
+
186
+ private:
187
+ HeapHandle& heap_handle_;
188
+ };
189
+
190
+ /**
191
+ * Avoids invoking garbage collection finalizations. Already running garbage
192
+ * collection phase are unaffected by this scope.
193
+ *
194
+ * Should only be used temporarily as the scope has an impact on memory usage
195
+ * and follow up garbage collections.
196
+ */
197
+ class V8_EXPORT V8_NODISCARD NoGarbageCollectionScope final {
198
+ CPPGC_STACK_ALLOCATED();
199
+
200
+ public:
201
+ /**
202
+ * Enters a no garbage collection scope. Must be paired with `Leave()`. Prefer
203
+ * a scope instance of `NoGarbageCollectionScope`.
204
+ *
205
+ * \param heap_handle The corresponding heap.
206
+ */
207
+ static void Enter(HeapHandle& heap_handle);
208
+
209
+ /**
210
+ * Leaves a no garbage collection scope. Must be paired with `Enter()`. Prefer
211
+ * a scope instance of `NoGarbageCollectionScope`.
212
+ *
213
+ * \param heap_handle The corresponding heap.
214
+ */
215
+ static void Leave(HeapHandle& heap_handle);
216
+
217
+ /**
218
+ * Constructs a scoped object that automatically enters and leaves a no
219
+ * garbage collection scope based on its lifetime.
220
+ *
221
+ * \param heap_handle The corresponding heap.
222
+ */
223
+ explicit NoGarbageCollectionScope(HeapHandle& heap_handle);
224
+ ~NoGarbageCollectionScope();
225
+
226
+ NoGarbageCollectionScope(const NoGarbageCollectionScope&) = delete;
227
+ NoGarbageCollectionScope& operator=(const NoGarbageCollectionScope&) = delete;
228
+
229
+ private:
230
+ HeapHandle& heap_handle_;
231
+ };
232
+
233
+ } // namespace subtle
234
+ } // namespace cppgc
235
+
236
+ #endif // INCLUDE_CPPGC_HEAP_CONSISTENCY_H_
@@ -0,0 +1,70 @@
1
+ // Copyright 2021 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 INCLUDE_CPPGC_HEAP_STATE_H_
6
+ #define INCLUDE_CPPGC_HEAP_STATE_H_
7
+
8
+ #include "v8config.h" // NOLINT(build/include_directory)
9
+
10
+ namespace cppgc {
11
+
12
+ class HeapHandle;
13
+
14
+ namespace subtle {
15
+
16
+ /**
17
+ * Helpers to peek into heap-internal state.
18
+ */
19
+ class V8_EXPORT HeapState final {
20
+ public:
21
+ /**
22
+ * Returns whether the garbage collector is marking. This API is experimental
23
+ * and is expected to be removed in future.
24
+ *
25
+ * \param heap_handle The corresponding heap.
26
+ * \returns true if the garbage collector is currently marking, and false
27
+ * otherwise.
28
+ */
29
+ static bool IsMarking(const HeapHandle& heap_handle);
30
+
31
+ /*
32
+ * Returns whether the garbage collector is sweeping. This API is experimental
33
+ * and is expected to be removed in future.
34
+ *
35
+ * \param heap_handle The corresponding heap.
36
+ * \returns true if the garbage collector is currently sweeping, and false
37
+ * otherwise.
38
+ */
39
+ static bool IsSweeping(const HeapHandle& heap_handle);
40
+
41
+ /**
42
+ * Returns whether the garbage collector is in the atomic pause, i.e., the
43
+ * mutator is stopped from running. This API is experimental and is expected
44
+ * to be removed in future.
45
+ *
46
+ * \param heap_handle The corresponding heap.
47
+ * \returns true if the garbage collector is currently in the atomic pause,
48
+ * and false otherwise.
49
+ */
50
+ static bool IsInAtomicPause(const HeapHandle& heap_handle);
51
+
52
+ /**
53
+ * Returns whether the last garbage collection was finalized conservatively
54
+ * (i.e., with a non-empty stack). This API is experimental and is expected to
55
+ * be removed in future.
56
+ *
57
+ * \param heap_handle The corresponding heap.
58
+ * \returns true if the last garbage collection was finalized conservatively,
59
+ * and false otherwise.
60
+ */
61
+ static bool PreviousGCWasConservative(const HeapHandle& heap_handle);
62
+
63
+ private:
64
+ HeapState() = delete;
65
+ };
66
+
67
+ } // namespace subtle
68
+ } // namespace cppgc
69
+
70
+ #endif // INCLUDE_CPPGC_HEAP_STATE_H_
@@ -0,0 +1,120 @@
1
+ // Copyright 2021 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 INCLUDE_CPPGC_HEAP_STATISTICS_H_
6
+ #define INCLUDE_CPPGC_HEAP_STATISTICS_H_
7
+
8
+ #include <cstddef>
9
+ #include <cstdint>
10
+ #include <string>
11
+ #include <vector>
12
+
13
+ namespace cppgc {
14
+
15
+ /**
16
+ * `HeapStatistics` contains memory consumption and utilization statistics for a
17
+ * cppgc heap.
18
+ */
19
+ struct HeapStatistics final {
20
+ /**
21
+ * Specifies the detail level of the heap statistics. Brief statistics contain
22
+ * only the top-level allocated and used memory statistics for the entire
23
+ * heap. Detailed statistics also contain a break down per space and page, as
24
+ * well as freelist statistics and object type histograms. Note that used
25
+ * memory reported by brief statistics and detailed statistics might differ
26
+ * slightly.
27
+ */
28
+ enum DetailLevel : uint8_t {
29
+ kBrief,
30
+ kDetailed,
31
+ };
32
+
33
+ /**
34
+ * Object statistics for a single type.
35
+ */
36
+ struct ObjectStatsEntry {
37
+ /**
38
+ * Number of allocated bytes.
39
+ */
40
+ size_t allocated_bytes;
41
+ /**
42
+ * Number of allocated objects.
43
+ */
44
+ size_t object_count;
45
+ };
46
+
47
+ /**
48
+ * Page granularity statistics. For each page the statistics record the
49
+ * allocated memory size and overall used memory size for the page.
50
+ */
51
+ struct PageStatistics {
52
+ /** Overall committed amount of memory for the page. */
53
+ size_t committed_size_bytes = 0;
54
+ /** Resident amount of memory held by the page. */
55
+ size_t resident_size_bytes = 0;
56
+ /** Amount of memory actually used on the page. */
57
+ size_t used_size_bytes = 0;
58
+ /** Statistics for object allocated on the page. Filled only when
59
+ * NameProvider::HideInternalNames() is false. */
60
+ std::vector<ObjectStatsEntry> object_statistics;
61
+ };
62
+
63
+ /**
64
+ * Statistics of the freelist (used only in non-large object spaces). For
65
+ * each bucket in the freelist the statistics record the bucket size, the
66
+ * number of freelist entries in the bucket, and the overall allocated memory
67
+ * consumed by these freelist entries.
68
+ */
69
+ struct FreeListStatistics {
70
+ /** bucket sizes in the freelist. */
71
+ std::vector<size_t> bucket_size;
72
+ /** number of freelist entries per bucket. */
73
+ std::vector<size_t> free_count;
74
+ /** memory size consumed by freelist entries per size. */
75
+ std::vector<size_t> free_size;
76
+ };
77
+
78
+ /**
79
+ * Space granularity statistics. For each space the statistics record the
80
+ * space name, the amount of allocated memory and overall used memory for the
81
+ * space. The statistics also contain statistics for each of the space's
82
+ * pages, its freelist and the objects allocated on the space.
83
+ */
84
+ struct SpaceStatistics {
85
+ /** The space name */
86
+ std::string name;
87
+ /** Overall committed amount of memory for the heap. */
88
+ size_t committed_size_bytes = 0;
89
+ /** Resident amount of memory held by the heap. */
90
+ size_t resident_size_bytes = 0;
91
+ /** Amount of memory actually used on the space. */
92
+ size_t used_size_bytes = 0;
93
+ /** Statistics for each of the pages in the space. */
94
+ std::vector<PageStatistics> page_stats;
95
+ /** Statistics for the freelist of the space. */
96
+ FreeListStatistics free_list_stats;
97
+ };
98
+
99
+ /** Overall committed amount of memory for the heap. */
100
+ size_t committed_size_bytes = 0;
101
+ /** Resident amount of memory help by the heap. */
102
+ size_t resident_size_bytes = 0;
103
+ /** Amount of memory actually used on the heap. */
104
+ size_t used_size_bytes = 0;
105
+ /** Detail level of this HeapStatistics. */
106
+ DetailLevel detail_level;
107
+
108
+ /** Statistics for each of the spaces in the heap. Filled only when
109
+ * `detail_level` is `DetailLevel::kDetailed`. */
110
+ std::vector<SpaceStatistics> space_stats;
111
+
112
+ /**
113
+ * Vector of `cppgc::GarbageCollected` type names.
114
+ */
115
+ std::vector<std::string> type_names;
116
+ };
117
+
118
+ } // namespace cppgc
119
+
120
+ #endif // INCLUDE_CPPGC_HEAP_STATISTICS_H_