libv8-node 16.10.0.0-arm64-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.
- checksums.yaml +7 -0
- data/ext/libv8-node/.location.yml +1 -0
- data/ext/libv8-node/location.rb +76 -0
- data/ext/libv8-node/paths.rb +34 -0
- data/lib/libv8/node/version.rb +7 -0
- data/lib/libv8/node.rb +11 -0
- data/lib/libv8-node.rb +1 -0
- data/vendor/v8/arm64-darwin/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/allocation.h +232 -0
- data/vendor/v8/include/cppgc/common.h +29 -0
- data/vendor/v8/include/cppgc/cross-thread-persistent.h +384 -0
- data/vendor/v8/include/cppgc/custom-space.h +97 -0
- data/vendor/v8/include/cppgc/default-platform.h +75 -0
- data/vendor/v8/include/cppgc/ephemeron-pair.h +30 -0
- data/vendor/v8/include/cppgc/explicit-management.h +82 -0
- data/vendor/v8/include/cppgc/garbage-collected.h +117 -0
- data/vendor/v8/include/cppgc/heap-consistency.h +236 -0
- data/vendor/v8/include/cppgc/heap-state.h +70 -0
- data/vendor/v8/include/cppgc/heap-statistics.h +120 -0
- data/vendor/v8/include/cppgc/heap.h +201 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +47 -0
- data/vendor/v8/include/cppgc/internal/atomic-entry-flag.h +48 -0
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +68 -0
- data/vendor/v8/include/cppgc/internal/compiler-specific.h +38 -0
- data/vendor/v8/include/cppgc/internal/finalizer-trait.h +90 -0
- data/vendor/v8/include/cppgc/internal/gc-info.h +76 -0
- data/vendor/v8/include/cppgc/internal/logging.h +50 -0
- data/vendor/v8/include/cppgc/internal/name-trait.h +111 -0
- data/vendor/v8/include/cppgc/internal/persistent-node.h +172 -0
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +175 -0
- data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +30 -0
- data/vendor/v8/include/cppgc/internal/write-barrier.h +396 -0
- data/vendor/v8/include/cppgc/liveness-broker.h +74 -0
- data/vendor/v8/include/cppgc/macros.h +26 -0
- data/vendor/v8/include/cppgc/member.h +286 -0
- data/vendor/v8/include/cppgc/name-provider.h +65 -0
- data/vendor/v8/include/cppgc/object-size-trait.h +58 -0
- data/vendor/v8/include/cppgc/persistent.h +365 -0
- data/vendor/v8/include/cppgc/platform.h +153 -0
- data/vendor/v8/include/cppgc/prefinalizer.h +52 -0
- data/vendor/v8/include/cppgc/process-heap-statistics.h +36 -0
- data/vendor/v8/include/cppgc/sentinel-pointer.h +32 -0
- data/vendor/v8/include/cppgc/source-location.h +92 -0
- data/vendor/v8/include/cppgc/testing.h +99 -0
- data/vendor/v8/include/cppgc/trace-trait.h +116 -0
- data/vendor/v8/include/cppgc/type-traits.h +247 -0
- data/vendor/v8/include/cppgc/visitor.h +377 -0
- data/vendor/v8/include/libplatform/libplatform-export.h +29 -0
- data/vendor/v8/include/libplatform/libplatform.h +117 -0
- data/vendor/v8/include/libplatform/v8-tracing.h +334 -0
- data/vendor/v8/include/v8-cppgc.h +325 -0
- data/vendor/v8/include/v8-fast-api-calls.h +791 -0
- data/vendor/v8/include/v8-inspector-protocol.h +13 -0
- data/vendor/v8/include/v8-inspector.h +348 -0
- data/vendor/v8/include/v8-internal.h +499 -0
- data/vendor/v8/include/v8-metrics.h +202 -0
- data/vendor/v8/include/v8-platform.h +709 -0
- data/vendor/v8/include/v8-profiler.h +1123 -0
- data/vendor/v8/include/v8-unwinder-state.h +30 -0
- data/vendor/v8/include/v8-util.h +652 -0
- data/vendor/v8/include/v8-value-serializer-version.h +24 -0
- data/vendor/v8/include/v8-version-string.h +38 -0
- data/vendor/v8/include/v8-version.h +20 -0
- data/vendor/v8/include/v8-wasm-trap-handler-posix.h +31 -0
- data/vendor/v8/include/v8-wasm-trap-handler-win.h +28 -0
- data/vendor/v8/include/v8.h +12648 -0
- data/vendor/v8/include/v8config.h +515 -0
- metadata +138 -0
@@ -0,0 +1,92 @@
|
|
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_SOURCE_LOCATION_H_
|
6
|
+
#define INCLUDE_CPPGC_SOURCE_LOCATION_H_
|
7
|
+
|
8
|
+
#include <cstddef>
|
9
|
+
#include <string>
|
10
|
+
|
11
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
12
|
+
|
13
|
+
#if defined(__has_builtin)
|
14
|
+
#define CPPGC_SUPPORTS_SOURCE_LOCATION \
|
15
|
+
(__has_builtin(__builtin_FUNCTION) && __has_builtin(__builtin_FILE) && \
|
16
|
+
__has_builtin(__builtin_LINE)) // NOLINT
|
17
|
+
#elif defined(V8_CC_GNU) && __GNUC__ >= 7
|
18
|
+
#define CPPGC_SUPPORTS_SOURCE_LOCATION 1
|
19
|
+
#elif defined(V8_CC_INTEL) && __ICC >= 1800
|
20
|
+
#define CPPGC_SUPPORTS_SOURCE_LOCATION 1
|
21
|
+
#else
|
22
|
+
#define CPPGC_SUPPORTS_SOURCE_LOCATION 0
|
23
|
+
#endif
|
24
|
+
|
25
|
+
namespace cppgc {
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Encapsulates source location information. Mimics C++20's
|
29
|
+
* `std::source_location`.
|
30
|
+
*/
|
31
|
+
class V8_EXPORT SourceLocation final {
|
32
|
+
public:
|
33
|
+
/**
|
34
|
+
* Construct source location information corresponding to the location of the
|
35
|
+
* call site.
|
36
|
+
*/
|
37
|
+
#if CPPGC_SUPPORTS_SOURCE_LOCATION
|
38
|
+
static constexpr SourceLocation Current(
|
39
|
+
const char* function = __builtin_FUNCTION(),
|
40
|
+
const char* file = __builtin_FILE(), size_t line = __builtin_LINE()) {
|
41
|
+
return SourceLocation(function, file, line);
|
42
|
+
}
|
43
|
+
#else
|
44
|
+
static constexpr SourceLocation Current() { return SourceLocation(); }
|
45
|
+
#endif // CPPGC_SUPPORTS_SOURCE_LOCATION
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Constructs unspecified source location information.
|
49
|
+
*/
|
50
|
+
constexpr SourceLocation() = default;
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Returns the name of the function associated with the position represented
|
54
|
+
* by this object, if any.
|
55
|
+
*
|
56
|
+
* \returns the function name as cstring.
|
57
|
+
*/
|
58
|
+
constexpr const char* Function() const { return function_; }
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Returns the name of the current source file represented by this object.
|
62
|
+
*
|
63
|
+
* \returns the file name as cstring.
|
64
|
+
*/
|
65
|
+
constexpr const char* FileName() const { return file_; }
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Returns the line number represented by this object.
|
69
|
+
*
|
70
|
+
* \returns the line number.
|
71
|
+
*/
|
72
|
+
constexpr size_t Line() const { return line_; }
|
73
|
+
|
74
|
+
/**
|
75
|
+
* Returns a human-readable string representing this object.
|
76
|
+
*
|
77
|
+
* \returns a human-readable string representing source location information.
|
78
|
+
*/
|
79
|
+
std::string ToString() const;
|
80
|
+
|
81
|
+
private:
|
82
|
+
constexpr SourceLocation(const char* function, const char* file, size_t line)
|
83
|
+
: function_(function), file_(file), line_(line) {}
|
84
|
+
|
85
|
+
const char* function_ = nullptr;
|
86
|
+
const char* file_ = nullptr;
|
87
|
+
size_t line_ = 0u;
|
88
|
+
};
|
89
|
+
|
90
|
+
} // namespace cppgc
|
91
|
+
|
92
|
+
#endif // INCLUDE_CPPGC_SOURCE_LOCATION_H_
|
@@ -0,0 +1,99 @@
|
|
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_TESTING_H_
|
6
|
+
#define INCLUDE_CPPGC_TESTING_H_
|
7
|
+
|
8
|
+
#include "cppgc/common.h"
|
9
|
+
#include "cppgc/macros.h"
|
10
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
11
|
+
|
12
|
+
namespace cppgc {
|
13
|
+
|
14
|
+
class HeapHandle;
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Namespace contains testing helpers.
|
18
|
+
*/
|
19
|
+
namespace testing {
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Overrides the state of the stack with the provided value. Takes precedence
|
23
|
+
* over other parameters that set the stack state. Must no be nested.
|
24
|
+
*/
|
25
|
+
class V8_EXPORT V8_NODISCARD OverrideEmbedderStackStateScope final {
|
26
|
+
CPPGC_STACK_ALLOCATED();
|
27
|
+
|
28
|
+
public:
|
29
|
+
/**
|
30
|
+
* Constructs a scoped object that automatically enters and leaves the scope.
|
31
|
+
*
|
32
|
+
* \param heap_handle The corresponding heap.
|
33
|
+
*/
|
34
|
+
explicit OverrideEmbedderStackStateScope(HeapHandle& heap_handle,
|
35
|
+
EmbedderStackState state);
|
36
|
+
~OverrideEmbedderStackStateScope();
|
37
|
+
|
38
|
+
OverrideEmbedderStackStateScope(const OverrideEmbedderStackStateScope&) =
|
39
|
+
delete;
|
40
|
+
OverrideEmbedderStackStateScope& operator=(
|
41
|
+
const OverrideEmbedderStackStateScope&) = delete;
|
42
|
+
|
43
|
+
private:
|
44
|
+
HeapHandle& heap_handle_;
|
45
|
+
};
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Testing interface for managed heaps that allows for controlling garbage
|
49
|
+
* collection timings. Embedders should use this class when testing the
|
50
|
+
* interaction of their code with incremental/concurrent garbage collection.
|
51
|
+
*/
|
52
|
+
class V8_EXPORT StandaloneTestingHeap final {
|
53
|
+
public:
|
54
|
+
explicit StandaloneTestingHeap(HeapHandle&);
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Start an incremental garbage collection.
|
58
|
+
*/
|
59
|
+
void StartGarbageCollection();
|
60
|
+
|
61
|
+
/**
|
62
|
+
* Perform an incremental step. This will also schedule concurrent steps if
|
63
|
+
* needed.
|
64
|
+
*
|
65
|
+
* \param stack_state The state of the stack during the step.
|
66
|
+
*/
|
67
|
+
bool PerformMarkingStep(EmbedderStackState stack_state);
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Finalize the current garbage collection cycle atomically.
|
71
|
+
* Assumes that garbage collection is in progress.
|
72
|
+
*
|
73
|
+
* \param stack_state The state of the stack for finalizing the garbage
|
74
|
+
* collection cycle.
|
75
|
+
*/
|
76
|
+
void FinalizeGarbageCollection(EmbedderStackState stack_state);
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Toggle main thread marking on/off. Allows to stress concurrent marking
|
80
|
+
* (e.g. to better detect data races).
|
81
|
+
*
|
82
|
+
* \param should_mark Denotes whether the main thread should contribute to
|
83
|
+
* marking. Defaults to true.
|
84
|
+
*/
|
85
|
+
void ToggleMainThreadMarking(bool should_mark);
|
86
|
+
|
87
|
+
/**
|
88
|
+
* Force enable compaction for the next garbage collection cycle.
|
89
|
+
*/
|
90
|
+
void ForceCompactionForNextGarbageCollection();
|
91
|
+
|
92
|
+
private:
|
93
|
+
HeapHandle& heap_handle_;
|
94
|
+
};
|
95
|
+
|
96
|
+
} // namespace testing
|
97
|
+
} // namespace cppgc
|
98
|
+
|
99
|
+
#endif // INCLUDE_CPPGC_TESTING_H_
|
@@ -0,0 +1,116 @@
|
|
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_TRACE_TRAIT_H_
|
6
|
+
#define INCLUDE_CPPGC_TRACE_TRAIT_H_
|
7
|
+
|
8
|
+
#include <type_traits>
|
9
|
+
|
10
|
+
#include "cppgc/type-traits.h"
|
11
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
12
|
+
|
13
|
+
namespace cppgc {
|
14
|
+
|
15
|
+
class Visitor;
|
16
|
+
|
17
|
+
namespace internal {
|
18
|
+
|
19
|
+
// Implementation of the default TraceTrait handling GarbageCollected and
|
20
|
+
// GarbageCollectedMixin.
|
21
|
+
template <typename T,
|
22
|
+
bool =
|
23
|
+
IsGarbageCollectedMixinTypeV<typename std::remove_const<T>::type>>
|
24
|
+
struct TraceTraitImpl;
|
25
|
+
|
26
|
+
} // namespace internal
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Callback for invoking tracing on a given object.
|
30
|
+
*
|
31
|
+
* \param visitor The visitor to dispatch to.
|
32
|
+
* \param object The object to invoke tracing on.
|
33
|
+
*/
|
34
|
+
using TraceCallback = void (*)(Visitor* visitor, const void* object);
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Describes how to trace an object, i.e., how to visit all Oilpan-relevant
|
38
|
+
* fields of an object.
|
39
|
+
*/
|
40
|
+
struct TraceDescriptor {
|
41
|
+
/**
|
42
|
+
* Adjusted base pointer, i.e., the pointer to the class inheriting directly
|
43
|
+
* from GarbageCollected, of the object that is being traced.
|
44
|
+
*/
|
45
|
+
const void* base_object_payload;
|
46
|
+
/**
|
47
|
+
* Callback for tracing the object.
|
48
|
+
*/
|
49
|
+
TraceCallback callback;
|
50
|
+
};
|
51
|
+
|
52
|
+
namespace internal {
|
53
|
+
|
54
|
+
struct V8_EXPORT TraceTraitFromInnerAddressImpl {
|
55
|
+
static TraceDescriptor GetTraceDescriptor(const void* address);
|
56
|
+
};
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Trait specifying how the garbage collector processes an object of type T.
|
60
|
+
*
|
61
|
+
* Advanced users may override handling by creating a specialization for their
|
62
|
+
* type.
|
63
|
+
*/
|
64
|
+
template <typename T>
|
65
|
+
struct TraceTraitBase {
|
66
|
+
static_assert(internal::IsTraceableV<T>, "T must have a Trace() method");
|
67
|
+
|
68
|
+
/**
|
69
|
+
* Accessor for retrieving a TraceDescriptor to process an object of type T.
|
70
|
+
*
|
71
|
+
* \param self The object to be processed.
|
72
|
+
* \returns a TraceDescriptor to process the object.
|
73
|
+
*/
|
74
|
+
static TraceDescriptor GetTraceDescriptor(const void* self) {
|
75
|
+
return internal::TraceTraitImpl<T>::GetTraceDescriptor(
|
76
|
+
static_cast<const T*>(self));
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Function invoking the tracing for an object of type T.
|
81
|
+
*
|
82
|
+
* \param visitor The visitor to dispatch to.
|
83
|
+
* \param self The object to invoke tracing on.
|
84
|
+
*/
|
85
|
+
static void Trace(Visitor* visitor, const void* self) {
|
86
|
+
static_cast<const T*>(self)->Trace(visitor);
|
87
|
+
}
|
88
|
+
};
|
89
|
+
|
90
|
+
} // namespace internal
|
91
|
+
|
92
|
+
template <typename T>
|
93
|
+
struct TraceTrait : public internal::TraceTraitBase<T> {};
|
94
|
+
|
95
|
+
namespace internal {
|
96
|
+
|
97
|
+
template <typename T>
|
98
|
+
struct TraceTraitImpl<T, false> {
|
99
|
+
static_assert(IsGarbageCollectedTypeV<T>,
|
100
|
+
"T must be of type GarbageCollected or GarbageCollectedMixin");
|
101
|
+
static TraceDescriptor GetTraceDescriptor(const void* self) {
|
102
|
+
return {self, TraceTrait<T>::Trace};
|
103
|
+
}
|
104
|
+
};
|
105
|
+
|
106
|
+
template <typename T>
|
107
|
+
struct TraceTraitImpl<T, true> {
|
108
|
+
static TraceDescriptor GetTraceDescriptor(const void* self) {
|
109
|
+
return internal::TraceTraitFromInnerAddressImpl::GetTraceDescriptor(self);
|
110
|
+
}
|
111
|
+
};
|
112
|
+
|
113
|
+
} // namespace internal
|
114
|
+
} // namespace cppgc
|
115
|
+
|
116
|
+
#endif // INCLUDE_CPPGC_TRACE_TRAIT_H_
|
@@ -0,0 +1,247 @@
|
|
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_TYPE_TRAITS_H_
|
6
|
+
#define INCLUDE_CPPGC_TYPE_TRAITS_H_
|
7
|
+
|
8
|
+
// This file should stay with minimal dependencies to allow embedder to check
|
9
|
+
// against Oilpan types without including any other parts.
|
10
|
+
#include <cstddef>
|
11
|
+
#include <type_traits>
|
12
|
+
|
13
|
+
namespace cppgc {
|
14
|
+
|
15
|
+
class Visitor;
|
16
|
+
|
17
|
+
namespace internal {
|
18
|
+
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
19
|
+
typename CheckingPolicy>
|
20
|
+
class BasicMember;
|
21
|
+
struct DijkstraWriteBarrierPolicy;
|
22
|
+
struct NoWriteBarrierPolicy;
|
23
|
+
class StrongMemberTag;
|
24
|
+
class UntracedMemberTag;
|
25
|
+
class WeakMemberTag;
|
26
|
+
|
27
|
+
// Pre-C++17 custom implementation of std::void_t.
|
28
|
+
template <typename... Ts>
|
29
|
+
struct make_void {
|
30
|
+
typedef void type;
|
31
|
+
};
|
32
|
+
template <typename... Ts>
|
33
|
+
using void_t = typename make_void<Ts...>::type;
|
34
|
+
|
35
|
+
// Not supposed to be specialized by the user.
|
36
|
+
template <typename T>
|
37
|
+
struct IsWeak : std::false_type {};
|
38
|
+
|
39
|
+
// IsTraceMethodConst is used to verify that all Trace methods are marked as
|
40
|
+
// const. It is equivalent to IsTraceable but for a non-const object.
|
41
|
+
template <typename T, typename = void>
|
42
|
+
struct IsTraceMethodConst : std::false_type {};
|
43
|
+
|
44
|
+
template <typename T>
|
45
|
+
struct IsTraceMethodConst<T, void_t<decltype(std::declval<const T>().Trace(
|
46
|
+
std::declval<Visitor*>()))>> : std::true_type {
|
47
|
+
};
|
48
|
+
|
49
|
+
template <typename T, typename = void>
|
50
|
+
struct IsTraceable : std::false_type {
|
51
|
+
static_assert(sizeof(T), "T must be fully defined");
|
52
|
+
};
|
53
|
+
|
54
|
+
template <typename T>
|
55
|
+
struct IsTraceable<
|
56
|
+
T, void_t<decltype(std::declval<T>().Trace(std::declval<Visitor*>()))>>
|
57
|
+
: std::true_type {
|
58
|
+
// All Trace methods should be marked as const. If an object of type
|
59
|
+
// 'T' is traceable then any object of type 'const T' should also
|
60
|
+
// be traceable.
|
61
|
+
static_assert(IsTraceMethodConst<T>(),
|
62
|
+
"Trace methods should be marked as const.");
|
63
|
+
};
|
64
|
+
|
65
|
+
template <typename T>
|
66
|
+
constexpr bool IsTraceableV = IsTraceable<T>::value;
|
67
|
+
|
68
|
+
template <typename T, typename = void>
|
69
|
+
struct HasGarbageCollectedMixinTypeMarker : std::false_type {
|
70
|
+
static_assert(sizeof(T), "T must be fully defined");
|
71
|
+
};
|
72
|
+
|
73
|
+
template <typename T>
|
74
|
+
struct HasGarbageCollectedMixinTypeMarker<
|
75
|
+
T,
|
76
|
+
void_t<typename std::remove_const_t<T>::IsGarbageCollectedMixinTypeMarker>>
|
77
|
+
: std::true_type {
|
78
|
+
static_assert(sizeof(T), "T must be fully defined");
|
79
|
+
};
|
80
|
+
|
81
|
+
template <typename T, typename = void>
|
82
|
+
struct HasGarbageCollectedTypeMarker : std::false_type {
|
83
|
+
static_assert(sizeof(T), "T must be fully defined");
|
84
|
+
};
|
85
|
+
|
86
|
+
template <typename T>
|
87
|
+
struct HasGarbageCollectedTypeMarker<
|
88
|
+
T, void_t<typename std::remove_const_t<T>::IsGarbageCollectedTypeMarker>>
|
89
|
+
: std::true_type {
|
90
|
+
static_assert(sizeof(T), "T must be fully defined");
|
91
|
+
};
|
92
|
+
|
93
|
+
template <typename T, bool = HasGarbageCollectedTypeMarker<T>::value,
|
94
|
+
bool = HasGarbageCollectedMixinTypeMarker<T>::value>
|
95
|
+
struct IsGarbageCollectedMixinType : std::false_type {
|
96
|
+
static_assert(sizeof(T), "T must be fully defined");
|
97
|
+
};
|
98
|
+
|
99
|
+
template <typename T>
|
100
|
+
struct IsGarbageCollectedMixinType<T, false, true> : std::true_type {
|
101
|
+
static_assert(sizeof(T), "T must be fully defined");
|
102
|
+
};
|
103
|
+
|
104
|
+
template <typename T, bool = HasGarbageCollectedTypeMarker<T>::value>
|
105
|
+
struct IsGarbageCollectedType : std::false_type {
|
106
|
+
static_assert(sizeof(T), "T must be fully defined");
|
107
|
+
};
|
108
|
+
|
109
|
+
template <typename T>
|
110
|
+
struct IsGarbageCollectedType<T, true> : std::true_type {
|
111
|
+
static_assert(sizeof(T), "T must be fully defined");
|
112
|
+
};
|
113
|
+
|
114
|
+
template <typename T>
|
115
|
+
struct IsGarbageCollectedOrMixinType
|
116
|
+
: std::integral_constant<bool, IsGarbageCollectedType<T>::value ||
|
117
|
+
IsGarbageCollectedMixinType<T>::value> {
|
118
|
+
static_assert(sizeof(T), "T must be fully defined");
|
119
|
+
};
|
120
|
+
|
121
|
+
template <typename T, bool = (HasGarbageCollectedTypeMarker<T>::value &&
|
122
|
+
HasGarbageCollectedMixinTypeMarker<T>::value)>
|
123
|
+
struct IsGarbageCollectedWithMixinType : std::false_type {
|
124
|
+
static_assert(sizeof(T), "T must be fully defined");
|
125
|
+
};
|
126
|
+
|
127
|
+
template <typename T>
|
128
|
+
struct IsGarbageCollectedWithMixinType<T, true> : std::true_type {
|
129
|
+
static_assert(sizeof(T), "T must be fully defined");
|
130
|
+
};
|
131
|
+
|
132
|
+
template <typename BasicMemberCandidate, typename WeaknessTag,
|
133
|
+
typename WriteBarrierPolicy>
|
134
|
+
struct IsSubclassOfBasicMemberTemplate {
|
135
|
+
private:
|
136
|
+
template <typename T, typename CheckingPolicy>
|
137
|
+
static std::true_type SubclassCheck(
|
138
|
+
BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy>*);
|
139
|
+
static std::false_type SubclassCheck(...);
|
140
|
+
|
141
|
+
public:
|
142
|
+
static constexpr bool value =
|
143
|
+
decltype(SubclassCheck(std::declval<BasicMemberCandidate*>()))::value;
|
144
|
+
};
|
145
|
+
|
146
|
+
template <typename T,
|
147
|
+
bool = IsSubclassOfBasicMemberTemplate<
|
148
|
+
T, StrongMemberTag, DijkstraWriteBarrierPolicy>::value>
|
149
|
+
struct IsMemberType : std::false_type {};
|
150
|
+
|
151
|
+
template <typename T>
|
152
|
+
struct IsMemberType<T, true> : std::true_type {};
|
153
|
+
|
154
|
+
template <typename T, bool = IsSubclassOfBasicMemberTemplate<
|
155
|
+
T, WeakMemberTag, DijkstraWriteBarrierPolicy>::value>
|
156
|
+
struct IsWeakMemberType : std::false_type {};
|
157
|
+
|
158
|
+
template <typename T>
|
159
|
+
struct IsWeakMemberType<T, true> : std::true_type {};
|
160
|
+
|
161
|
+
template <typename T, bool = IsSubclassOfBasicMemberTemplate<
|
162
|
+
T, UntracedMemberTag, NoWriteBarrierPolicy>::value>
|
163
|
+
struct IsUntracedMemberType : std::false_type {};
|
164
|
+
|
165
|
+
template <typename T>
|
166
|
+
struct IsUntracedMemberType<T, true> : std::true_type {};
|
167
|
+
|
168
|
+
template <typename T>
|
169
|
+
struct IsComplete {
|
170
|
+
private:
|
171
|
+
template <typename U, size_t = sizeof(U)>
|
172
|
+
static std::true_type IsSizeOfKnown(U*);
|
173
|
+
static std::false_type IsSizeOfKnown(...);
|
174
|
+
|
175
|
+
public:
|
176
|
+
static constexpr bool value =
|
177
|
+
decltype(IsSizeOfKnown(std::declval<T*>()))::value;
|
178
|
+
};
|
179
|
+
|
180
|
+
} // namespace internal
|
181
|
+
|
182
|
+
/**
|
183
|
+
* Value is true for types that inherit from `GarbageCollectedMixin` but not
|
184
|
+
* `GarbageCollected<T>` (i.e., they are free mixins), and false otherwise.
|
185
|
+
*/
|
186
|
+
template <typename T>
|
187
|
+
constexpr bool IsGarbageCollectedMixinTypeV =
|
188
|
+
internal::IsGarbageCollectedMixinType<T>::value;
|
189
|
+
|
190
|
+
/**
|
191
|
+
* Value is true for types that inherit from `GarbageCollected<T>`, and false
|
192
|
+
* otherwise.
|
193
|
+
*/
|
194
|
+
template <typename T>
|
195
|
+
constexpr bool IsGarbageCollectedTypeV =
|
196
|
+
internal::IsGarbageCollectedType<T>::value;
|
197
|
+
|
198
|
+
/**
|
199
|
+
* Value is true for types that inherit from either `GarbageCollected<T>` or
|
200
|
+
* `GarbageCollectedMixin`, and false otherwise.
|
201
|
+
*/
|
202
|
+
template <typename T>
|
203
|
+
constexpr bool IsGarbageCollectedOrMixinTypeV =
|
204
|
+
internal::IsGarbageCollectedOrMixinType<T>::value;
|
205
|
+
|
206
|
+
/**
|
207
|
+
* Value is true for types that inherit from `GarbageCollected<T>` and
|
208
|
+
* `GarbageCollectedMixin`, and false otherwise.
|
209
|
+
*/
|
210
|
+
template <typename T>
|
211
|
+
constexpr bool IsGarbageCollectedWithMixinTypeV =
|
212
|
+
internal::IsGarbageCollectedWithMixinType<T>::value;
|
213
|
+
|
214
|
+
/**
|
215
|
+
* Value is true for types of type `Member<T>`, and false otherwise.
|
216
|
+
*/
|
217
|
+
template <typename T>
|
218
|
+
constexpr bool IsMemberTypeV = internal::IsMemberType<T>::value;
|
219
|
+
|
220
|
+
/**
|
221
|
+
* Value is true for types of type `UntracedMember<T>`, and false otherwise.
|
222
|
+
*/
|
223
|
+
template <typename T>
|
224
|
+
constexpr bool IsUntracedMemberTypeV = internal::IsUntracedMemberType<T>::value;
|
225
|
+
|
226
|
+
/**
|
227
|
+
* Value is true for types of type `WeakMember<T>`, and false otherwise.
|
228
|
+
*/
|
229
|
+
template <typename T>
|
230
|
+
constexpr bool IsWeakMemberTypeV = internal::IsWeakMemberType<T>::value;
|
231
|
+
|
232
|
+
/**
|
233
|
+
* Value is true for types that are considered weak references, and false
|
234
|
+
* otherwise.
|
235
|
+
*/
|
236
|
+
template <typename T>
|
237
|
+
constexpr bool IsWeakV = internal::IsWeak<T>::value;
|
238
|
+
|
239
|
+
/**
|
240
|
+
* Value is true for types that are complete, and false otherwise.
|
241
|
+
*/
|
242
|
+
template <typename T>
|
243
|
+
constexpr bool IsCompleteV = internal::IsComplete<T>::value;
|
244
|
+
|
245
|
+
} // namespace cppgc
|
246
|
+
|
247
|
+
#endif // INCLUDE_CPPGC_TYPE_TRAITS_H_
|