libv8-node 15.14.0.1-arm64-darwin-21
Sign up to get free protection for your applications and to get access to all the features.
- 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/version.rb +7 -0
- data/lib/libv8/node.rb +11 -0
- data/lib/libv8-node.rb +1 -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,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_
|
@@ -0,0 +1,213 @@
|
|
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_VISITOR_H_
|
6
|
+
#define INCLUDE_CPPGC_VISITOR_H_
|
7
|
+
|
8
|
+
#include "cppgc/garbage-collected.h"
|
9
|
+
#include "cppgc/internal/logging.h"
|
10
|
+
#include "cppgc/internal/pointer-policies.h"
|
11
|
+
#include "cppgc/liveness-broker.h"
|
12
|
+
#include "cppgc/member.h"
|
13
|
+
#include "cppgc/source-location.h"
|
14
|
+
#include "cppgc/trace-trait.h"
|
15
|
+
|
16
|
+
namespace cppgc {
|
17
|
+
|
18
|
+
namespace internal {
|
19
|
+
template <typename T, typename WeaknessPolicy, typename LocationPolicy,
|
20
|
+
typename CheckingPolicy>
|
21
|
+
class BasicPersistent;
|
22
|
+
class ConservativeTracingVisitor;
|
23
|
+
class VisitorBase;
|
24
|
+
class VisitorFactory;
|
25
|
+
|
26
|
+
} // namespace internal
|
27
|
+
|
28
|
+
using WeakCallback = void (*)(const LivenessBroker&, const void*);
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Visitor passed to trace methods. All managed pointers must have called the
|
32
|
+
* Visitor's trace method on them.
|
33
|
+
*
|
34
|
+
* \code
|
35
|
+
* class Foo final : public GarbageCollected<Foo> {
|
36
|
+
* public:
|
37
|
+
* void Trace(Visitor* visitor) const {
|
38
|
+
* visitor->Trace(foo_);
|
39
|
+
* visitor->Trace(weak_foo_);
|
40
|
+
* }
|
41
|
+
* private:
|
42
|
+
* Member<Foo> foo_;
|
43
|
+
* WeakMember<Foo> weak_foo_;
|
44
|
+
* };
|
45
|
+
* \endcode
|
46
|
+
*/
|
47
|
+
class Visitor {
|
48
|
+
public:
|
49
|
+
class Key {
|
50
|
+
private:
|
51
|
+
Key() = default;
|
52
|
+
friend class internal::VisitorFactory;
|
53
|
+
};
|
54
|
+
|
55
|
+
explicit Visitor(Key) {}
|
56
|
+
|
57
|
+
virtual ~Visitor() = default;
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Trace method for Member.
|
61
|
+
*
|
62
|
+
* \param member Member reference retaining an object.
|
63
|
+
*/
|
64
|
+
template <typename T>
|
65
|
+
void Trace(const Member<T>& member) {
|
66
|
+
const T* value = member.GetRawAtomic();
|
67
|
+
CPPGC_DCHECK(value != kSentinelPointer);
|
68
|
+
Trace(value);
|
69
|
+
}
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Trace method for WeakMember.
|
73
|
+
*
|
74
|
+
* \param weak_member WeakMember reference weakly retaining an object.
|
75
|
+
*/
|
76
|
+
template <typename T>
|
77
|
+
void Trace(const WeakMember<T>& weak_member) {
|
78
|
+
static_assert(sizeof(T), "Pointee type must be fully defined.");
|
79
|
+
static_assert(internal::IsGarbageCollectedType<T>::value,
|
80
|
+
"T must be GarbageCollected or GarbageCollectedMixin type");
|
81
|
+
|
82
|
+
const T* value = weak_member.GetRawAtomic();
|
83
|
+
|
84
|
+
// Bailout assumes that WeakMember emits write barrier.
|
85
|
+
if (!value) {
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
|
89
|
+
// TODO(chromium:1056170): DCHECK (or similar) for deleted values as they
|
90
|
+
// should come in at a different path.
|
91
|
+
VisitWeak(value, TraceTrait<T>::GetTraceDescriptor(value),
|
92
|
+
&HandleWeak<WeakMember<T>>, &weak_member);
|
93
|
+
}
|
94
|
+
|
95
|
+
/**
|
96
|
+
* Trace method for inlined objects that are not allocated themselves but
|
97
|
+
* otherwise follow managed heap layout and have a Trace() method.
|
98
|
+
*
|
99
|
+
* \param object reference of the inlined object.
|
100
|
+
*/
|
101
|
+
template <typename T>
|
102
|
+
void Trace(const T& object) {
|
103
|
+
#if V8_ENABLE_CHECKS
|
104
|
+
// This object is embedded in potentially multiple nested objects. The
|
105
|
+
// outermost object must not be in construction as such objects are (a) not
|
106
|
+
// processed immediately, and (b) only processed conservatively if not
|
107
|
+
// otherwise possible.
|
108
|
+
CheckObjectNotInConstruction(&object);
|
109
|
+
#endif // V8_ENABLE_CHECKS
|
110
|
+
TraceTrait<T>::Trace(this, &object);
|
111
|
+
}
|
112
|
+
|
113
|
+
/**
|
114
|
+
* Registers a weak callback method on the object of type T. See
|
115
|
+
* LivenessBroker for an usage example.
|
116
|
+
*
|
117
|
+
* \param object of type T specifying a weak callback method.
|
118
|
+
*/
|
119
|
+
template <typename T, void (T::*method)(const LivenessBroker&)>
|
120
|
+
void RegisterWeakCallbackMethod(const T* object) {
|
121
|
+
RegisterWeakCallback(&WeakCallbackMethodDelegate<T, method>, object);
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Registers a weak callback that is invoked during garbage collection.
|
126
|
+
*
|
127
|
+
* \param callback to be invoked.
|
128
|
+
* \param data custom data that is passed to the callback.
|
129
|
+
*/
|
130
|
+
virtual void RegisterWeakCallback(WeakCallback callback, const void* data) {}
|
131
|
+
|
132
|
+
protected:
|
133
|
+
virtual void Visit(const void* self, TraceDescriptor) {}
|
134
|
+
virtual void VisitWeak(const void* self, TraceDescriptor, WeakCallback,
|
135
|
+
const void* weak_member) {}
|
136
|
+
virtual void VisitRoot(const void*, TraceDescriptor) {}
|
137
|
+
virtual void VisitWeakRoot(const void* self, TraceDescriptor, WeakCallback,
|
138
|
+
const void* weak_root) {}
|
139
|
+
|
140
|
+
private:
|
141
|
+
template <typename T, void (T::*method)(const LivenessBroker&)>
|
142
|
+
static void WeakCallbackMethodDelegate(const LivenessBroker& info,
|
143
|
+
const void* self) {
|
144
|
+
// Callback is registered through a potential const Trace method but needs
|
145
|
+
// to be able to modify fields. See HandleWeak.
|
146
|
+
(const_cast<T*>(static_cast<const T*>(self))->*method)(info);
|
147
|
+
}
|
148
|
+
|
149
|
+
template <typename PointerType>
|
150
|
+
static void HandleWeak(const LivenessBroker& info, const void* object) {
|
151
|
+
const PointerType* weak = static_cast<const PointerType*>(object);
|
152
|
+
// Sentinel values are preserved for weak pointers.
|
153
|
+
if (*weak == kSentinelPointer) return;
|
154
|
+
const auto* raw = weak->Get();
|
155
|
+
if (!info.IsHeapObjectAlive(raw)) {
|
156
|
+
weak->ClearFromGC();
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
template <typename Persistent,
|
161
|
+
std::enable_if_t<Persistent::IsStrongPersistent::value>* = nullptr>
|
162
|
+
void TraceRoot(const Persistent& p, const SourceLocation& loc) {
|
163
|
+
using PointeeType = typename Persistent::PointeeType;
|
164
|
+
static_assert(sizeof(PointeeType),
|
165
|
+
"Persistent's pointee type must be fully defined");
|
166
|
+
static_assert(internal::IsGarbageCollectedType<PointeeType>::value,
|
167
|
+
"Persistent's pointee type must be GarbageCollected or "
|
168
|
+
"GarbageCollectedMixin");
|
169
|
+
if (!p.Get()) {
|
170
|
+
return;
|
171
|
+
}
|
172
|
+
VisitRoot(p.Get(), TraceTrait<PointeeType>::GetTraceDescriptor(p.Get()));
|
173
|
+
}
|
174
|
+
|
175
|
+
template <
|
176
|
+
typename WeakPersistent,
|
177
|
+
std::enable_if_t<!WeakPersistent::IsStrongPersistent::value>* = nullptr>
|
178
|
+
void TraceRoot(const WeakPersistent& p, const SourceLocation& loc) {
|
179
|
+
using PointeeType = typename WeakPersistent::PointeeType;
|
180
|
+
static_assert(sizeof(PointeeType),
|
181
|
+
"Persistent's pointee type must be fully defined");
|
182
|
+
static_assert(internal::IsGarbageCollectedType<PointeeType>::value,
|
183
|
+
"Persistent's pointee type must be GarbageCollected or "
|
184
|
+
"GarbageCollectedMixin");
|
185
|
+
VisitWeakRoot(p.Get(), TraceTrait<PointeeType>::GetTraceDescriptor(p.Get()),
|
186
|
+
&HandleWeak<WeakPersistent>, &p);
|
187
|
+
}
|
188
|
+
|
189
|
+
template <typename T>
|
190
|
+
void Trace(const T* t) {
|
191
|
+
static_assert(sizeof(T), "Pointee type must be fully defined.");
|
192
|
+
static_assert(internal::IsGarbageCollectedType<T>::value,
|
193
|
+
"T must be GarbageCollected or GarbageCollectedMixin type");
|
194
|
+
if (!t) {
|
195
|
+
return;
|
196
|
+
}
|
197
|
+
Visit(t, TraceTrait<T>::GetTraceDescriptor(t));
|
198
|
+
}
|
199
|
+
|
200
|
+
#if V8_ENABLE_CHECKS
|
201
|
+
V8_EXPORT void CheckObjectNotInConstruction(const void* address);
|
202
|
+
#endif // V8_ENABLE_CHECKS
|
203
|
+
|
204
|
+
template <typename T, typename WeaknessPolicy, typename LocationPolicy,
|
205
|
+
typename CheckingPolicy>
|
206
|
+
friend class internal::BasicPersistent;
|
207
|
+
friend class internal::ConservativeTracingVisitor;
|
208
|
+
friend class internal::VisitorBase;
|
209
|
+
};
|
210
|
+
|
211
|
+
} // namespace cppgc
|
212
|
+
|
213
|
+
#endif // INCLUDE_CPPGC_VISITOR_H_
|
@@ -0,0 +1,29 @@
|
|
1
|
+
// Copyright 2016 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_LIBPLATFORM_LIBPLATFORM_EXPORT_H_
|
6
|
+
#define V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_
|
7
|
+
|
8
|
+
#if defined(_WIN32)
|
9
|
+
|
10
|
+
#ifdef BUILDING_V8_PLATFORM_SHARED
|
11
|
+
#define V8_PLATFORM_EXPORT __declspec(dllexport)
|
12
|
+
#elif USING_V8_PLATFORM_SHARED
|
13
|
+
#define V8_PLATFORM_EXPORT __declspec(dllimport)
|
14
|
+
#else
|
15
|
+
#define V8_PLATFORM_EXPORT
|
16
|
+
#endif // BUILDING_V8_PLATFORM_SHARED
|
17
|
+
|
18
|
+
#else // defined(_WIN32)
|
19
|
+
|
20
|
+
// Setup for Linux shared library export.
|
21
|
+
#ifdef BUILDING_V8_PLATFORM_SHARED
|
22
|
+
#define V8_PLATFORM_EXPORT __attribute__((visibility("default")))
|
23
|
+
#else
|
24
|
+
#define V8_PLATFORM_EXPORT
|
25
|
+
#endif
|
26
|
+
|
27
|
+
#endif // defined(_WIN32)
|
28
|
+
|
29
|
+
#endif // V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_
|
@@ -0,0 +1,106 @@
|
|
1
|
+
// Copyright 2014 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_LIBPLATFORM_LIBPLATFORM_H_
|
6
|
+
#define V8_LIBPLATFORM_LIBPLATFORM_H_
|
7
|
+
|
8
|
+
#include <memory>
|
9
|
+
|
10
|
+
#include "libplatform/libplatform-export.h"
|
11
|
+
#include "libplatform/v8-tracing.h"
|
12
|
+
#include "v8-platform.h" // NOLINT(build/include_directory)
|
13
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
14
|
+
|
15
|
+
namespace v8 {
|
16
|
+
namespace platform {
|
17
|
+
|
18
|
+
enum class IdleTaskSupport { kDisabled, kEnabled };
|
19
|
+
enum class InProcessStackDumping { kDisabled, kEnabled };
|
20
|
+
|
21
|
+
enum class MessageLoopBehavior : bool {
|
22
|
+
kDoNotWait = false,
|
23
|
+
kWaitForWork = true
|
24
|
+
};
|
25
|
+
|
26
|
+
/**
|
27
|
+
* Returns a new instance of the default v8::Platform implementation.
|
28
|
+
*
|
29
|
+
* The caller will take ownership of the returned pointer. |thread_pool_size|
|
30
|
+
* is the number of worker threads to allocate for background jobs. If a value
|
31
|
+
* of zero is passed, a suitable default based on the current number of
|
32
|
+
* processors online will be chosen.
|
33
|
+
* If |idle_task_support| is enabled then the platform will accept idle
|
34
|
+
* tasks (IdleTasksEnabled will return true) and will rely on the embedder
|
35
|
+
* calling v8::platform::RunIdleTasks to process the idle tasks.
|
36
|
+
* If |tracing_controller| is nullptr, the default platform will create a
|
37
|
+
* v8::platform::TracingController instance and use it.
|
38
|
+
*/
|
39
|
+
V8_PLATFORM_EXPORT std::unique_ptr<v8::Platform> NewDefaultPlatform(
|
40
|
+
int thread_pool_size = 0,
|
41
|
+
IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled,
|
42
|
+
InProcessStackDumping in_process_stack_dumping =
|
43
|
+
InProcessStackDumping::kDisabled,
|
44
|
+
std::unique_ptr<v8::TracingController> tracing_controller = {});
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Returns a new instance of the default v8::JobHandle implementation.
|
48
|
+
*
|
49
|
+
* The job will be executed by spawning up to |num_worker_threads| many worker
|
50
|
+
* threads on the provided |platform| with the given |priority|.
|
51
|
+
*/
|
52
|
+
V8_PLATFORM_EXPORT std::unique_ptr<v8::JobHandle> NewDefaultJobHandle(
|
53
|
+
v8::Platform* platform, v8::TaskPriority priority,
|
54
|
+
std::unique_ptr<v8::JobTask> job_task, size_t num_worker_threads);
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Pumps the message loop for the given isolate.
|
58
|
+
*
|
59
|
+
* The caller has to make sure that this is called from the right thread.
|
60
|
+
* Returns true if a task was executed, and false otherwise. If the call to
|
61
|
+
* PumpMessageLoop is nested within another call to PumpMessageLoop, only
|
62
|
+
* nestable tasks may run. Otherwise, any task may run. Unless requested through
|
63
|
+
* the |behavior| parameter, this call does not block if no task is pending. The
|
64
|
+
* |platform| has to be created using |NewDefaultPlatform|.
|
65
|
+
*/
|
66
|
+
V8_PLATFORM_EXPORT bool PumpMessageLoop(
|
67
|
+
v8::Platform* platform, v8::Isolate* isolate,
|
68
|
+
MessageLoopBehavior behavior = MessageLoopBehavior::kDoNotWait);
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Runs pending idle tasks for at most |idle_time_in_seconds| seconds.
|
72
|
+
*
|
73
|
+
* The caller has to make sure that this is called from the right thread.
|
74
|
+
* This call does not block if no task is pending. The |platform| has to be
|
75
|
+
* created using |NewDefaultPlatform|.
|
76
|
+
*/
|
77
|
+
V8_PLATFORM_EXPORT void RunIdleTasks(v8::Platform* platform,
|
78
|
+
v8::Isolate* isolate,
|
79
|
+
double idle_time_in_seconds);
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Attempts to set the tracing controller for the given platform.
|
83
|
+
*
|
84
|
+
* The |platform| has to be created using |NewDefaultPlatform|.
|
85
|
+
*
|
86
|
+
*/
|
87
|
+
V8_DEPRECATE_SOON("Access the DefaultPlatform directly")
|
88
|
+
V8_PLATFORM_EXPORT void SetTracingController(
|
89
|
+
v8::Platform* platform,
|
90
|
+
v8::platform::tracing::TracingController* tracing_controller);
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Notifies the given platform about the Isolate getting deleted soon. Has to be
|
94
|
+
* called for all Isolates which are deleted - unless we're shutting down the
|
95
|
+
* platform.
|
96
|
+
*
|
97
|
+
* The |platform| has to be created using |NewDefaultPlatform|.
|
98
|
+
*
|
99
|
+
*/
|
100
|
+
V8_PLATFORM_EXPORT void NotifyIsolateShutdown(v8::Platform* platform,
|
101
|
+
Isolate* isolate);
|
102
|
+
|
103
|
+
} // namespace platform
|
104
|
+
} // namespace v8
|
105
|
+
|
106
|
+
#endif // V8_LIBPLATFORM_LIBPLATFORM_H_
|