libv8-node 16.10.0.0-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
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/arm64-darwin/libv8/obj/libv8_monolith.a +0 -0
  9. data/vendor/v8/include/cppgc/allocation.h +232 -0
  10. data/vendor/v8/include/cppgc/common.h +29 -0
  11. data/vendor/v8/include/cppgc/cross-thread-persistent.h +384 -0
  12. data/vendor/v8/include/cppgc/custom-space.h +97 -0
  13. data/vendor/v8/include/cppgc/default-platform.h +75 -0
  14. data/vendor/v8/include/cppgc/ephemeron-pair.h +30 -0
  15. data/vendor/v8/include/cppgc/explicit-management.h +82 -0
  16. data/vendor/v8/include/cppgc/garbage-collected.h +117 -0
  17. data/vendor/v8/include/cppgc/heap-consistency.h +236 -0
  18. data/vendor/v8/include/cppgc/heap-state.h +70 -0
  19. data/vendor/v8/include/cppgc/heap-statistics.h +120 -0
  20. data/vendor/v8/include/cppgc/heap.h +201 -0
  21. data/vendor/v8/include/cppgc/internal/api-constants.h +47 -0
  22. data/vendor/v8/include/cppgc/internal/atomic-entry-flag.h +48 -0
  23. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +68 -0
  24. data/vendor/v8/include/cppgc/internal/compiler-specific.h +38 -0
  25. data/vendor/v8/include/cppgc/internal/finalizer-trait.h +90 -0
  26. data/vendor/v8/include/cppgc/internal/gc-info.h +76 -0
  27. data/vendor/v8/include/cppgc/internal/logging.h +50 -0
  28. data/vendor/v8/include/cppgc/internal/name-trait.h +111 -0
  29. data/vendor/v8/include/cppgc/internal/persistent-node.h +172 -0
  30. data/vendor/v8/include/cppgc/internal/pointer-policies.h +175 -0
  31. data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +30 -0
  32. data/vendor/v8/include/cppgc/internal/write-barrier.h +396 -0
  33. data/vendor/v8/include/cppgc/liveness-broker.h +74 -0
  34. data/vendor/v8/include/cppgc/macros.h +26 -0
  35. data/vendor/v8/include/cppgc/member.h +286 -0
  36. data/vendor/v8/include/cppgc/name-provider.h +65 -0
  37. data/vendor/v8/include/cppgc/object-size-trait.h +58 -0
  38. data/vendor/v8/include/cppgc/persistent.h +365 -0
  39. data/vendor/v8/include/cppgc/platform.h +153 -0
  40. data/vendor/v8/include/cppgc/prefinalizer.h +52 -0
  41. data/vendor/v8/include/cppgc/process-heap-statistics.h +36 -0
  42. data/vendor/v8/include/cppgc/sentinel-pointer.h +32 -0
  43. data/vendor/v8/include/cppgc/source-location.h +92 -0
  44. data/vendor/v8/include/cppgc/testing.h +99 -0
  45. data/vendor/v8/include/cppgc/trace-trait.h +116 -0
  46. data/vendor/v8/include/cppgc/type-traits.h +247 -0
  47. data/vendor/v8/include/cppgc/visitor.h +377 -0
  48. data/vendor/v8/include/libplatform/libplatform-export.h +29 -0
  49. data/vendor/v8/include/libplatform/libplatform.h +117 -0
  50. data/vendor/v8/include/libplatform/v8-tracing.h +334 -0
  51. data/vendor/v8/include/v8-cppgc.h +325 -0
  52. data/vendor/v8/include/v8-fast-api-calls.h +791 -0
  53. data/vendor/v8/include/v8-inspector-protocol.h +13 -0
  54. data/vendor/v8/include/v8-inspector.h +348 -0
  55. data/vendor/v8/include/v8-internal.h +499 -0
  56. data/vendor/v8/include/v8-metrics.h +202 -0
  57. data/vendor/v8/include/v8-platform.h +709 -0
  58. data/vendor/v8/include/v8-profiler.h +1123 -0
  59. data/vendor/v8/include/v8-unwinder-state.h +30 -0
  60. data/vendor/v8/include/v8-util.h +652 -0
  61. data/vendor/v8/include/v8-value-serializer-version.h +24 -0
  62. data/vendor/v8/include/v8-version-string.h +38 -0
  63. data/vendor/v8/include/v8-version.h +20 -0
  64. data/vendor/v8/include/v8-wasm-trap-handler-posix.h +31 -0
  65. data/vendor/v8/include/v8-wasm-trap-handler-win.h +28 -0
  66. data/vendor/v8/include/v8.h +12648 -0
  67. data/vendor/v8/include/v8config.h +515 -0
  68. metadata +138 -0
@@ -0,0 +1,377 @@
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/custom-space.h"
9
+ #include "cppgc/ephemeron-pair.h"
10
+ #include "cppgc/garbage-collected.h"
11
+ #include "cppgc/internal/logging.h"
12
+ #include "cppgc/internal/pointer-policies.h"
13
+ #include "cppgc/liveness-broker.h"
14
+ #include "cppgc/member.h"
15
+ #include "cppgc/source-location.h"
16
+ #include "cppgc/trace-trait.h"
17
+ #include "cppgc/type-traits.h"
18
+
19
+ namespace cppgc {
20
+
21
+ namespace internal {
22
+ template <typename T, typename WeaknessPolicy, typename LocationPolicy,
23
+ typename CheckingPolicy>
24
+ class BasicCrossThreadPersistent;
25
+ template <typename T, typename WeaknessPolicy, typename LocationPolicy,
26
+ typename CheckingPolicy>
27
+ class BasicPersistent;
28
+ class ConservativeTracingVisitor;
29
+ class VisitorBase;
30
+ class VisitorFactory;
31
+ } // namespace internal
32
+
33
+ using WeakCallback = void (*)(const LivenessBroker&, const void*);
34
+
35
+ /**
36
+ * Visitor passed to trace methods. All managed pointers must have called the
37
+ * Visitor's trace method on them.
38
+ *
39
+ * \code
40
+ * class Foo final : public GarbageCollected<Foo> {
41
+ * public:
42
+ * void Trace(Visitor* visitor) const {
43
+ * visitor->Trace(foo_);
44
+ * visitor->Trace(weak_foo_);
45
+ * }
46
+ * private:
47
+ * Member<Foo> foo_;
48
+ * WeakMember<Foo> weak_foo_;
49
+ * };
50
+ * \endcode
51
+ */
52
+ class V8_EXPORT Visitor {
53
+ public:
54
+ class Key {
55
+ private:
56
+ Key() = default;
57
+ friend class internal::VisitorFactory;
58
+ };
59
+
60
+ explicit Visitor(Key) {}
61
+
62
+ virtual ~Visitor() = default;
63
+
64
+ /**
65
+ * Trace method for raw pointers. Prefer the versions for managed pointers.
66
+ *
67
+ * \param member Reference retaining an object.
68
+ */
69
+ template <typename T>
70
+ void Trace(const T* t) {
71
+ static_assert(sizeof(T), "Pointee type must be fully defined.");
72
+ static_assert(internal::IsGarbageCollectedOrMixinType<T>::value,
73
+ "T must be GarbageCollected or GarbageCollectedMixin type");
74
+ if (!t) {
75
+ return;
76
+ }
77
+ Visit(t, TraceTrait<T>::GetTraceDescriptor(t));
78
+ }
79
+
80
+ /**
81
+ * Trace method for Member.
82
+ *
83
+ * \param member Member reference retaining an object.
84
+ */
85
+ template <typename T>
86
+ void Trace(const Member<T>& member) {
87
+ const T* value = member.GetRawAtomic();
88
+ CPPGC_DCHECK(value != kSentinelPointer);
89
+ Trace(value);
90
+ }
91
+
92
+ /**
93
+ * Trace method for WeakMember.
94
+ *
95
+ * \param weak_member WeakMember reference weakly retaining an object.
96
+ */
97
+ template <typename T>
98
+ void Trace(const WeakMember<T>& weak_member) {
99
+ static_assert(sizeof(T), "Pointee type must be fully defined.");
100
+ static_assert(internal::IsGarbageCollectedOrMixinType<T>::value,
101
+ "T must be GarbageCollected or GarbageCollectedMixin type");
102
+ static_assert(!internal::IsAllocatedOnCompactableSpace<T>::value,
103
+ "Weak references to compactable objects are not allowed");
104
+
105
+ const T* value = weak_member.GetRawAtomic();
106
+
107
+ // Bailout assumes that WeakMember emits write barrier.
108
+ if (!value) {
109
+ return;
110
+ }
111
+
112
+ CPPGC_DCHECK(value != kSentinelPointer);
113
+ VisitWeak(value, TraceTrait<T>::GetTraceDescriptor(value),
114
+ &HandleWeak<WeakMember<T>>, &weak_member);
115
+ }
116
+
117
+ /**
118
+ * Trace method for inlined objects that are not allocated themselves but
119
+ * otherwise follow managed heap layout and have a Trace() method.
120
+ *
121
+ * \param object reference of the inlined object.
122
+ */
123
+ template <typename T>
124
+ void Trace(const T& object) {
125
+ #if V8_ENABLE_CHECKS
126
+ // This object is embedded in potentially multiple nested objects. The
127
+ // outermost object must not be in construction as such objects are (a) not
128
+ // processed immediately, and (b) only processed conservatively if not
129
+ // otherwise possible.
130
+ CheckObjectNotInConstruction(&object);
131
+ #endif // V8_ENABLE_CHECKS
132
+ TraceTrait<T>::Trace(this, &object);
133
+ }
134
+
135
+ /**
136
+ * Registers a weak callback method on the object of type T. See
137
+ * LivenessBroker for an usage example.
138
+ *
139
+ * \param object of type T specifying a weak callback method.
140
+ */
141
+ template <typename T, void (T::*method)(const LivenessBroker&)>
142
+ void RegisterWeakCallbackMethod(const T* object) {
143
+ RegisterWeakCallback(&WeakCallbackMethodDelegate<T, method>, object);
144
+ }
145
+
146
+ /**
147
+ * Trace method for EphemeronPair.
148
+ *
149
+ * \param ephemeron_pair EphemeronPair reference weakly retaining a key object
150
+ * and strongly retaining a value object in case the key object is alive.
151
+ */
152
+ template <typename K, typename V>
153
+ void Trace(const EphemeronPair<K, V>& ephemeron_pair) {
154
+ TraceEphemeron(ephemeron_pair.key, &ephemeron_pair.value);
155
+ RegisterWeakCallbackMethod<EphemeronPair<K, V>,
156
+ &EphemeronPair<K, V>::ClearValueIfKeyIsDead>(
157
+ &ephemeron_pair);
158
+ }
159
+
160
+ /**
161
+ * Trace method for a single ephemeron. Used for tracing a raw ephemeron in
162
+ * which the `key` and `value` are kept separately.
163
+ *
164
+ * \param weak_member_key WeakMember reference weakly retaining a key object.
165
+ * \param member_value Member reference with ephemeron semantics.
166
+ */
167
+ template <typename KeyType, typename ValueType>
168
+ void TraceEphemeron(const WeakMember<KeyType>& weak_member_key,
169
+ const Member<ValueType>* member_value) {
170
+ const KeyType* key = weak_member_key.GetRawAtomic();
171
+ if (!key) return;
172
+
173
+ // `value` must always be non-null.
174
+ CPPGC_DCHECK(member_value);
175
+ const ValueType* value = member_value->GetRawAtomic();
176
+ if (!value) return;
177
+
178
+ // KeyType and ValueType may refer to GarbageCollectedMixin.
179
+ TraceDescriptor value_desc =
180
+ TraceTrait<ValueType>::GetTraceDescriptor(value);
181
+ CPPGC_DCHECK(value_desc.base_object_payload);
182
+ const void* key_base_object_payload =
183
+ TraceTrait<KeyType>::GetTraceDescriptor(key).base_object_payload;
184
+ CPPGC_DCHECK(key_base_object_payload);
185
+
186
+ VisitEphemeron(key_base_object_payload, value, value_desc);
187
+ }
188
+
189
+ /**
190
+ * Trace method for a single ephemeron. Used for tracing a raw ephemeron in
191
+ * which the `key` and `value` are kept separately. Note that this overload
192
+ * is for non-GarbageCollected `value`s that can be traced though.
193
+ *
194
+ * \param key `WeakMember` reference weakly retaining a key object.
195
+ * \param value Reference weakly retaining a value object. Note that
196
+ * `ValueType` here should not be `Member`. It is expected that
197
+ * `TraceTrait<ValueType>::GetTraceDescriptor(value)` returns a
198
+ * `TraceDescriptor` with a null base pointer but a valid trace method.
199
+ */
200
+ template <typename KeyType, typename ValueType>
201
+ void TraceEphemeron(const WeakMember<KeyType>& weak_member_key,
202
+ const ValueType* value) {
203
+ static_assert(!IsGarbageCollectedOrMixinTypeV<ValueType>,
204
+ "garbage-collected types must use WeakMember and Member");
205
+ const KeyType* key = weak_member_key.GetRawAtomic();
206
+ if (!key) return;
207
+
208
+ // `value` must always be non-null.
209
+ CPPGC_DCHECK(value);
210
+ TraceDescriptor value_desc =
211
+ TraceTrait<ValueType>::GetTraceDescriptor(value);
212
+ // `value_desc.base_object_payload` must be null as this override is only
213
+ // taken for non-garbage-collected values.
214
+ CPPGC_DCHECK(!value_desc.base_object_payload);
215
+
216
+ // KeyType might be a GarbageCollectedMixin.
217
+ const void* key_base_object_payload =
218
+ TraceTrait<KeyType>::GetTraceDescriptor(key).base_object_payload;
219
+ CPPGC_DCHECK(key_base_object_payload);
220
+
221
+ VisitEphemeron(key_base_object_payload, value, value_desc);
222
+ }
223
+
224
+ /**
225
+ * Trace method that strongifies a WeakMember.
226
+ *
227
+ * \param weak_member WeakMember reference retaining an object.
228
+ */
229
+ template <typename T>
230
+ void TraceStrongly(const WeakMember<T>& weak_member) {
231
+ const T* value = weak_member.GetRawAtomic();
232
+ CPPGC_DCHECK(value != kSentinelPointer);
233
+ Trace(value);
234
+ }
235
+
236
+ /**
237
+ * Trace method for weak containers.
238
+ *
239
+ * \param object reference of the weak container.
240
+ * \param callback to be invoked.
241
+ * \param data custom data that is passed to the callback.
242
+ */
243
+ template <typename T>
244
+ void TraceWeakContainer(const T* object, WeakCallback callback,
245
+ const void* data) {
246
+ if (!object) return;
247
+ VisitWeakContainer(object, TraceTrait<T>::GetTraceDescriptor(object),
248
+ TraceTrait<T>::GetWeakTraceDescriptor(object), callback,
249
+ data);
250
+ }
251
+
252
+ /**
253
+ * Registers a slot containing a reference to an object allocated on a
254
+ * compactable space. Such references maybe be arbitrarily moved by the GC.
255
+ *
256
+ * \param slot location of reference to object that might be moved by the GC.
257
+ */
258
+ template <typename T>
259
+ void RegisterMovableReference(const T** slot) {
260
+ static_assert(internal::IsAllocatedOnCompactableSpace<T>::value,
261
+ "Only references to objects allocated on compactable spaces "
262
+ "should be registered as movable slots.");
263
+ static_assert(!IsGarbageCollectedMixinTypeV<T>,
264
+ "Mixin types do not support compaction.");
265
+ HandleMovableReference(reinterpret_cast<const void**>(slot));
266
+ }
267
+
268
+ /**
269
+ * Registers a weak callback that is invoked during garbage collection.
270
+ *
271
+ * \param callback to be invoked.
272
+ * \param data custom data that is passed to the callback.
273
+ */
274
+ virtual void RegisterWeakCallback(WeakCallback callback, const void* data) {}
275
+
276
+ /**
277
+ * Defers tracing an object from a concurrent thread to the mutator thread.
278
+ * Should be called by Trace methods of types that are not safe to trace
279
+ * concurrently.
280
+ *
281
+ * \param parameter tells the trace callback which object was deferred.
282
+ * \param callback to be invoked for tracing on the mutator thread.
283
+ * \param deferred_size size of deferred object.
284
+ *
285
+ * \returns false if the object does not need to be deferred (i.e. currently
286
+ * traced on the mutator thread) and true otherwise (i.e. currently traced on
287
+ * a concurrent thread).
288
+ */
289
+ virtual V8_WARN_UNUSED_RESULT bool DeferTraceToMutatorThreadIfConcurrent(
290
+ const void* parameter, TraceCallback callback, size_t deferred_size) {
291
+ // By default tracing is not deferred.
292
+ return false;
293
+ }
294
+
295
+ protected:
296
+ virtual void Visit(const void* self, TraceDescriptor) {}
297
+ virtual void VisitWeak(const void* self, TraceDescriptor, WeakCallback,
298
+ const void* weak_member) {}
299
+ virtual void VisitRoot(const void*, TraceDescriptor, const SourceLocation&) {}
300
+ virtual void VisitWeakRoot(const void* self, TraceDescriptor, WeakCallback,
301
+ const void* weak_root, const SourceLocation&) {}
302
+ virtual void VisitEphemeron(const void* key, const void* value,
303
+ TraceDescriptor value_desc) {}
304
+ virtual void VisitWeakContainer(const void* self, TraceDescriptor strong_desc,
305
+ TraceDescriptor weak_desc,
306
+ WeakCallback callback, const void* data) {}
307
+ virtual void HandleMovableReference(const void**) {}
308
+
309
+ private:
310
+ template <typename T, void (T::*method)(const LivenessBroker&)>
311
+ static void WeakCallbackMethodDelegate(const LivenessBroker& info,
312
+ const void* self) {
313
+ // Callback is registered through a potential const Trace method but needs
314
+ // to be able to modify fields. See HandleWeak.
315
+ (const_cast<T*>(static_cast<const T*>(self))->*method)(info);
316
+ }
317
+
318
+ template <typename PointerType>
319
+ static void HandleWeak(const LivenessBroker& info, const void* object) {
320
+ const PointerType* weak = static_cast<const PointerType*>(object);
321
+ // Sentinel values are preserved for weak pointers.
322
+ if (*weak == kSentinelPointer) return;
323
+ const auto* raw = weak->Get();
324
+ if (!info.IsHeapObjectAlive(raw)) {
325
+ weak->ClearFromGC();
326
+ }
327
+ }
328
+
329
+ template <typename Persistent,
330
+ std::enable_if_t<Persistent::IsStrongPersistent::value>* = nullptr>
331
+ void TraceRoot(const Persistent& p, const SourceLocation& loc) {
332
+ using PointeeType = typename Persistent::PointeeType;
333
+ static_assert(sizeof(PointeeType),
334
+ "Persistent's pointee type must be fully defined");
335
+ static_assert(internal::IsGarbageCollectedOrMixinType<PointeeType>::value,
336
+ "Persistent's pointee type must be GarbageCollected or "
337
+ "GarbageCollectedMixin");
338
+ if (!p.Get()) {
339
+ return;
340
+ }
341
+ VisitRoot(p.Get(), TraceTrait<PointeeType>::GetTraceDescriptor(p.Get()),
342
+ loc);
343
+ }
344
+
345
+ template <
346
+ typename WeakPersistent,
347
+ std::enable_if_t<!WeakPersistent::IsStrongPersistent::value>* = nullptr>
348
+ void TraceRoot(const WeakPersistent& p, const SourceLocation& loc) {
349
+ using PointeeType = typename WeakPersistent::PointeeType;
350
+ static_assert(sizeof(PointeeType),
351
+ "Persistent's pointee type must be fully defined");
352
+ static_assert(internal::IsGarbageCollectedOrMixinType<PointeeType>::value,
353
+ "Persistent's pointee type must be GarbageCollected or "
354
+ "GarbageCollectedMixin");
355
+ static_assert(!internal::IsAllocatedOnCompactableSpace<PointeeType>::value,
356
+ "Weak references to compactable objects are not allowed");
357
+ VisitWeakRoot(p.Get(), TraceTrait<PointeeType>::GetTraceDescriptor(p.Get()),
358
+ &HandleWeak<WeakPersistent>, &p, loc);
359
+ }
360
+
361
+ #if V8_ENABLE_CHECKS
362
+ void CheckObjectNotInConstruction(const void* address);
363
+ #endif // V8_ENABLE_CHECKS
364
+
365
+ template <typename T, typename WeaknessPolicy, typename LocationPolicy,
366
+ typename CheckingPolicy>
367
+ friend class internal::BasicCrossThreadPersistent;
368
+ template <typename T, typename WeaknessPolicy, typename LocationPolicy,
369
+ typename CheckingPolicy>
370
+ friend class internal::BasicPersistent;
371
+ friend class internal::ConservativeTracingVisitor;
372
+ friend class internal::VisitorBase;
373
+ };
374
+
375
+ } // namespace cppgc
376
+
377
+ #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,117 @@
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
+ * The same as NewDefaultPlatform but disables the worker thread pool.
48
+ * It must be used with the --single-threaded V8 flag.
49
+ */
50
+ V8_PLATFORM_EXPORT std::unique_ptr<v8::Platform>
51
+ NewSingleThreadedDefaultPlatform(
52
+ IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled,
53
+ InProcessStackDumping in_process_stack_dumping =
54
+ InProcessStackDumping::kDisabled,
55
+ std::unique_ptr<v8::TracingController> tracing_controller = {});
56
+
57
+ /**
58
+ * Returns a new instance of the default v8::JobHandle implementation.
59
+ *
60
+ * The job will be executed by spawning up to |num_worker_threads| many worker
61
+ * threads on the provided |platform| with the given |priority|.
62
+ */
63
+ V8_PLATFORM_EXPORT std::unique_ptr<v8::JobHandle> NewDefaultJobHandle(
64
+ v8::Platform* platform, v8::TaskPriority priority,
65
+ std::unique_ptr<v8::JobTask> job_task, size_t num_worker_threads);
66
+
67
+ /**
68
+ * Pumps the message loop for the given isolate.
69
+ *
70
+ * The caller has to make sure that this is called from the right thread.
71
+ * Returns true if a task was executed, and false otherwise. If the call to
72
+ * PumpMessageLoop is nested within another call to PumpMessageLoop, only
73
+ * nestable tasks may run. Otherwise, any task may run. Unless requested through
74
+ * the |behavior| parameter, this call does not block if no task is pending. The
75
+ * |platform| has to be created using |NewDefaultPlatform|.
76
+ */
77
+ V8_PLATFORM_EXPORT bool PumpMessageLoop(
78
+ v8::Platform* platform, v8::Isolate* isolate,
79
+ MessageLoopBehavior behavior = MessageLoopBehavior::kDoNotWait);
80
+
81
+ /**
82
+ * Runs pending idle tasks for at most |idle_time_in_seconds| seconds.
83
+ *
84
+ * The caller has to make sure that this is called from the right thread.
85
+ * This call does not block if no task is pending. The |platform| has to be
86
+ * created using |NewDefaultPlatform|.
87
+ */
88
+ V8_PLATFORM_EXPORT void RunIdleTasks(v8::Platform* platform,
89
+ v8::Isolate* isolate,
90
+ double idle_time_in_seconds);
91
+
92
+ /**
93
+ * Attempts to set the tracing controller for the given platform.
94
+ *
95
+ * The |platform| has to be created using |NewDefaultPlatform|.
96
+ *
97
+ */
98
+ V8_DEPRECATE_SOON("Access the DefaultPlatform directly")
99
+ V8_PLATFORM_EXPORT void SetTracingController(
100
+ v8::Platform* platform,
101
+ v8::platform::tracing::TracingController* tracing_controller);
102
+
103
+ /**
104
+ * Notifies the given platform about the Isolate getting deleted soon. Has to be
105
+ * called for all Isolates which are deleted - unless we're shutting down the
106
+ * platform.
107
+ *
108
+ * The |platform| has to be created using |NewDefaultPlatform|.
109
+ *
110
+ */
111
+ V8_PLATFORM_EXPORT void NotifyIsolateShutdown(v8::Platform* platform,
112
+ Isolate* isolate);
113
+
114
+ } // namespace platform
115
+ } // namespace v8
116
+
117
+ #endif // V8_LIBPLATFORM_LIBPLATFORM_H_