libv8-node 17.9.1.0-x86_64-linux → 18.13.0.0-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/libv8-node/paths.rb +1 -1
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/include/cppgc/allocation.h +88 -17
- data/vendor/v8/include/cppgc/default-platform.h +2 -10
- data/vendor/v8/include/cppgc/explicit-management.h +22 -4
- data/vendor/v8/include/cppgc/garbage-collected.h +15 -26
- data/vendor/v8/include/cppgc/heap-consistency.h +13 -0
- data/vendor/v8/include/cppgc/heap-state.h +12 -0
- data/vendor/v8/include/cppgc/heap.h +7 -2
- data/vendor/v8/include/cppgc/internal/api-constants.h +8 -0
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +23 -12
- data/vendor/v8/include/cppgc/internal/finalizer-trait.h +2 -1
- data/vendor/v8/include/cppgc/internal/logging.h +3 -3
- data/vendor/v8/include/cppgc/internal/persistent-node.h +39 -27
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +4 -4
- data/vendor/v8/include/cppgc/internal/write-barrier.h +26 -32
- data/vendor/v8/include/cppgc/member.h +5 -2
- data/vendor/v8/include/cppgc/persistent.h +30 -31
- data/vendor/v8/include/cppgc/platform.h +3 -1
- data/vendor/v8/include/cppgc/prefinalizer.h +34 -11
- data/vendor/v8/include/cppgc/testing.h +9 -2
- data/vendor/v8/include/cppgc/type-traits.h +6 -13
- data/vendor/v8/include/libplatform/libplatform.h +0 -11
- data/vendor/v8/include/libplatform/v8-tracing.h +0 -1
- data/vendor/v8/include/v8-array-buffer.h +22 -2
- data/vendor/v8/include/v8-callbacks.h +26 -6
- data/vendor/v8/include/v8-context.h +3 -14
- data/vendor/v8/include/v8-cppgc.h +16 -126
- data/vendor/v8/include/v8-data.h +15 -0
- data/vendor/v8/include/v8-debug.h +21 -4
- data/vendor/v8/include/v8-embedder-heap.h +10 -30
- data/vendor/v8/include/v8-embedder-state-scope.h +51 -0
- data/vendor/v8/include/v8-exception.h +0 -7
- data/vendor/v8/include/v8-fast-api-calls.h +82 -31
- data/vendor/v8/include/v8-function.h +3 -0
- data/vendor/v8/include/v8-initialization.h +64 -31
- data/vendor/v8/include/v8-inspector.h +45 -4
- data/vendor/v8/include/v8-internal.h +189 -102
- data/vendor/v8/include/v8-isolate.h +49 -2
- data/vendor/v8/include/v8-local-handle.h +0 -4
- data/vendor/v8/include/v8-locker.h +2 -1
- data/vendor/v8/include/v8-message.h +19 -44
- data/vendor/v8/include/v8-metrics.h +32 -15
- data/vendor/v8/include/v8-object.h +11 -6
- data/vendor/v8/include/v8-platform.h +365 -6
- data/vendor/v8/include/v8-primitive.h +14 -6
- data/vendor/v8/include/v8-profiler.h +78 -2
- data/vendor/v8/include/v8-script.h +27 -51
- data/vendor/v8/include/v8-snapshot.h +0 -2
- data/vendor/v8/include/v8-statistics.h +2 -0
- data/vendor/v8/include/v8-template.h +31 -4
- data/vendor/v8/include/v8-traced-handle.h +39 -224
- data/vendor/v8/include/v8-unwinder.h +10 -7
- data/vendor/v8/include/v8-value-serializer-version.h +1 -1
- data/vendor/v8/include/v8-value-serializer.h +32 -2
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8-wasm.h +13 -1
- data/vendor/v8/include/v8-weak-callback-info.h +20 -6
- data/vendor/v8/include/v8.h +0 -1
- data/vendor/v8/include/v8config.h +56 -11
- data/vendor/v8/x86_64-linux/libv8/obj/libv8_monolith.a +0 -0
- metadata +3 -3
- data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +0 -30
@@ -92,19 +92,19 @@ class DisabledCheckingPolicy {
|
|
92
92
|
void CheckPointer(const void*) {}
|
93
93
|
};
|
94
94
|
|
95
|
-
#
|
95
|
+
#ifdef DEBUG
|
96
96
|
// Off heap members are not connected to object graph and thus cannot ressurect
|
97
97
|
// dead objects.
|
98
98
|
using DefaultMemberCheckingPolicy =
|
99
99
|
SameThreadEnabledCheckingPolicy<false /* kCheckOffHeapAssignments*/>;
|
100
100
|
using DefaultPersistentCheckingPolicy =
|
101
101
|
SameThreadEnabledCheckingPolicy<true /* kCheckOffHeapAssignments*/>;
|
102
|
-
#else
|
102
|
+
#else // !DEBUG
|
103
103
|
using DefaultMemberCheckingPolicy = DisabledCheckingPolicy;
|
104
104
|
using DefaultPersistentCheckingPolicy = DisabledCheckingPolicy;
|
105
|
-
#endif
|
105
|
+
#endif // !DEBUG
|
106
106
|
// For CT(W)P neither marking information (for value), nor objectstart bitmap
|
107
|
-
// (for slot) are guaranteed to be present because there's no
|
107
|
+
// (for slot) are guaranteed to be present because there's no synchronization
|
108
108
|
// between heaps after marking.
|
109
109
|
using DefaultCrossThreadPersistentCheckingPolicy = DisabledCheckingPolicy;
|
110
110
|
|
@@ -70,10 +70,6 @@ class V8_EXPORT WriteBarrier final {
|
|
70
70
|
// Returns the required write barrier for a given `value`.
|
71
71
|
static V8_INLINE Type GetWriteBarrierType(const void* value, Params& params);
|
72
72
|
|
73
|
-
template <typename HeapHandleCallback>
|
74
|
-
static V8_INLINE Type GetWriteBarrierTypeForExternallyReferencedObject(
|
75
|
-
const void* value, Params& params, HeapHandleCallback callback);
|
76
|
-
|
77
73
|
static V8_INLINE void DijkstraMarkingBarrier(const Params& params,
|
78
74
|
const void* object);
|
79
75
|
static V8_INLINE void DijkstraMarkingBarrierRange(
|
@@ -84,9 +80,13 @@ class V8_EXPORT WriteBarrier final {
|
|
84
80
|
#if defined(CPPGC_YOUNG_GENERATION)
|
85
81
|
static V8_INLINE void GenerationalBarrier(const Params& params,
|
86
82
|
const void* slot);
|
87
|
-
|
83
|
+
static V8_INLINE void GenerationalBarrierForSourceObject(
|
84
|
+
const Params& params, const void* inner_pointer);
|
85
|
+
#else // !CPPGC_YOUNG_GENERATION
|
88
86
|
static V8_INLINE void GenerationalBarrier(const Params& params,
|
89
87
|
const void* slot) {}
|
88
|
+
static V8_INLINE void GenerationalBarrierForSourceObject(
|
89
|
+
const Params& params, const void* inner_pointer) {}
|
90
90
|
#endif // CPPGC_YOUNG_GENERATION
|
91
91
|
|
92
92
|
#if V8_ENABLE_CHECKS
|
@@ -124,8 +124,10 @@ class V8_EXPORT WriteBarrier final {
|
|
124
124
|
#if defined(CPPGC_YOUNG_GENERATION)
|
125
125
|
static CagedHeapLocalData& GetLocalData(HeapHandle&);
|
126
126
|
static void GenerationalBarrierSlow(const CagedHeapLocalData& local_data,
|
127
|
-
const AgeTable&
|
127
|
+
const AgeTable& age_table,
|
128
128
|
const void* slot, uintptr_t value_offset);
|
129
|
+
static void GenerationalBarrierForSourceObjectSlow(
|
130
|
+
const CagedHeapLocalData& local_data, const void* object);
|
129
131
|
#endif // CPPGC_YOUNG_GENERATION
|
130
132
|
|
131
133
|
static AtomicEntryFlag incremental_or_concurrent_marking_flag_;
|
@@ -157,13 +159,6 @@ class V8_EXPORT WriteBarrierTypeForCagedHeapPolicy final {
|
|
157
159
|
return GetNoSlot(value, params, callback);
|
158
160
|
}
|
159
161
|
|
160
|
-
template <typename HeapHandleCallback>
|
161
|
-
static V8_INLINE WriteBarrier::Type GetForExternallyReferenced(
|
162
|
-
const void* value, WriteBarrier::Params& params,
|
163
|
-
HeapHandleCallback callback) {
|
164
|
-
return GetNoSlot(value, params, callback);
|
165
|
-
}
|
166
|
-
|
167
162
|
private:
|
168
163
|
WriteBarrierTypeForCagedHeapPolicy() = delete;
|
169
164
|
|
@@ -292,15 +287,6 @@ class V8_EXPORT WriteBarrierTypeForNonCagedHeapPolicy final {
|
|
292
287
|
callback);
|
293
288
|
}
|
294
289
|
|
295
|
-
template <typename HeapHandleCallback>
|
296
|
-
static V8_INLINE WriteBarrier::Type GetForExternallyReferenced(
|
297
|
-
const void* value, WriteBarrier::Params& params,
|
298
|
-
HeapHandleCallback callback) {
|
299
|
-
// The slot will never be used in `Get()` below.
|
300
|
-
return Get<WriteBarrier::ValueMode::kValuePresent>(nullptr, value, params,
|
301
|
-
callback);
|
302
|
-
}
|
303
|
-
|
304
290
|
private:
|
305
291
|
template <WriteBarrier::ValueMode value_mode>
|
306
292
|
struct ValueModeDispatch;
|
@@ -375,15 +361,6 @@ WriteBarrier::Type WriteBarrier::GetWriteBarrierType(
|
|
375
361
|
[]() {});
|
376
362
|
}
|
377
363
|
|
378
|
-
// static
|
379
|
-
template <typename HeapHandleCallback>
|
380
|
-
WriteBarrier::Type
|
381
|
-
WriteBarrier::GetWriteBarrierTypeForExternallyReferencedObject(
|
382
|
-
const void* value, Params& params, HeapHandleCallback callback) {
|
383
|
-
return WriteBarrierTypePolicy::GetForExternallyReferenced(value, params,
|
384
|
-
callback);
|
385
|
-
}
|
386
|
-
|
387
364
|
// static
|
388
365
|
void WriteBarrier::DijkstraMarkingBarrier(const Params& params,
|
389
366
|
const void* object) {
|
@@ -428,11 +405,28 @@ void WriteBarrier::GenerationalBarrier(const Params& params, const void* slot) {
|
|
428
405
|
const AgeTable& age_table = local_data.age_table;
|
429
406
|
|
430
407
|
// Bail out if the slot is in young generation.
|
431
|
-
if (V8_LIKELY(age_table
|
408
|
+
if (V8_LIKELY(age_table.GetAge(params.slot_offset) == AgeTable::Age::kYoung))
|
409
|
+
return;
|
432
410
|
|
433
411
|
GenerationalBarrierSlow(local_data, age_table, slot, params.value_offset);
|
434
412
|
}
|
435
413
|
|
414
|
+
// static
|
415
|
+
void WriteBarrier::GenerationalBarrierForSourceObject(
|
416
|
+
const Params& params, const void* inner_pointer) {
|
417
|
+
CheckParams(Type::kGenerational, params);
|
418
|
+
|
419
|
+
const CagedHeapLocalData& local_data = params.caged_heap();
|
420
|
+
const AgeTable& age_table = local_data.age_table;
|
421
|
+
|
422
|
+
// Assume that if the first element is in young generation, the whole range is
|
423
|
+
// in young generation.
|
424
|
+
if (V8_LIKELY(age_table.GetAge(params.slot_offset) == AgeTable::Age::kYoung))
|
425
|
+
return;
|
426
|
+
|
427
|
+
GenerationalBarrierForSourceObjectSlow(local_data, inner_pointer);
|
428
|
+
}
|
429
|
+
|
436
430
|
#endif // !CPPGC_YOUNG_GENERATION
|
437
431
|
|
438
432
|
} // namespace internal
|
@@ -26,7 +26,7 @@ class MemberBase {
|
|
26
26
|
protected:
|
27
27
|
struct AtomicInitializerTag {};
|
28
28
|
|
29
|
-
MemberBase()
|
29
|
+
MemberBase() : raw_(nullptr) {}
|
30
30
|
explicit MemberBase(const void* value) : raw_(value) {}
|
31
31
|
MemberBase(const void* value, AtomicInitializerTag) { SetRawAtomic(value); }
|
32
32
|
|
@@ -46,7 +46,10 @@ class MemberBase {
|
|
46
46
|
void ClearFromGC() const { raw_ = nullptr; }
|
47
47
|
|
48
48
|
private:
|
49
|
-
|
49
|
+
// All constructors initialize `raw_`. Do not add a default value here as it
|
50
|
+
// results in a non-atomic write on some builds, even when the atomic version
|
51
|
+
// of the constructor is used.
|
52
|
+
mutable const void* raw_;
|
50
53
|
};
|
51
54
|
|
52
55
|
// The basic class from which all Member classes are 'generated'.
|
@@ -118,10 +118,10 @@ class BasicPersistent final : public PersistentBase,
|
|
118
118
|
template <typename U, typename MemberBarrierPolicy,
|
119
119
|
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
120
120
|
typename = std::enable_if_t<std::is_base_of<T, U>::value>>
|
121
|
-
BasicPersistent(
|
122
|
-
|
123
|
-
|
124
|
-
|
121
|
+
BasicPersistent(
|
122
|
+
const internal::BasicMember<U, MemberBarrierPolicy, MemberWeaknessTag,
|
123
|
+
MemberCheckingPolicy>& member,
|
124
|
+
const SourceLocation& loc = SourceLocation::Current())
|
125
125
|
: BasicPersistent(member.Get(), loc) {}
|
126
126
|
|
127
127
|
~BasicPersistent() { Clear(); }
|
@@ -159,9 +159,8 @@ class BasicPersistent final : public PersistentBase,
|
|
159
159
|
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
160
160
|
typename = std::enable_if_t<std::is_base_of<T, U>::value>>
|
161
161
|
BasicPersistent& operator=(
|
162
|
-
internal::BasicMember<U, MemberBarrierPolicy, MemberWeaknessTag,
|
163
|
-
|
164
|
-
member) {
|
162
|
+
const internal::BasicMember<U, MemberBarrierPolicy, MemberWeaknessTag,
|
163
|
+
MemberCheckingPolicy>& member) {
|
165
164
|
return operator=(member.Get());
|
166
165
|
}
|
167
166
|
|
@@ -292,12 +291,12 @@ template <typename T1, typename PersistentWeaknessPolicy,
|
|
292
291
|
typename PersistentLocationPolicy, typename PersistentCheckingPolicy,
|
293
292
|
typename T2, typename MemberWriteBarrierPolicy,
|
294
293
|
typename MemberWeaknessTag, typename MemberCheckingPolicy>
|
295
|
-
bool operator==(
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
294
|
+
bool operator==(
|
295
|
+
const BasicPersistent<T1, PersistentWeaknessPolicy,
|
296
|
+
PersistentLocationPolicy, PersistentCheckingPolicy>&
|
297
|
+
p,
|
298
|
+
const BasicMember<T2, MemberWeaknessTag, MemberWriteBarrierPolicy,
|
299
|
+
MemberCheckingPolicy>& m) {
|
301
300
|
return p.Get() == m.Get();
|
302
301
|
}
|
303
302
|
|
@@ -305,12 +304,12 @@ template <typename T1, typename PersistentWeaknessPolicy,
|
|
305
304
|
typename PersistentLocationPolicy, typename PersistentCheckingPolicy,
|
306
305
|
typename T2, typename MemberWriteBarrierPolicy,
|
307
306
|
typename MemberWeaknessTag, typename MemberCheckingPolicy>
|
308
|
-
bool operator!=(
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
307
|
+
bool operator!=(
|
308
|
+
const BasicPersistent<T1, PersistentWeaknessPolicy,
|
309
|
+
PersistentLocationPolicy, PersistentCheckingPolicy>&
|
310
|
+
p,
|
311
|
+
const BasicMember<T2, MemberWeaknessTag, MemberWriteBarrierPolicy,
|
312
|
+
MemberCheckingPolicy>& m) {
|
314
313
|
return !(p == m);
|
315
314
|
}
|
316
315
|
|
@@ -318,12 +317,12 @@ template <typename T1, typename MemberWriteBarrierPolicy,
|
|
318
317
|
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
319
318
|
typename T2, typename PersistentWeaknessPolicy,
|
320
319
|
typename PersistentLocationPolicy, typename PersistentCheckingPolicy>
|
321
|
-
bool operator==(
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
320
|
+
bool operator==(
|
321
|
+
const BasicMember<T2, MemberWeaknessTag, MemberWriteBarrierPolicy,
|
322
|
+
MemberCheckingPolicy>& m,
|
323
|
+
const BasicPersistent<T1, PersistentWeaknessPolicy,
|
324
|
+
PersistentLocationPolicy, PersistentCheckingPolicy>&
|
325
|
+
p) {
|
327
326
|
return m.Get() == p.Get();
|
328
327
|
}
|
329
328
|
|
@@ -331,12 +330,12 @@ template <typename T1, typename MemberWriteBarrierPolicy,
|
|
331
330
|
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
332
331
|
typename T2, typename PersistentWeaknessPolicy,
|
333
332
|
typename PersistentLocationPolicy, typename PersistentCheckingPolicy>
|
334
|
-
bool operator!=(
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
333
|
+
bool operator!=(
|
334
|
+
const BasicMember<T2, MemberWeaknessTag, MemberWriteBarrierPolicy,
|
335
|
+
MemberCheckingPolicy>& m,
|
336
|
+
const BasicPersistent<T1, PersistentWeaknessPolicy,
|
337
|
+
PersistentLocationPolicy, PersistentCheckingPolicy>&
|
338
|
+
p) {
|
340
339
|
return !(m == p);
|
341
340
|
}
|
342
341
|
|
@@ -7,6 +7,7 @@
|
|
7
7
|
|
8
8
|
#include <memory>
|
9
9
|
|
10
|
+
#include "cppgc/source-location.h"
|
10
11
|
#include "v8-platform.h" // NOLINT(build/include_directory)
|
11
12
|
#include "v8config.h" // NOLINT(build/include_directory)
|
12
13
|
|
@@ -145,7 +146,8 @@ V8_EXPORT void ShutdownProcess();
|
|
145
146
|
|
146
147
|
namespace internal {
|
147
148
|
|
148
|
-
V8_EXPORT void
|
149
|
+
V8_EXPORT void Fatal(const std::string& reason = std::string(),
|
150
|
+
const SourceLocation& = SourceLocation::Current());
|
149
151
|
|
150
152
|
} // namespace internal
|
151
153
|
|
@@ -6,23 +6,17 @@
|
|
6
6
|
#define INCLUDE_CPPGC_PREFINALIZER_H_
|
7
7
|
|
8
8
|
#include "cppgc/internal/compiler-specific.h"
|
9
|
-
#include "cppgc/internal/prefinalizer-handler.h"
|
10
9
|
#include "cppgc/liveness-broker.h"
|
11
10
|
|
12
11
|
namespace cppgc {
|
13
12
|
|
14
13
|
namespace internal {
|
15
14
|
|
16
|
-
|
17
|
-
class PrefinalizerRegistration final {
|
15
|
+
class V8_EXPORT PrefinalizerRegistration final {
|
18
16
|
public:
|
19
|
-
|
20
|
-
static_assert(sizeof(&T::InvokePreFinalizer) > 0,
|
21
|
-
"USING_PRE_FINALIZER(T) must be defined.");
|
17
|
+
using Callback = bool (*)(const cppgc::LivenessBroker&, void*);
|
22
18
|
|
23
|
-
|
24
|
-
{self, T::InvokePreFinalizer});
|
25
|
-
}
|
19
|
+
PrefinalizerRegistration(void*, Callback);
|
26
20
|
|
27
21
|
void* operator new(size_t, void* location) = delete;
|
28
22
|
void* operator new(size_t) = delete;
|
@@ -30,6 +24,35 @@ class PrefinalizerRegistration final {
|
|
30
24
|
|
31
25
|
} // namespace internal
|
32
26
|
|
27
|
+
/**
|
28
|
+
* Macro must be used in the private section of `Class` and registers a
|
29
|
+
* prefinalization callback `void Class::PreFinalizer()`. The callback is
|
30
|
+
* invoked on garbage collection after the collector has found an object to be
|
31
|
+
* dead.
|
32
|
+
*
|
33
|
+
* Callback properties:
|
34
|
+
* - The callback is invoked before a possible destructor for the corresponding
|
35
|
+
* object.
|
36
|
+
* - The callback may access the whole object graph, irrespective of whether
|
37
|
+
* objects are considered dead or alive.
|
38
|
+
* - The callback is invoked on the same thread as the object was created on.
|
39
|
+
*
|
40
|
+
* Example:
|
41
|
+
* \code
|
42
|
+
* class WithPrefinalizer : public GarbageCollected<WithPrefinalizer> {
|
43
|
+
* CPPGC_USING_PRE_FINALIZER(WithPrefinalizer, Dispose);
|
44
|
+
*
|
45
|
+
* public:
|
46
|
+
* void Trace(Visitor*) const {}
|
47
|
+
* void Dispose() { prefinalizer_called = true; }
|
48
|
+
* ~WithPrefinalizer() {
|
49
|
+
* // prefinalizer_called == true
|
50
|
+
* }
|
51
|
+
* private:
|
52
|
+
* bool prefinalizer_called = false;
|
53
|
+
* };
|
54
|
+
* \endcode
|
55
|
+
*/
|
33
56
|
#define CPPGC_USING_PRE_FINALIZER(Class, PreFinalizer) \
|
34
57
|
public: \
|
35
58
|
static bool InvokePreFinalizer(const cppgc::LivenessBroker& liveness_broker, \
|
@@ -43,8 +66,8 @@ class PrefinalizerRegistration final {
|
|
43
66
|
} \
|
44
67
|
\
|
45
68
|
private: \
|
46
|
-
CPPGC_NO_UNIQUE_ADDRESS cppgc::internal::PrefinalizerRegistration
|
47
|
-
prefinalizer_dummy_{this};
|
69
|
+
CPPGC_NO_UNIQUE_ADDRESS cppgc::internal::PrefinalizerRegistration \
|
70
|
+
prefinalizer_dummy_{this, Class::InvokePreFinalizer}; \
|
48
71
|
static_assert(true, "Force semicolon.")
|
49
72
|
|
50
73
|
} // namespace cppgc
|
@@ -19,8 +19,13 @@ class HeapHandle;
|
|
19
19
|
namespace testing {
|
20
20
|
|
21
21
|
/**
|
22
|
-
* Overrides the state of the stack with the provided value.
|
23
|
-
*
|
22
|
+
* Overrides the state of the stack with the provided value. Parameters passed
|
23
|
+
* to explicit garbage collection calls still take precedence. Must not be
|
24
|
+
* nested.
|
25
|
+
*
|
26
|
+
* This scope is useful to make the garbage collector consider the stack when
|
27
|
+
* tasks that invoke garbage collection (through the provided platform) contain
|
28
|
+
* interesting pointers on its stack.
|
24
29
|
*/
|
25
30
|
class V8_EXPORT V8_NODISCARD OverrideEmbedderStackStateScope final {
|
26
31
|
CPPGC_STACK_ALLOCATED();
|
@@ -93,6 +98,8 @@ class V8_EXPORT StandaloneTestingHeap final {
|
|
93
98
|
HeapHandle& heap_handle_;
|
94
99
|
};
|
95
100
|
|
101
|
+
V8_EXPORT bool IsHeapObjectOld(void*);
|
102
|
+
|
96
103
|
} // namespace testing
|
97
104
|
} // namespace cppgc
|
98
105
|
|
@@ -24,14 +24,6 @@ class StrongMemberTag;
|
|
24
24
|
class UntracedMemberTag;
|
25
25
|
class WeakMemberTag;
|
26
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
27
|
// Not supposed to be specialized by the user.
|
36
28
|
template <typename T>
|
37
29
|
struct IsWeak : std::false_type {};
|
@@ -42,7 +34,7 @@ template <typename T, typename = void>
|
|
42
34
|
struct IsTraceMethodConst : std::false_type {};
|
43
35
|
|
44
36
|
template <typename T>
|
45
|
-
struct IsTraceMethodConst<T, void_t<decltype(std::declval<const T>().Trace(
|
37
|
+
struct IsTraceMethodConst<T, std::void_t<decltype(std::declval<const T>().Trace(
|
46
38
|
std::declval<Visitor*>()))>> : std::true_type {
|
47
39
|
};
|
48
40
|
|
@@ -53,7 +45,7 @@ struct IsTraceable : std::false_type {
|
|
53
45
|
|
54
46
|
template <typename T>
|
55
47
|
struct IsTraceable<
|
56
|
-
T, void_t<decltype(std::declval<T>().Trace(std::declval<Visitor*>()))>>
|
48
|
+
T, std::void_t<decltype(std::declval<T>().Trace(std::declval<Visitor*>()))>>
|
57
49
|
: std::true_type {
|
58
50
|
// All Trace methods should be marked as const. If an object of type
|
59
51
|
// 'T' is traceable then any object of type 'const T' should also
|
@@ -72,8 +64,8 @@ struct HasGarbageCollectedMixinTypeMarker : std::false_type {
|
|
72
64
|
|
73
65
|
template <typename T>
|
74
66
|
struct HasGarbageCollectedMixinTypeMarker<
|
75
|
-
T,
|
76
|
-
|
67
|
+
T, std::void_t<
|
68
|
+
typename std::remove_const_t<T>::IsGarbageCollectedMixinTypeMarker>>
|
77
69
|
: std::true_type {
|
78
70
|
static_assert(sizeof(T), "T must be fully defined");
|
79
71
|
};
|
@@ -85,7 +77,8 @@ struct HasGarbageCollectedTypeMarker : std::false_type {
|
|
85
77
|
|
86
78
|
template <typename T>
|
87
79
|
struct HasGarbageCollectedTypeMarker<
|
88
|
-
T,
|
80
|
+
T,
|
81
|
+
std::void_t<typename std::remove_const_t<T>::IsGarbageCollectedTypeMarker>>
|
89
82
|
: std::true_type {
|
90
83
|
static_assert(sizeof(T), "T must be fully defined");
|
91
84
|
};
|
@@ -89,17 +89,6 @@ V8_PLATFORM_EXPORT void RunIdleTasks(v8::Platform* platform,
|
|
89
89
|
v8::Isolate* isolate,
|
90
90
|
double idle_time_in_seconds);
|
91
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
92
|
/**
|
104
93
|
* Notifies the given platform about the Isolate getting deleted soon. Has to be
|
105
94
|
* called for all Isolates which are deleted - unless we're shutting down the
|
@@ -175,8 +175,8 @@ class V8_EXPORT ArrayBuffer : public Object {
|
|
175
175
|
/**
|
176
176
|
* Convenience allocator.
|
177
177
|
*
|
178
|
-
* When the
|
179
|
-
*
|
178
|
+
* When the sandbox is enabled, this allocator will allocate its backing
|
179
|
+
* memory inside the sandbox. Otherwise, it will rely on malloc/free.
|
180
180
|
*
|
181
181
|
* Caller takes ownership, i.e. the returned object needs to be freed using
|
182
182
|
* |delete allocator| once it is no longer in use.
|
@@ -240,6 +240,11 @@ class V8_EXPORT ArrayBuffer : public Object {
|
|
240
240
|
*/
|
241
241
|
bool IsDetachable() const;
|
242
242
|
|
243
|
+
/**
|
244
|
+
* Returns true if this ArrayBuffer has been detached.
|
245
|
+
*/
|
246
|
+
bool WasDetached() const;
|
247
|
+
|
243
248
|
/**
|
244
249
|
* Detaches this ArrayBuffer and all its views (typed arrays).
|
245
250
|
* Detaching sets the byte length of the buffer and all typed arrays to zero,
|
@@ -253,9 +258,18 @@ class V8_EXPORT ArrayBuffer : public Object {
|
|
253
258
|
* pointer coordinates the lifetime management of the internal storage
|
254
259
|
* with any live ArrayBuffers on the heap, even across isolates. The embedder
|
255
260
|
* should not attempt to manage lifetime of the storage through other means.
|
261
|
+
*
|
262
|
+
* The returned shared pointer will not be empty, even if the ArrayBuffer has
|
263
|
+
* been detached. Use |WasDetached| to tell if it has been detached instead.
|
256
264
|
*/
|
257
265
|
std::shared_ptr<BackingStore> GetBackingStore();
|
258
266
|
|
267
|
+
/**
|
268
|
+
* More efficient shortcut for GetBackingStore()->Data(). The returned pointer
|
269
|
+
* is valid as long as the ArrayBuffer is alive.
|
270
|
+
*/
|
271
|
+
void* Data() const;
|
272
|
+
|
259
273
|
V8_INLINE static ArrayBuffer* Cast(Value* value) {
|
260
274
|
#ifdef V8_ENABLE_CHECKS
|
261
275
|
CheckCast(value);
|
@@ -414,6 +428,12 @@ class V8_EXPORT SharedArrayBuffer : public Object {
|
|
414
428
|
*/
|
415
429
|
std::shared_ptr<BackingStore> GetBackingStore();
|
416
430
|
|
431
|
+
/**
|
432
|
+
* More efficient shortcut for GetBackingStore()->Data(). The returned pointer
|
433
|
+
* is valid as long as the ArrayBuffer is alive.
|
434
|
+
*/
|
435
|
+
void* Data() const;
|
436
|
+
|
417
437
|
V8_INLINE static SharedArrayBuffer* Cast(Value* value) {
|
418
438
|
#ifdef V8_ENABLE_CHECKS
|
419
439
|
CheckCast(value);
|
@@ -148,11 +148,13 @@ using JitCodeEventHandler = void (*)(const JitCodeEvent* event);
|
|
148
148
|
*/
|
149
149
|
enum GCType {
|
150
150
|
kGCTypeScavenge = 1 << 0,
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
151
|
+
kGCTypeMinorMarkCompact = 1 << 1,
|
152
|
+
kGCTypeMarkSweepCompact = 1 << 2,
|
153
|
+
kGCTypeIncrementalMarking = 1 << 3,
|
154
|
+
kGCTypeProcessWeakCallbacks = 1 << 4,
|
155
|
+
kGCTypeAll = kGCTypeScavenge | kGCTypeMinorMarkCompact |
|
156
|
+
kGCTypeMarkSweepCompact | kGCTypeIncrementalMarking |
|
157
|
+
kGCTypeProcessWeakCallbacks
|
156
158
|
};
|
157
159
|
|
158
160
|
/**
|
@@ -316,7 +318,7 @@ using SharedArrayBufferConstructorEnabledCallback =
|
|
316
318
|
bool (*)(Local<Context> context);
|
317
319
|
|
318
320
|
/**
|
319
|
-
*
|
321
|
+
* HostImportModuleDynamicallyCallback is called when we
|
320
322
|
* require the embedder to load a module. This is used as part of the dynamic
|
321
323
|
* import syntax.
|
322
324
|
*
|
@@ -346,6 +348,10 @@ using HostImportModuleDynamicallyWithImportAssertionsCallback =
|
|
346
348
|
Local<ScriptOrModule> referrer,
|
347
349
|
Local<String> specifier,
|
348
350
|
Local<FixedArray> import_assertions);
|
351
|
+
using HostImportModuleDynamicallyCallback = MaybeLocal<Promise> (*)(
|
352
|
+
Local<Context> context, Local<Data> host_defined_options,
|
353
|
+
Local<Value> resource_name, Local<String> specifier,
|
354
|
+
Local<FixedArray> import_assertions);
|
349
355
|
|
350
356
|
/**
|
351
357
|
* HostInitializeImportMetaObjectCallback is called the first time import.meta
|
@@ -361,6 +367,20 @@ using HostInitializeImportMetaObjectCallback = void (*)(Local<Context> context,
|
|
361
367
|
Local<Module> module,
|
362
368
|
Local<Object> meta);
|
363
369
|
|
370
|
+
/**
|
371
|
+
* HostCreateShadowRealmContextCallback is called each time a ShadowRealm is
|
372
|
+
* being constructed in the initiator_context.
|
373
|
+
*
|
374
|
+
* The method combines Context creation and implementation defined abstract
|
375
|
+
* operation HostInitializeShadowRealm into one.
|
376
|
+
*
|
377
|
+
* The embedder should use v8::Context::New or v8::Context:NewFromSnapshot to
|
378
|
+
* create a new context. If the creation fails, the embedder must propagate
|
379
|
+
* that exception by returning an empty MaybeLocal.
|
380
|
+
*/
|
381
|
+
using HostCreateShadowRealmContextCallback =
|
382
|
+
MaybeLocal<Context> (*)(Local<Context> initiator_context);
|
383
|
+
|
364
384
|
/**
|
365
385
|
* PrepareStackTraceCallback is called when the stack property of an error is
|
366
386
|
* first accessed. The return value will be used as the stack value. If this
|
@@ -313,17 +313,6 @@ class V8_EXPORT Context : public Data {
|
|
313
313
|
explicit BackupIncumbentScope(Local<Context> backup_incumbent_context);
|
314
314
|
~BackupIncumbentScope();
|
315
315
|
|
316
|
-
/**
|
317
|
-
* Returns address that is comparable with JS stack address. Note that JS
|
318
|
-
* stack may be allocated separately from the native stack. See also
|
319
|
-
* |TryCatch::JSStackComparableAddressPrivate| for details.
|
320
|
-
*/
|
321
|
-
V8_DEPRECATE_SOON(
|
322
|
-
"This is private V8 information that should not be exposed in the API.")
|
323
|
-
uintptr_t JSStackComparableAddress() const {
|
324
|
-
return JSStackComparableAddressPrivate();
|
325
|
-
}
|
326
|
-
|
327
316
|
private:
|
328
317
|
friend class internal::Isolate;
|
329
318
|
|
@@ -379,7 +368,7 @@ Local<Value> Context::GetEmbedderData(int index) {
|
|
379
368
|
}
|
380
369
|
|
381
370
|
void* Context::GetAlignedPointerFromEmbedderData(int index) {
|
382
|
-
#
|
371
|
+
#if !defined(V8_ENABLE_CHECKS)
|
383
372
|
using A = internal::Address;
|
384
373
|
using I = internal::Internals;
|
385
374
|
A ctx = *reinterpret_cast<const A*>(this);
|
@@ -387,10 +376,10 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) {
|
|
387
376
|
I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
|
388
377
|
int value_offset =
|
389
378
|
I::kEmbedderDataArrayHeaderSize + (I::kEmbedderDataSlotSize * index);
|
390
|
-
#ifdef
|
379
|
+
#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
|
391
380
|
value_offset += I::kEmbedderDataSlotRawPayloadOffset;
|
392
381
|
#endif
|
393
|
-
internal::Isolate* isolate = I::
|
382
|
+
internal::Isolate* isolate = I::GetIsolateForSandbox(ctx);
|
394
383
|
return reinterpret_cast<void*>(
|
395
384
|
I::ReadExternalPointerField(isolate, embedder_data, value_offset,
|
396
385
|
internal::kEmbedderDataSlotPayloadTag));
|