libv8-node 15.5.1.0.beta1-aarch64-linux
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 +30 -0
- data/lib/libv8-node.rb +1 -0
- data/lib/libv8/node.rb +11 -0
- data/lib/libv8/node/version.rb +7 -0
- data/vendor/v8/include/cppgc/allocation.h +173 -0
- data/vendor/v8/include/cppgc/common.h +26 -0
- data/vendor/v8/include/cppgc/custom-space.h +62 -0
- data/vendor/v8/include/cppgc/default-platform.h +76 -0
- data/vendor/v8/include/cppgc/garbage-collected.h +116 -0
- data/vendor/v8/include/cppgc/heap.h +139 -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 +67 -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 +45 -0
- data/vendor/v8/include/cppgc/internal/logging.h +50 -0
- data/vendor/v8/include/cppgc/internal/persistent-node.h +116 -0
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +134 -0
- data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +30 -0
- data/vendor/v8/include/cppgc/internal/process-heap.h +34 -0
- data/vendor/v8/include/cppgc/internal/write-barrier.h +78 -0
- data/vendor/v8/include/cppgc/liveness-broker.h +68 -0
- data/vendor/v8/include/cppgc/macros.h +24 -0
- data/vendor/v8/include/cppgc/member.h +226 -0
- data/vendor/v8/include/cppgc/persistent.h +341 -0
- data/vendor/v8/include/cppgc/platform.h +130 -0
- data/vendor/v8/include/cppgc/prefinalizer.h +52 -0
- data/vendor/v8/include/cppgc/source-location.h +91 -0
- data/vendor/v8/include/cppgc/trace-trait.h +111 -0
- data/vendor/v8/include/cppgc/type-traits.h +109 -0
- data/vendor/v8/include/cppgc/visitor.h +213 -0
- data/vendor/v8/include/libplatform/libplatform-export.h +29 -0
- data/vendor/v8/include/libplatform/libplatform.h +106 -0
- data/vendor/v8/include/libplatform/v8-tracing.h +332 -0
- data/vendor/v8/include/v8-cppgc.h +226 -0
- data/vendor/v8/include/v8-fast-api-calls.h +388 -0
- data/vendor/v8/include/v8-inspector-protocol.h +13 -0
- data/vendor/v8/include/v8-inspector.h +327 -0
- data/vendor/v8/include/v8-internal.h +427 -0
- data/vendor/v8/include/v8-metrics.h +133 -0
- data/vendor/v8/include/v8-platform.h +684 -0
- data/vendor/v8/include/v8-profiler.h +1059 -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 +12098 -0
- data/vendor/v8/include/v8config.h +484 -0
- data/vendor/v8/out.gn/libv8/obj/libv8_monolith.a +0 -0
- metadata +126 -0
@@ -0,0 +1,130 @@
|
|
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_PLATFORM_H_
|
6
|
+
#define INCLUDE_CPPGC_PLATFORM_H_
|
7
|
+
|
8
|
+
#include "v8-platform.h" // NOLINT(build/include_directory)
|
9
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
10
|
+
|
11
|
+
namespace cppgc {
|
12
|
+
|
13
|
+
// TODO(v8:10346): Create separate includes for concepts that are not
|
14
|
+
// V8-specific.
|
15
|
+
using IdleTask = v8::IdleTask;
|
16
|
+
using JobHandle = v8::JobHandle;
|
17
|
+
using JobDelegate = v8::JobDelegate;
|
18
|
+
using JobTask = v8::JobTask;
|
19
|
+
using PageAllocator = v8::PageAllocator;
|
20
|
+
using Task = v8::Task;
|
21
|
+
using TaskPriority = v8::TaskPriority;
|
22
|
+
using TaskRunner = v8::TaskRunner;
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Platform interface used by Heap. Contains allocators and executors.
|
26
|
+
*/
|
27
|
+
class V8_EXPORT Platform {
|
28
|
+
public:
|
29
|
+
virtual ~Platform() = default;
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Returns the allocator used by cppgc to allocate its heap and various
|
33
|
+
* support structures.
|
34
|
+
*/
|
35
|
+
virtual PageAllocator* GetPageAllocator() = 0;
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Monotonically increasing time in seconds from an arbitrary fixed point in
|
39
|
+
* the past. This function is expected to return at least
|
40
|
+
* millisecond-precision values. For this reason,
|
41
|
+
* it is recommended that the fixed point be no further in the past than
|
42
|
+
* the epoch.
|
43
|
+
**/
|
44
|
+
virtual double MonotonicallyIncreasingTime() = 0;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Foreground task runner that should be used by a Heap.
|
48
|
+
*/
|
49
|
+
virtual std::shared_ptr<TaskRunner> GetForegroundTaskRunner() {
|
50
|
+
return nullptr;
|
51
|
+
}
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Posts |job_task| to run in parallel. Returns a JobHandle associated with
|
55
|
+
* the Job, which can be joined or canceled.
|
56
|
+
* This avoids degenerate cases:
|
57
|
+
* - Calling CallOnWorkerThread() for each work item, causing significant
|
58
|
+
* overhead.
|
59
|
+
* - Fixed number of CallOnWorkerThread() calls that split the work and might
|
60
|
+
* run for a long time. This is problematic when many components post
|
61
|
+
* "num cores" tasks and all expect to use all the cores. In these cases,
|
62
|
+
* the scheduler lacks context to be fair to multiple same-priority requests
|
63
|
+
* and/or ability to request lower priority work to yield when high priority
|
64
|
+
* work comes in.
|
65
|
+
* A canonical implementation of |job_task| looks like:
|
66
|
+
* class MyJobTask : public JobTask {
|
67
|
+
* public:
|
68
|
+
* MyJobTask(...) : worker_queue_(...) {}
|
69
|
+
* // JobTask:
|
70
|
+
* void Run(JobDelegate* delegate) override {
|
71
|
+
* while (!delegate->ShouldYield()) {
|
72
|
+
* // Smallest unit of work.
|
73
|
+
* auto work_item = worker_queue_.TakeWorkItem(); // Thread safe.
|
74
|
+
* if (!work_item) return;
|
75
|
+
* ProcessWork(work_item);
|
76
|
+
* }
|
77
|
+
* }
|
78
|
+
*
|
79
|
+
* size_t GetMaxConcurrency() const override {
|
80
|
+
* return worker_queue_.GetSize(); // Thread safe.
|
81
|
+
* }
|
82
|
+
* };
|
83
|
+
* auto handle = PostJob(TaskPriority::kUserVisible,
|
84
|
+
* std::make_unique<MyJobTask>(...));
|
85
|
+
* handle->Join();
|
86
|
+
*
|
87
|
+
* PostJob() and methods of the returned JobHandle/JobDelegate, must never be
|
88
|
+
* called while holding a lock that could be acquired by JobTask::Run or
|
89
|
+
* JobTask::GetMaxConcurrency -- that could result in a deadlock. This is
|
90
|
+
* because [1] JobTask::GetMaxConcurrency may be invoked while holding
|
91
|
+
* internal lock (A), hence JobTask::GetMaxConcurrency can only use a lock (B)
|
92
|
+
* if that lock is *never* held while calling back into JobHandle from any
|
93
|
+
* thread (A=>B/B=>A deadlock) and [2] JobTask::Run or
|
94
|
+
* JobTask::GetMaxConcurrency may be invoked synchronously from JobHandle
|
95
|
+
* (B=>JobHandle::foo=>B deadlock).
|
96
|
+
*
|
97
|
+
* A sufficient PostJob() implementation that uses the default Job provided in
|
98
|
+
* libplatform looks like:
|
99
|
+
* std::unique_ptr<JobHandle> PostJob(
|
100
|
+
* TaskPriority priority, std::unique_ptr<JobTask> job_task) override {
|
101
|
+
* return std::make_unique<DefaultJobHandle>(
|
102
|
+
* std::make_shared<DefaultJobState>(
|
103
|
+
* this, std::move(job_task), kNumThreads));
|
104
|
+
* }
|
105
|
+
*/
|
106
|
+
virtual std::unique_ptr<JobHandle> PostJob(
|
107
|
+
TaskPriority priority, std::unique_ptr<JobTask> job_task) {
|
108
|
+
return nullptr;
|
109
|
+
}
|
110
|
+
};
|
111
|
+
|
112
|
+
/**
|
113
|
+
* Process-global initialization of the garbage collector. Must be called before
|
114
|
+
* creating a Heap.
|
115
|
+
*/
|
116
|
+
V8_EXPORT void InitializeProcess(PageAllocator*);
|
117
|
+
|
118
|
+
/**
|
119
|
+
* Must be called after destroying the last used heap.
|
120
|
+
*/
|
121
|
+
V8_EXPORT void ShutdownProcess();
|
122
|
+
|
123
|
+
namespace internal {
|
124
|
+
|
125
|
+
V8_EXPORT void Abort();
|
126
|
+
|
127
|
+
} // namespace internal
|
128
|
+
} // namespace cppgc
|
129
|
+
|
130
|
+
#endif // INCLUDE_CPPGC_PLATFORM_H_
|
@@ -0,0 +1,52 @@
|
|
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_PREFINALIZER_H_
|
6
|
+
#define INCLUDE_CPPGC_PREFINALIZER_H_
|
7
|
+
|
8
|
+
#include "cppgc/internal/compiler-specific.h"
|
9
|
+
#include "cppgc/internal/prefinalizer-handler.h"
|
10
|
+
#include "cppgc/liveness-broker.h"
|
11
|
+
|
12
|
+
namespace cppgc {
|
13
|
+
|
14
|
+
namespace internal {
|
15
|
+
|
16
|
+
template <typename T>
|
17
|
+
class PrefinalizerRegistration final {
|
18
|
+
public:
|
19
|
+
explicit PrefinalizerRegistration(T* self) {
|
20
|
+
static_assert(sizeof(&T::InvokePreFinalizer) > 0,
|
21
|
+
"USING_PRE_FINALIZER(T) must be defined.");
|
22
|
+
|
23
|
+
cppgc::internal::PreFinalizerRegistrationDispatcher::RegisterPrefinalizer(
|
24
|
+
{self, T::InvokePreFinalizer});
|
25
|
+
}
|
26
|
+
|
27
|
+
void* operator new(size_t, void* location) = delete;
|
28
|
+
void* operator new(size_t) = delete;
|
29
|
+
};
|
30
|
+
|
31
|
+
} // namespace internal
|
32
|
+
|
33
|
+
#define CPPGC_USING_PRE_FINALIZER(Class, PreFinalizer) \
|
34
|
+
public: \
|
35
|
+
static bool InvokePreFinalizer(const cppgc::LivenessBroker& liveness_broker, \
|
36
|
+
void* object) { \
|
37
|
+
static_assert(cppgc::internal::IsGarbageCollectedTypeV<Class>, \
|
38
|
+
"Only garbage collected objects can have prefinalizers"); \
|
39
|
+
Class* self = static_cast<Class*>(object); \
|
40
|
+
if (liveness_broker.IsHeapObjectAlive(self)) return false; \
|
41
|
+
self->Class::PreFinalizer(); \
|
42
|
+
return true; \
|
43
|
+
} \
|
44
|
+
\
|
45
|
+
private: \
|
46
|
+
CPPGC_NO_UNIQUE_ADDRESS cppgc::internal::PrefinalizerRegistration<Class> \
|
47
|
+
prefinalizer_dummy_{this}; \
|
48
|
+
static_assert(true, "Force semicolon.")
|
49
|
+
|
50
|
+
} // namespace cppgc
|
51
|
+
|
52
|
+
#endif // INCLUDE_CPPGC_PREFINALIZER_H_
|
@@ -0,0 +1,91 @@
|
|
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 <string>
|
9
|
+
|
10
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
11
|
+
|
12
|
+
#if defined(__has_builtin)
|
13
|
+
#define CPPGC_SUPPORTS_SOURCE_LOCATION \
|
14
|
+
(__has_builtin(__builtin_FUNCTION) && __has_builtin(__builtin_FILE) && \
|
15
|
+
__has_builtin(__builtin_LINE)) // NOLINT
|
16
|
+
#elif defined(V8_CC_GNU) && __GNUC__ >= 7
|
17
|
+
#define CPPGC_SUPPORTS_SOURCE_LOCATION 1
|
18
|
+
#elif defined(V8_CC_INTEL) && __ICC >= 1800
|
19
|
+
#define CPPGC_SUPPORTS_SOURCE_LOCATION 1
|
20
|
+
#else
|
21
|
+
#define CPPGC_SUPPORTS_SOURCE_LOCATION 0
|
22
|
+
#endif
|
23
|
+
|
24
|
+
namespace cppgc {
|
25
|
+
|
26
|
+
/**
|
27
|
+
* Encapsulates source location information. Mimics C++20's
|
28
|
+
* std::source_location.
|
29
|
+
*/
|
30
|
+
class V8_EXPORT SourceLocation final {
|
31
|
+
public:
|
32
|
+
/**
|
33
|
+
* Construct source location information corresponding to the location of the
|
34
|
+
* call site.
|
35
|
+
*/
|
36
|
+
#if CPPGC_SUPPORTS_SOURCE_LOCATION
|
37
|
+
static constexpr SourceLocation Current(
|
38
|
+
const char* function = __builtin_FUNCTION(),
|
39
|
+
const char* file = __builtin_FILE(), size_t line = __builtin_LINE()) {
|
40
|
+
return SourceLocation(function, file, line);
|
41
|
+
}
|
42
|
+
#else
|
43
|
+
static constexpr SourceLocation Current() { return SourceLocation(); }
|
44
|
+
#endif // CPPGC_SUPPORTS_SOURCE_LOCATION
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Constructs unspecified source location information.
|
48
|
+
*/
|
49
|
+
constexpr SourceLocation() = default;
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Returns the name of the function associated with the position represented
|
53
|
+
* by this object, if any.
|
54
|
+
*
|
55
|
+
* \returns the function name as cstring.
|
56
|
+
*/
|
57
|
+
constexpr const char* Function() const { return function_; }
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Returns the name of the current source file represented by this object.
|
61
|
+
*
|
62
|
+
* \returns the file name as cstring.
|
63
|
+
*/
|
64
|
+
constexpr const char* FileName() const { return file_; }
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Returns the line number represented by this object.
|
68
|
+
*
|
69
|
+
* \returns the line number.
|
70
|
+
*/
|
71
|
+
constexpr size_t Line() const { return line_; }
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Returns a human-readable string representing this object.
|
75
|
+
*
|
76
|
+
* \returns a human-readable string representing source location information.
|
77
|
+
*/
|
78
|
+
std::string ToString() const;
|
79
|
+
|
80
|
+
private:
|
81
|
+
constexpr SourceLocation(const char* function, const char* file, size_t line)
|
82
|
+
: function_(function), file_(file), line_(line) {}
|
83
|
+
|
84
|
+
const char* function_ = nullptr;
|
85
|
+
const char* file_ = nullptr;
|
86
|
+
size_t line_ = 0u;
|
87
|
+
};
|
88
|
+
|
89
|
+
} // namespace cppgc
|
90
|
+
|
91
|
+
#endif // INCLUDE_CPPGC_SOURCE_LOCATION_H_
|
@@ -0,0 +1,111 @@
|
|
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
|
+
} // namespace internal
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Trait specifying how the garbage collector processes an object of type T.
|
62
|
+
*
|
63
|
+
* Advanced users may override handling by creating a specialization for their
|
64
|
+
* type.
|
65
|
+
*/
|
66
|
+
template <typename T>
|
67
|
+
struct TraceTrait {
|
68
|
+
static_assert(internal::IsTraceableV<T>, "T must have a Trace() method");
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Accessor for retrieving a TraceDescriptor to process an object of type T.
|
72
|
+
*
|
73
|
+
* \param self The object to be processed.
|
74
|
+
* \returns a TraceDescriptor to process the object.
|
75
|
+
*/
|
76
|
+
static TraceDescriptor GetTraceDescriptor(const void* self) {
|
77
|
+
return internal::TraceTraitImpl<T>::GetTraceDescriptor(
|
78
|
+
static_cast<const T*>(self));
|
79
|
+
}
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Function invoking the tracing for an object of type T.
|
83
|
+
*
|
84
|
+
* \param visitor The visitor to dispatch to.
|
85
|
+
* \param self The object to invoke tracing on.
|
86
|
+
*/
|
87
|
+
static void Trace(Visitor* visitor, const void* self) {
|
88
|
+
static_cast<const T*>(self)->Trace(visitor);
|
89
|
+
}
|
90
|
+
};
|
91
|
+
|
92
|
+
namespace internal {
|
93
|
+
|
94
|
+
template <typename T>
|
95
|
+
struct TraceTraitImpl<T, false> {
|
96
|
+
static TraceDescriptor GetTraceDescriptor(const void* self) {
|
97
|
+
return {self, TraceTrait<T>::Trace};
|
98
|
+
}
|
99
|
+
};
|
100
|
+
|
101
|
+
template <typename T>
|
102
|
+
struct TraceTraitImpl<T, true> {
|
103
|
+
static TraceDescriptor GetTraceDescriptor(const void* self) {
|
104
|
+
return internal::TraceTraitFromInnerAddressImpl::GetTraceDescriptor(self);
|
105
|
+
}
|
106
|
+
};
|
107
|
+
|
108
|
+
} // namespace internal
|
109
|
+
} // namespace cppgc
|
110
|
+
|
111
|
+
#endif // INCLUDE_CPPGC_TRACE_TRAIT_H_
|
@@ -0,0 +1,109 @@
|
|
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
|
+
#include <type_traits>
|
9
|
+
|
10
|
+
namespace cppgc {
|
11
|
+
|
12
|
+
class Visitor;
|
13
|
+
|
14
|
+
namespace internal {
|
15
|
+
|
16
|
+
// Pre-C++17 custom implementation of std::void_t.
|
17
|
+
template <typename... Ts>
|
18
|
+
struct make_void {
|
19
|
+
typedef void type;
|
20
|
+
};
|
21
|
+
template <typename... Ts>
|
22
|
+
using void_t = typename make_void<Ts...>::type;
|
23
|
+
|
24
|
+
// Not supposed to be specialized by the user.
|
25
|
+
template <typename T>
|
26
|
+
struct IsWeak : std::false_type {};
|
27
|
+
|
28
|
+
template <typename T, template <typename... V> class U>
|
29
|
+
struct IsSubclassOfTemplate {
|
30
|
+
private:
|
31
|
+
template <typename... W>
|
32
|
+
static std::true_type SubclassCheck(U<W...>*);
|
33
|
+
static std::false_type SubclassCheck(...);
|
34
|
+
|
35
|
+
public:
|
36
|
+
static constexpr bool value =
|
37
|
+
decltype(SubclassCheck(std::declval<T*>()))::value;
|
38
|
+
};
|
39
|
+
|
40
|
+
// IsTraceMethodConst is used to verify that all Trace methods are marked as
|
41
|
+
// const. It is equivalent to IsTraceable but for a non-const object.
|
42
|
+
template <typename T, typename = void>
|
43
|
+
struct IsTraceMethodConst : std::false_type {};
|
44
|
+
|
45
|
+
template <typename T>
|
46
|
+
struct IsTraceMethodConst<T, void_t<decltype(std::declval<const T>().Trace(
|
47
|
+
std::declval<Visitor*>()))>> : std::true_type {
|
48
|
+
};
|
49
|
+
|
50
|
+
template <typename T, typename = void>
|
51
|
+
struct IsTraceable : std::false_type {
|
52
|
+
static_assert(sizeof(T), "T must be fully defined");
|
53
|
+
};
|
54
|
+
|
55
|
+
template <typename T>
|
56
|
+
struct IsTraceable<
|
57
|
+
T, void_t<decltype(std::declval<T>().Trace(std::declval<Visitor*>()))>>
|
58
|
+
: std::true_type {
|
59
|
+
// All Trace methods should be marked as const. If an object of type
|
60
|
+
// 'T' is traceable then any object of type 'const T' should also
|
61
|
+
// be traceable.
|
62
|
+
static_assert(IsTraceMethodConst<T>(),
|
63
|
+
"Trace methods should be marked as const.");
|
64
|
+
};
|
65
|
+
|
66
|
+
template <typename T>
|
67
|
+
constexpr bool IsTraceableV = IsTraceable<T>::value;
|
68
|
+
|
69
|
+
template <typename T, typename = void>
|
70
|
+
struct IsGarbageCollectedMixinType : std::false_type {
|
71
|
+
static_assert(sizeof(T), "T must be fully defined");
|
72
|
+
};
|
73
|
+
|
74
|
+
template <typename T>
|
75
|
+
struct IsGarbageCollectedMixinType<
|
76
|
+
T,
|
77
|
+
void_t<typename std::remove_const_t<T>::IsGarbageCollectedMixinTypeMarker>>
|
78
|
+
: std::true_type {
|
79
|
+
static_assert(sizeof(T), "T must be fully defined");
|
80
|
+
};
|
81
|
+
|
82
|
+
template <typename T, typename = void>
|
83
|
+
struct IsGarbageCollectedType : IsGarbageCollectedMixinType<T> {
|
84
|
+
static_assert(sizeof(T), "T must be fully defined");
|
85
|
+
};
|
86
|
+
|
87
|
+
template <typename T>
|
88
|
+
struct IsGarbageCollectedType<
|
89
|
+
T, void_t<typename std::remove_const_t<T>::IsGarbageCollectedTypeMarker>>
|
90
|
+
: std::true_type {
|
91
|
+
static_assert(sizeof(T), "T must be fully defined");
|
92
|
+
};
|
93
|
+
|
94
|
+
template <typename T>
|
95
|
+
constexpr bool IsGarbageCollectedTypeV =
|
96
|
+
internal::IsGarbageCollectedType<T>::value;
|
97
|
+
|
98
|
+
template <typename T>
|
99
|
+
constexpr bool IsGarbageCollectedMixinTypeV =
|
100
|
+
internal::IsGarbageCollectedMixinType<T>::value;
|
101
|
+
|
102
|
+
} // namespace internal
|
103
|
+
|
104
|
+
template <typename T>
|
105
|
+
constexpr bool IsWeakV = internal::IsWeak<T>::value;
|
106
|
+
|
107
|
+
} // namespace cppgc
|
108
|
+
|
109
|
+
#endif // INCLUDE_CPPGC_TYPE_TRAITS_H_
|