libv8-node 20.12.1.0-arm64-darwin → 22.5.1.0-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/arm64-darwin/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +24 -5
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +16 -6
- data/vendor/v8/include/cppgc/internal/caged-heap.h +12 -5
- data/vendor/v8/include/cppgc/internal/gc-info.h +82 -91
- data/vendor/v8/include/cppgc/internal/member-storage.h +16 -8
- data/vendor/v8/include/cppgc/member.h +25 -0
- data/vendor/v8/include/cppgc/persistent.h +4 -0
- data/vendor/v8/include/cppgc/platform.h +6 -1
- data/vendor/v8/include/cppgc/sentinel-pointer.h +7 -0
- data/vendor/v8/include/cppgc/source-location.h +2 -78
- data/vendor/v8/include/cppgc/trace-trait.h +8 -0
- data/vendor/v8/include/cppgc/type-traits.h +25 -4
- data/vendor/v8/include/cppgc/visitor.h +82 -4
- data/vendor/v8/include/libplatform/libplatform.h +7 -1
- data/vendor/v8/include/v8-array-buffer.h +6 -0
- data/vendor/v8/include/v8-callbacks.h +57 -19
- data/vendor/v8/include/v8-container.h +54 -0
- data/vendor/v8/include/v8-context.h +58 -32
- data/vendor/v8/include/v8-embedder-heap.h +31 -3
- data/vendor/v8/include/v8-embedder-state-scope.h +2 -1
- data/vendor/v8/include/v8-exception.h +15 -9
- data/vendor/v8/include/v8-fast-api-calls.h +58 -31
- data/vendor/v8/include/v8-forward.h +1 -0
- data/vendor/v8/include/v8-function-callback.h +135 -30
- data/vendor/v8/include/v8-function.h +6 -0
- data/vendor/v8/include/v8-handle-base.h +137 -0
- data/vendor/v8/include/v8-inspector.h +35 -13
- data/vendor/v8/include/v8-internal.h +510 -71
- data/vendor/v8/include/v8-isolate.h +176 -100
- data/vendor/v8/include/v8-local-handle.h +383 -112
- data/vendor/v8/include/v8-memory-span.h +157 -2
- data/vendor/v8/include/v8-message.h +22 -3
- data/vendor/v8/include/v8-metrics.h +1 -0
- data/vendor/v8/include/v8-object.h +98 -77
- data/vendor/v8/include/v8-persistent-handle.h +68 -90
- data/vendor/v8/include/v8-platform.h +191 -23
- data/vendor/v8/include/v8-primitive.h +12 -8
- data/vendor/v8/include/v8-profiler.h +16 -2
- data/vendor/v8/include/v8-script.h +88 -14
- data/vendor/v8/include/v8-snapshot.h +96 -22
- data/vendor/v8/include/v8-source-location.h +92 -0
- data/vendor/v8/include/v8-statistics.h +31 -10
- data/vendor/v8/include/v8-template.h +410 -131
- data/vendor/v8/include/v8-traced-handle.h +108 -90
- data/vendor/v8/include/v8-typed-array.h +115 -7
- data/vendor/v8/include/v8-unwinder.h +1 -1
- data/vendor/v8/include/v8-util.h +23 -20
- data/vendor/v8/include/v8-value-serializer.h +14 -0
- data/vendor/v8/include/v8-value.h +105 -3
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8config.h +54 -20
- metadata +5 -3
@@ -26,7 +26,7 @@ class PersistentValueMap;
|
|
26
26
|
class Value;
|
27
27
|
|
28
28
|
namespace api_internal {
|
29
|
-
V8_EXPORT
|
29
|
+
V8_EXPORT internal::Address* Eternalize(v8::Isolate* isolate, Value* handle);
|
30
30
|
V8_EXPORT internal::Address* CopyGlobalReference(internal::Address* from);
|
31
31
|
V8_EXPORT void DisposeGlobal(internal::Address* global_handle);
|
32
32
|
V8_EXPORT void MakeWeak(internal::Address** location_addr);
|
@@ -34,7 +34,7 @@ V8_EXPORT void* ClearWeak(internal::Address* location);
|
|
34
34
|
V8_EXPORT void AnnotateStrongRetainer(internal::Address* location,
|
35
35
|
const char* label);
|
36
36
|
V8_EXPORT internal::Address* GlobalizeReference(internal::Isolate* isolate,
|
37
|
-
internal::Address
|
37
|
+
internal::Address value);
|
38
38
|
V8_EXPORT void MoveGlobalReference(internal::Address** from,
|
39
39
|
internal::Address** to);
|
40
40
|
} // namespace api_internal
|
@@ -44,35 +44,28 @@ V8_EXPORT void MoveGlobalReference(internal::Address** from,
|
|
44
44
|
* isolate.
|
45
45
|
*/
|
46
46
|
template <class T>
|
47
|
-
class Eternal {
|
47
|
+
class Eternal : public api_internal::IndirectHandleBase {
|
48
48
|
public:
|
49
|
-
V8_INLINE Eternal()
|
49
|
+
V8_INLINE Eternal() = default;
|
50
|
+
|
50
51
|
template <class S>
|
51
|
-
V8_INLINE Eternal(Isolate* isolate, Local<S> handle)
|
52
|
+
V8_INLINE Eternal(Isolate* isolate, Local<S> handle) {
|
52
53
|
Set(isolate, handle);
|
53
54
|
}
|
55
|
+
|
54
56
|
// Can only be safely called if already set.
|
55
57
|
V8_INLINE Local<T> Get(Isolate* isolate) const {
|
56
58
|
// The eternal handle will never go away, so as with the roots, we don't
|
57
59
|
// even need to open a handle.
|
58
|
-
return Local<T
|
60
|
+
return Local<T>::FromSlot(slot());
|
59
61
|
}
|
60
62
|
|
61
|
-
V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
|
62
|
-
|
63
63
|
template <class S>
|
64
64
|
void Set(Isolate* isolate, Local<S> handle) {
|
65
65
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
66
|
-
|
67
|
-
api_internal::Eternalize(isolate,
|
68
|
-
}
|
69
|
-
|
70
|
-
private:
|
71
|
-
V8_INLINE internal::Address address() const {
|
72
|
-
return *reinterpret_cast<internal::Address*>(val_);
|
66
|
+
slot() =
|
67
|
+
api_internal::Eternalize(isolate, *handle.template UnsafeAs<Value>());
|
73
68
|
}
|
74
|
-
|
75
|
-
T* val_;
|
76
69
|
};
|
77
70
|
|
78
71
|
namespace api_internal {
|
@@ -95,7 +88,7 @@ V8_EXPORT void MakeWeak(internal::Address* location, void* data,
|
|
95
88
|
*
|
96
89
|
*/
|
97
90
|
template <class T>
|
98
|
-
class PersistentBase {
|
91
|
+
class PersistentBase : public api_internal::IndirectHandleBase {
|
99
92
|
public:
|
100
93
|
/**
|
101
94
|
* If non-empty, destroy the underlying storage cell
|
@@ -117,9 +110,6 @@ class PersistentBase {
|
|
117
110
|
template <class S>
|
118
111
|
V8_INLINE void Reset(Isolate* isolate, const PersistentBase<S>& other);
|
119
112
|
|
120
|
-
V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
|
121
|
-
V8_INLINE void Empty() { val_ = 0; }
|
122
|
-
|
123
113
|
V8_INLINE Local<T> Get(Isolate* isolate) const {
|
124
114
|
return Local<T>::New(isolate, *this);
|
125
115
|
}
|
@@ -217,18 +207,14 @@ class PersistentBase {
|
|
217
207
|
template <class F1, class F2>
|
218
208
|
friend class PersistentValueVector;
|
219
209
|
friend class Object;
|
220
|
-
friend class internal::
|
210
|
+
friend class internal::ValueHelper;
|
221
211
|
|
222
|
-
|
223
|
-
V8_INLINE T* operator*() const { return this->val_; }
|
224
|
-
V8_INLINE internal::Address address() const {
|
225
|
-
return *reinterpret_cast<internal::Address*>(val_);
|
226
|
-
}
|
212
|
+
V8_INLINE PersistentBase() = default;
|
227
213
|
|
228
|
-
V8_INLINE
|
229
|
-
|
214
|
+
V8_INLINE explicit PersistentBase(internal::Address* location)
|
215
|
+
: IndirectHandleBase(location) {}
|
230
216
|
|
231
|
-
T*
|
217
|
+
V8_INLINE static internal::Address* New(Isolate* isolate, T* that);
|
232
218
|
};
|
233
219
|
|
234
220
|
/**
|
@@ -271,7 +257,9 @@ struct CopyablePersistentTraits {
|
|
271
257
|
* Copy, assignment and destructor behavior is controlled by the traits
|
272
258
|
* class M.
|
273
259
|
*
|
274
|
-
*
|
260
|
+
* CAVEAT: Persistent objects do not have proper destruction behavior by default
|
261
|
+
* and as such will leak the object without explicit clear. Consider using
|
262
|
+
* `v8::Global` instead which has proper destruction and move semantics.
|
275
263
|
*/
|
276
264
|
template <class T, class M>
|
277
265
|
class Persistent : public PersistentBase<T> {
|
@@ -279,16 +267,17 @@ class Persistent : public PersistentBase<T> {
|
|
279
267
|
/**
|
280
268
|
* A Persistent with no storage cell.
|
281
269
|
*/
|
282
|
-
V8_INLINE Persistent()
|
270
|
+
V8_INLINE Persistent() = default;
|
271
|
+
|
283
272
|
/**
|
284
273
|
* Construct a Persistent from a Local.
|
285
274
|
* When the Local is non-empty, a new storage cell is created
|
286
275
|
* pointing to the same object, and no flags are set.
|
287
276
|
*/
|
288
|
-
|
289
277
|
template <class S>
|
290
278
|
V8_INLINE Persistent(Isolate* isolate, Local<S> that)
|
291
|
-
: PersistentBase<T>(
|
279
|
+
: PersistentBase<T>(
|
280
|
+
PersistentBase<T>::New(isolate, that.template value<S>())) {
|
292
281
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
293
282
|
}
|
294
283
|
|
@@ -299,20 +288,22 @@ class Persistent : public PersistentBase<T> {
|
|
299
288
|
*/
|
300
289
|
template <class S, class M2>
|
301
290
|
V8_INLINE Persistent(Isolate* isolate, const Persistent<S, M2>& that)
|
302
|
-
: PersistentBase<T>(
|
291
|
+
: PersistentBase<T>(
|
292
|
+
PersistentBase<T>::New(isolate, that.template value<S>())) {
|
303
293
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
304
294
|
}
|
295
|
+
|
305
296
|
/**
|
306
297
|
* The copy constructors and assignment operator create a Persistent
|
307
298
|
* exactly as the Persistent constructor, but the Copy function from the
|
308
299
|
* traits class is called, allowing the setting of flags based on the
|
309
300
|
* copied Persistent.
|
310
301
|
*/
|
311
|
-
V8_INLINE Persistent(const Persistent& that) : PersistentBase<T>(
|
302
|
+
V8_INLINE Persistent(const Persistent& that) : PersistentBase<T>() {
|
312
303
|
Copy(that);
|
313
304
|
}
|
314
305
|
template <class S, class M2>
|
315
|
-
V8_INLINE Persistent(const Persistent<S, M2>& that) : PersistentBase<T>(
|
306
|
+
V8_INLINE Persistent(const Persistent<S, M2>& that) : PersistentBase<T>() {
|
316
307
|
Copy(that);
|
317
308
|
}
|
318
309
|
V8_INLINE Persistent& operator=(const Persistent& that) {
|
@@ -324,6 +315,7 @@ class Persistent : public PersistentBase<T> {
|
|
324
315
|
Copy(that);
|
325
316
|
return *this;
|
326
317
|
}
|
318
|
+
|
327
319
|
/**
|
328
320
|
* The destructor will dispose the Persistent based on the
|
329
321
|
* kResetInDestructor flags in the traits class. Since not calling dispose
|
@@ -334,20 +326,21 @@ class Persistent : public PersistentBase<T> {
|
|
334
326
|
}
|
335
327
|
|
336
328
|
// TODO(dcarney): this is pretty useless, fix or remove
|
337
|
-
template <class S>
|
338
|
-
V8_INLINE static Persistent<T>& Cast(const Persistent<S>& that) {
|
329
|
+
template <class S, class M2>
|
330
|
+
V8_INLINE static Persistent<T, M>& Cast(const Persistent<S, M2>& that) {
|
339
331
|
#ifdef V8_ENABLE_CHECKS
|
340
332
|
// If we're going to perform the type check then we have to check
|
341
333
|
// that the handle isn't empty before doing the checked cast.
|
342
|
-
if (!that.IsEmpty()) T::Cast(
|
334
|
+
if (!that.IsEmpty()) T::Cast(that.template value<S>());
|
343
335
|
#endif
|
344
|
-
return reinterpret_cast<Persistent<T>&>(
|
336
|
+
return reinterpret_cast<Persistent<T, M>&>(
|
337
|
+
const_cast<Persistent<S, M2>&>(that));
|
345
338
|
}
|
346
339
|
|
347
340
|
// TODO(dcarney): this is pretty useless, fix or remove
|
348
|
-
template <class S>
|
349
|
-
V8_INLINE Persistent<S>& As() const {
|
350
|
-
return Persistent<S>::Cast(*this);
|
341
|
+
template <class S, class M2>
|
342
|
+
V8_INLINE Persistent<S, M2>& As() const {
|
343
|
+
return Persistent<S, M2>::Cast(*this);
|
351
344
|
}
|
352
345
|
|
353
346
|
private:
|
@@ -360,7 +353,6 @@ class Persistent : public PersistentBase<T> {
|
|
360
353
|
template <class F>
|
361
354
|
friend class ReturnValue;
|
362
355
|
|
363
|
-
explicit V8_INLINE Persistent(T* that) : PersistentBase<T>(that) {}
|
364
356
|
template <class S, class M2>
|
365
357
|
V8_INLINE void Copy(const Persistent<S, M2>& that);
|
366
358
|
};
|
@@ -376,7 +368,7 @@ class Global : public PersistentBase<T> {
|
|
376
368
|
/**
|
377
369
|
* A Global with no storage cell.
|
378
370
|
*/
|
379
|
-
V8_INLINE Global()
|
371
|
+
V8_INLINE Global() = default;
|
380
372
|
|
381
373
|
/**
|
382
374
|
* Construct a Global from a Local.
|
@@ -385,7 +377,8 @@ class Global : public PersistentBase<T> {
|
|
385
377
|
*/
|
386
378
|
template <class S>
|
387
379
|
V8_INLINE Global(Isolate* isolate, Local<S> that)
|
388
|
-
: PersistentBase<T>(
|
380
|
+
: PersistentBase<T>(
|
381
|
+
PersistentBase<T>::New(isolate, that.template value<S>())) {
|
389
382
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
390
383
|
}
|
391
384
|
|
@@ -396,7 +389,8 @@ class Global : public PersistentBase<T> {
|
|
396
389
|
*/
|
397
390
|
template <class S>
|
398
391
|
V8_INLINE Global(Isolate* isolate, const PersistentBase<S>& that)
|
399
|
-
: PersistentBase<T>(
|
392
|
+
: PersistentBase<T>(
|
393
|
+
PersistentBase<T>::New(isolate, that.template value<S>())) {
|
400
394
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
401
395
|
}
|
402
396
|
|
@@ -446,17 +440,11 @@ class V8_EXPORT PersistentHandleVisitor {
|
|
446
440
|
};
|
447
441
|
|
448
442
|
template <class T>
|
449
|
-
|
450
|
-
return
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
template <class T>
|
455
|
-
T* PersistentBase<T>::New(Isolate* isolate, T* that) {
|
456
|
-
if (that == nullptr) return nullptr;
|
457
|
-
internal::Address* p = reinterpret_cast<internal::Address*>(that);
|
458
|
-
return reinterpret_cast<T*>(api_internal::GlobalizeReference(
|
459
|
-
reinterpret_cast<internal::Isolate*>(isolate), p));
|
443
|
+
internal::Address* PersistentBase<T>::New(Isolate* isolate, T* that) {
|
444
|
+
if (internal::ValueHelper::IsEmpty(that)) return nullptr;
|
445
|
+
return api_internal::GlobalizeReference(
|
446
|
+
reinterpret_cast<internal::Isolate*>(isolate),
|
447
|
+
internal::ValueHelper::ValueAsAddress(that));
|
460
448
|
}
|
461
449
|
|
462
450
|
template <class T, class M>
|
@@ -465,8 +453,7 @@ void Persistent<T, M>::Copy(const Persistent<S, M2>& that) {
|
|
465
453
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
466
454
|
this->Reset();
|
467
455
|
if (that.IsEmpty()) return;
|
468
|
-
|
469
|
-
this->val_ = reinterpret_cast<T*>(api_internal::CopyGlobalReference(p));
|
456
|
+
this->slot() = api_internal::CopyGlobalReference(that.slot());
|
470
457
|
M::Copy(that, this);
|
471
458
|
}
|
472
459
|
|
@@ -474,15 +461,14 @@ template <class T>
|
|
474
461
|
bool PersistentBase<T>::IsWeak() const {
|
475
462
|
using I = internal::Internals;
|
476
463
|
if (this->IsEmpty()) return false;
|
477
|
-
return I::GetNodeState(
|
478
|
-
I::kNodeStateIsWeakValue;
|
464
|
+
return I::GetNodeState(this->slot()) == I::kNodeStateIsWeakValue;
|
479
465
|
}
|
480
466
|
|
481
467
|
template <class T>
|
482
468
|
void PersistentBase<T>::Reset() {
|
483
469
|
if (this->IsEmpty()) return;
|
484
|
-
api_internal::DisposeGlobal(
|
485
|
-
|
470
|
+
api_internal::DisposeGlobal(this->slot());
|
471
|
+
this->Clear();
|
486
472
|
}
|
487
473
|
|
488
474
|
/**
|
@@ -495,7 +481,7 @@ void PersistentBase<T>::Reset(Isolate* isolate, const Local<S>& other) {
|
|
495
481
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
496
482
|
Reset();
|
497
483
|
if (other.IsEmpty()) return;
|
498
|
-
this->
|
484
|
+
this->slot() = New(isolate, *other);
|
499
485
|
}
|
500
486
|
|
501
487
|
/**
|
@@ -509,7 +495,7 @@ void PersistentBase<T>::Reset(Isolate* isolate,
|
|
509
495
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
510
496
|
Reset();
|
511
497
|
if (other.IsEmpty()) return;
|
512
|
-
this->
|
498
|
+
this->slot() = New(isolate, other.template value<S>());
|
513
499
|
}
|
514
500
|
|
515
501
|
template <class T>
|
@@ -522,8 +508,8 @@ V8_INLINE void PersistentBase<T>::SetWeak(
|
|
522
508
|
#pragma GCC diagnostic push
|
523
509
|
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
524
510
|
#endif
|
525
|
-
api_internal::MakeWeak(
|
526
|
-
|
511
|
+
api_internal::MakeWeak(this->slot(), parameter,
|
512
|
+
reinterpret_cast<Callback>(callback), type);
|
527
513
|
#if (__GNUC__ >= 8) && !defined(__clang__)
|
528
514
|
#pragma GCC diagnostic pop
|
529
515
|
#endif
|
@@ -531,28 +517,25 @@ V8_INLINE void PersistentBase<T>::SetWeak(
|
|
531
517
|
|
532
518
|
template <class T>
|
533
519
|
void PersistentBase<T>::SetWeak() {
|
534
|
-
api_internal::MakeWeak(
|
520
|
+
api_internal::MakeWeak(&this->slot());
|
535
521
|
}
|
536
522
|
|
537
523
|
template <class T>
|
538
524
|
template <typename P>
|
539
525
|
P* PersistentBase<T>::ClearWeak() {
|
540
|
-
return reinterpret_cast<P*>(api_internal::ClearWeak(
|
541
|
-
reinterpret_cast<internal::Address*>(this->val_)));
|
526
|
+
return reinterpret_cast<P*>(api_internal::ClearWeak(this->slot()));
|
542
527
|
}
|
543
528
|
|
544
529
|
template <class T>
|
545
530
|
void PersistentBase<T>::AnnotateStrongRetainer(const char* label) {
|
546
|
-
api_internal::AnnotateStrongRetainer(
|
547
|
-
reinterpret_cast<internal::Address*>(this->val_), label);
|
531
|
+
api_internal::AnnotateStrongRetainer(this->slot(), label);
|
548
532
|
}
|
549
533
|
|
550
534
|
template <class T>
|
551
535
|
void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) {
|
552
536
|
using I = internal::Internals;
|
553
537
|
if (this->IsEmpty()) return;
|
554
|
-
|
555
|
-
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
|
538
|
+
uint8_t* addr = reinterpret_cast<uint8_t*>(slot()) + I::kNodeClassIdOffset;
|
556
539
|
*reinterpret_cast<uint16_t*>(addr) = class_id;
|
557
540
|
}
|
558
541
|
|
@@ -560,18 +543,15 @@ template <class T>
|
|
560
543
|
uint16_t PersistentBase<T>::WrapperClassId() const {
|
561
544
|
using I = internal::Internals;
|
562
545
|
if (this->IsEmpty()) return 0;
|
563
|
-
|
564
|
-
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
|
546
|
+
uint8_t* addr = reinterpret_cast<uint8_t*>(slot()) + I::kNodeClassIdOffset;
|
565
547
|
return *reinterpret_cast<uint16_t*>(addr);
|
566
548
|
}
|
567
549
|
|
568
550
|
template <class T>
|
569
|
-
Global<T>::Global(Global&& other) : PersistentBase<T>(other.
|
570
|
-
if (other.
|
571
|
-
api_internal::MoveGlobalReference(
|
572
|
-
|
573
|
-
reinterpret_cast<internal::Address**>(&this->val_));
|
574
|
-
other.val_ = nullptr;
|
551
|
+
Global<T>::Global(Global&& other) : PersistentBase<T>(other.slot()) {
|
552
|
+
if (!other.IsEmpty()) {
|
553
|
+
api_internal::MoveGlobalReference(&other.slot(), &this->slot());
|
554
|
+
other.Clear();
|
575
555
|
}
|
576
556
|
}
|
577
557
|
|
@@ -581,12 +561,10 @@ Global<T>& Global<T>::operator=(Global<S>&& rhs) {
|
|
581
561
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
582
562
|
if (this != &rhs) {
|
583
563
|
this->Reset();
|
584
|
-
if (rhs.
|
585
|
-
this->
|
586
|
-
api_internal::MoveGlobalReference(
|
587
|
-
|
588
|
-
reinterpret_cast<internal::Address**>(&this->val_));
|
589
|
-
rhs.val_ = nullptr;
|
564
|
+
if (!rhs.IsEmpty()) {
|
565
|
+
this->slot() = rhs.slot();
|
566
|
+
api_internal::MoveGlobalReference(&rhs.slot(), &this->slot());
|
567
|
+
rhs.Clear();
|
590
568
|
}
|
591
569
|
}
|
592
570
|
return *this;
|