libv8-node 22.5.1.0-aarch64-linux-musl → 24.12.0.1-aarch64-linux-musl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/libv8-node/location.rb +3 -5
- data/ext/libv8-node/paths.rb +34 -1
- data/lib/libv8/node/version.rb +7 -4
- data/lib/libv8/node.rb +2 -0
- data/lib/libv8-node.rb +2 -0
- data/vendor/v8/aarch64-linux-musl/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/allocation.h +11 -13
- data/vendor/v8/include/cppgc/default-platform.h +3 -2
- data/vendor/v8/include/cppgc/garbage-collected.h +8 -0
- data/vendor/v8/include/cppgc/heap-consistency.h +1 -1
- data/vendor/v8/include/cppgc/heap-statistics.h +2 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +2 -14
- data/vendor/v8/include/cppgc/internal/base-page-handle.h +2 -4
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +0 -4
- data/vendor/v8/include/cppgc/internal/caged-heap.h +0 -4
- data/vendor/v8/include/cppgc/internal/compiler-specific.h +9 -1
- data/vendor/v8/include/cppgc/internal/conditional-stack-allocated.h +41 -0
- data/vendor/v8/include/cppgc/internal/gc-info.h +12 -10
- data/vendor/v8/include/cppgc/internal/logging.h +3 -3
- data/vendor/v8/include/cppgc/internal/member-storage.h +69 -20
- data/vendor/v8/include/cppgc/internal/name-trait.h +5 -1
- data/vendor/v8/include/cppgc/internal/persistent-node.h +8 -3
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +48 -11
- data/vendor/v8/include/cppgc/macros.h +21 -0
- data/vendor/v8/include/cppgc/member.h +70 -36
- data/vendor/v8/include/cppgc/name-provider.h +10 -0
- data/vendor/v8/include/cppgc/platform.h +11 -0
- data/vendor/v8/include/cppgc/type-traits.h +1 -0
- data/vendor/v8/include/cppgc/visitor.h +25 -1
- data/vendor/v8/include/libplatform/libplatform-export.h +2 -2
- data/vendor/v8/include/libplatform/v8-tracing.h +0 -1
- data/vendor/v8/include/v8-array-buffer.h +143 -46
- data/vendor/v8/include/v8-callbacks.h +94 -31
- data/vendor/v8/include/v8-context.h +48 -15
- data/vendor/v8/include/v8-cppgc.h +5 -56
- data/vendor/v8/include/v8-data.h +5 -0
- data/vendor/v8/include/v8-date.h +9 -0
- data/vendor/v8/include/v8-debug.h +11 -0
- data/vendor/v8/include/v8-embedder-heap.h +1 -29
- data/vendor/v8/include/v8-exception.h +72 -0
- data/vendor/v8/include/v8-external-memory-accounter.h +60 -0
- data/vendor/v8/include/v8-fast-api-calls.h +41 -206
- data/vendor/v8/include/v8-function-callback.h +190 -78
- data/vendor/v8/include/v8-function.h +11 -3
- data/vendor/v8/include/v8-handle-base.h +20 -2
- data/vendor/v8/include/v8-initialization.h +26 -1
- data/vendor/v8/include/v8-inspector.h +10 -3
- data/vendor/v8/include/v8-internal.h +638 -315
- data/vendor/v8/include/v8-isolate.h +275 -189
- data/vendor/v8/include/v8-local-handle.h +70 -44
- data/vendor/v8/include/v8-maybe.h +2 -1
- data/vendor/v8/include/v8-memory-span.h +149 -24
- data/vendor/v8/include/v8-message.h +9 -22
- data/vendor/v8/include/v8-metrics.h +14 -0
- data/vendor/v8/include/v8-microtask-queue.h +0 -5
- data/vendor/v8/include/v8-object.h +291 -37
- data/vendor/v8/include/v8-persistent-handle.h +24 -36
- data/vendor/v8/include/v8-platform.h +66 -45
- data/vendor/v8/include/v8-primitive.h +223 -5
- data/vendor/v8/include/v8-profiler.h +51 -2
- data/vendor/v8/include/v8-promise.h +2 -2
- data/vendor/v8/include/v8-proxy.h +0 -1
- data/vendor/v8/include/v8-regexp.h +0 -1
- data/vendor/v8/include/v8-sandbox.h +173 -0
- data/vendor/v8/include/v8-script.h +65 -17
- data/vendor/v8/include/v8-snapshot.h +38 -2
- data/vendor/v8/include/v8-source-location.h +6 -1
- data/vendor/v8/include/v8-template.h +111 -263
- data/vendor/v8/include/v8-trace-categories.h +23 -0
- data/vendor/v8/include/v8-traced-handle.h +20 -32
- data/vendor/v8/include/v8-typed-array.h +6 -10
- data/vendor/v8/include/v8-unwinder-state.h +2 -3
- data/vendor/v8/include/v8-unwinder.h +2 -1
- data/vendor/v8/include/v8-util.h +1 -117
- data/vendor/v8/include/v8-value-serializer-version.h +3 -3
- data/vendor/v8/include/v8-value.h +21 -2
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8-wasm.h +27 -0
- data/vendor/v8/include/v8-weak-callback-info.h +20 -12
- data/vendor/v8/include/v8.h +3 -3
- data/vendor/v8/include/v8config.h +83 -45
- metadata +55 -12
- data/vendor/v8/include/cppgc/ephemeron-pair.h +0 -30
|
@@ -51,8 +51,6 @@ class Isolate;
|
|
|
51
51
|
class Object;
|
|
52
52
|
template <class F1, class F2, class F3>
|
|
53
53
|
class PersistentValueMapBase;
|
|
54
|
-
template <class F1, class F2>
|
|
55
|
-
class PersistentValueVector;
|
|
56
54
|
class Primitive;
|
|
57
55
|
class Private;
|
|
58
56
|
template <class F>
|
|
@@ -152,11 +150,11 @@ class V8_EXPORT V8_NODISCARD HandleScope {
|
|
|
152
150
|
|
|
153
151
|
/**
|
|
154
152
|
* A base class for local handles.
|
|
155
|
-
* Its implementation depends on whether direct
|
|
153
|
+
* Its implementation depends on whether direct handle support is enabled.
|
|
156
154
|
* When it is, a local handle contains a direct pointer to the referenced
|
|
157
155
|
* object, otherwise it contains an indirect pointer.
|
|
158
156
|
*/
|
|
159
|
-
#ifdef
|
|
157
|
+
#ifdef V8_ENABLE_DIRECT_HANDLE
|
|
160
158
|
|
|
161
159
|
template <typename T>
|
|
162
160
|
class LocalBase : public api_internal::DirectHandleBase {
|
|
@@ -181,11 +179,17 @@ class LocalBase : public api_internal::DirectHandleBase {
|
|
|
181
179
|
}
|
|
182
180
|
|
|
183
181
|
V8_INLINE static LocalBase<T> FromSlot(internal::Address* slot) {
|
|
182
|
+
if (slot == nullptr) return LocalBase<T>();
|
|
184
183
|
return LocalBase<T>(*slot);
|
|
185
184
|
}
|
|
185
|
+
|
|
186
|
+
V8_INLINE static LocalBase<T> FromRepr(
|
|
187
|
+
internal::ValueHelper::InternalRepresentationType repr) {
|
|
188
|
+
return LocalBase<T>(repr);
|
|
189
|
+
}
|
|
186
190
|
};
|
|
187
191
|
|
|
188
|
-
#else // !
|
|
192
|
+
#else // !V8_ENABLE_DIRECT_HANDLE
|
|
189
193
|
|
|
190
194
|
template <typename T>
|
|
191
195
|
class LocalBase : public api_internal::IndirectHandleBase {
|
|
@@ -215,9 +219,14 @@ class LocalBase : public api_internal::IndirectHandleBase {
|
|
|
215
219
|
V8_INLINE static LocalBase<T> FromSlot(internal::Address* slot) {
|
|
216
220
|
return LocalBase<T>(slot);
|
|
217
221
|
}
|
|
222
|
+
|
|
223
|
+
V8_INLINE static LocalBase<T> FromRepr(
|
|
224
|
+
internal::ValueHelper::InternalRepresentationType repr) {
|
|
225
|
+
return LocalBase<T>(repr);
|
|
226
|
+
}
|
|
218
227
|
};
|
|
219
228
|
|
|
220
|
-
#endif //
|
|
229
|
+
#endif // V8_ENABLE_DIRECT_HANDLE
|
|
221
230
|
|
|
222
231
|
/**
|
|
223
232
|
* An object reference managed by the v8 garbage collector.
|
|
@@ -257,17 +266,19 @@ class V8_TRIVIAL_ABI Local : public LocalBase<T>,
|
|
|
257
266
|
#endif
|
|
258
267
|
{
|
|
259
268
|
public:
|
|
269
|
+
/**
|
|
270
|
+
* Default constructor: Returns an empty handle.
|
|
271
|
+
*/
|
|
260
272
|
V8_INLINE Local() = default;
|
|
261
273
|
|
|
274
|
+
/**
|
|
275
|
+
* Constructor for handling automatic up casting.
|
|
276
|
+
* Ex. Local<Object> can be passed when Local<Value> is expected but not
|
|
277
|
+
* the other way round.
|
|
278
|
+
*/
|
|
262
279
|
template <class S>
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
* This check fails when trying to convert between incompatible
|
|
266
|
-
* handles. For example, converting from a Local<String> to a
|
|
267
|
-
* Local<Number>.
|
|
268
|
-
*/
|
|
269
|
-
static_assert(std::is_base_of<T, S>::value, "type check");
|
|
270
|
-
}
|
|
280
|
+
requires std::is_base_of_v<T, S>
|
|
281
|
+
V8_INLINE Local(Local<S> that) : LocalBase<T>(that) {}
|
|
271
282
|
|
|
272
283
|
V8_INLINE T* operator->() const { return this->template value<T>(); }
|
|
273
284
|
|
|
@@ -307,7 +318,7 @@ class V8_TRIVIAL_ABI Local : public LocalBase<T>,
|
|
|
307
318
|
/**
|
|
308
319
|
* Cast a handle to a subclass, e.g. Local<Value> to Local<Object>.
|
|
309
320
|
* This is only valid if the handle actually refers to a value of the
|
|
310
|
-
* target type.
|
|
321
|
+
* target type or if the handle is empty.
|
|
311
322
|
*/
|
|
312
323
|
template <class S>
|
|
313
324
|
V8_INLINE static Local<T> Cast(Local<S> that) {
|
|
@@ -323,7 +334,7 @@ class V8_TRIVIAL_ABI Local : public LocalBase<T>,
|
|
|
323
334
|
/**
|
|
324
335
|
* Calling this is equivalent to Local<S>::Cast().
|
|
325
336
|
* In particular, this is only valid if the handle actually refers to a value
|
|
326
|
-
* of the target type.
|
|
337
|
+
* of the target type or if the handle is empty.
|
|
327
338
|
*/
|
|
328
339
|
template <class S>
|
|
329
340
|
V8_INLINE Local<S> As() const {
|
|
@@ -382,8 +393,6 @@ class V8_TRIVIAL_ABI Local : public LocalBase<T>,
|
|
|
382
393
|
friend class InternalEscapableScope;
|
|
383
394
|
template <class F1, class F2, class F3>
|
|
384
395
|
friend class PersistentValueMapBase;
|
|
385
|
-
template <class F1, class F2>
|
|
386
|
-
friend class PersistentValueVector;
|
|
387
396
|
template <class F>
|
|
388
397
|
friend class ReturnValue;
|
|
389
398
|
template <class F>
|
|
@@ -398,20 +407,24 @@ class V8_TRIVIAL_ABI Local : public LocalBase<T>,
|
|
|
398
407
|
explicit Local(const Local<T>& other, no_checking_tag do_not_check)
|
|
399
408
|
: LocalBase<T>(other), StackAllocated(do_not_check) {}
|
|
400
409
|
|
|
401
|
-
V8_INLINE explicit Local
|
|
402
|
-
|
|
410
|
+
V8_INLINE explicit Local(const LocalBase<T>& other) : LocalBase<T>(other) {}
|
|
411
|
+
|
|
412
|
+
V8_INLINE static Local<T> FromRepr(
|
|
413
|
+
internal::ValueHelper::InternalRepresentationType repr) {
|
|
414
|
+
return Local<T>(LocalBase<T>::FromRepr(repr));
|
|
415
|
+
}
|
|
403
416
|
|
|
404
417
|
V8_INLINE static Local<T> FromSlot(internal::Address* slot) {
|
|
405
418
|
return Local<T>(LocalBase<T>::FromSlot(slot));
|
|
406
419
|
}
|
|
407
420
|
|
|
408
|
-
#ifdef
|
|
421
|
+
#ifdef V8_ENABLE_DIRECT_HANDLE
|
|
409
422
|
friend class TypecheckWitness;
|
|
410
423
|
|
|
411
424
|
V8_INLINE static Local<T> FromAddress(internal::Address ptr) {
|
|
412
425
|
return Local<T>(LocalBase<T>(ptr));
|
|
413
426
|
}
|
|
414
|
-
#endif //
|
|
427
|
+
#endif // V8_ENABLE_DIRECT_HANDLE
|
|
415
428
|
|
|
416
429
|
V8_INLINE static Local<T> New(Isolate* isolate, internal::Address value) {
|
|
417
430
|
return Local<T>(LocalBase<T>::New(isolate, value));
|
|
@@ -439,17 +452,18 @@ class V8_TRIVIAL_ABI LocalUnchecked : public Local<T> {
|
|
|
439
452
|
#if defined(V8_ENABLE_LOCAL_OFF_STACK_CHECK) && V8_HAS_ATTRIBUTE_TRIVIAL_ABI
|
|
440
453
|
// In this case, the check is also enforced in the copy constructor and we
|
|
441
454
|
// need to suppress it.
|
|
442
|
-
LocalUnchecked(
|
|
455
|
+
LocalUnchecked(
|
|
456
|
+
const LocalUnchecked& other) noexcept // NOLINT(runtime/explicit)
|
|
443
457
|
: Local<T>(other, Local<T>::do_not_check) {}
|
|
444
|
-
LocalUnchecked& operator=(const LocalUnchecked&) = default;
|
|
458
|
+
LocalUnchecked& operator=(const LocalUnchecked&) noexcept = default;
|
|
445
459
|
#endif
|
|
446
460
|
|
|
447
461
|
// Implicit conversion from Local.
|
|
448
|
-
LocalUnchecked(const Local<T>& other) // NOLINT(runtime/explicit)
|
|
462
|
+
LocalUnchecked(const Local<T>& other) noexcept // NOLINT(runtime/explicit)
|
|
449
463
|
: Local<T>(other, Local<T>::do_not_check) {}
|
|
450
464
|
};
|
|
451
465
|
|
|
452
|
-
#ifdef
|
|
466
|
+
#ifdef V8_ENABLE_DIRECT_HANDLE
|
|
453
467
|
// Off-stack allocated direct locals must be registered as strong roots.
|
|
454
468
|
// For off-stack indirect locals, this is not necessary.
|
|
455
469
|
|
|
@@ -460,9 +474,9 @@ class StrongRootAllocator<LocalUnchecked<T>> : public StrongRootAllocatorBase {
|
|
|
460
474
|
static_assert(std::is_standard_layout_v<value_type>);
|
|
461
475
|
static_assert(sizeof(value_type) == sizeof(Address));
|
|
462
476
|
|
|
463
|
-
|
|
464
|
-
explicit StrongRootAllocator(
|
|
465
|
-
: StrongRootAllocatorBase(
|
|
477
|
+
template <typename HeapOrIsolateT>
|
|
478
|
+
explicit StrongRootAllocator(HeapOrIsolateT* heap_or_isolate)
|
|
479
|
+
: StrongRootAllocatorBase(heap_or_isolate) {}
|
|
466
480
|
template <typename U>
|
|
467
481
|
StrongRootAllocator(const StrongRootAllocator<U>& other) noexcept
|
|
468
482
|
: StrongRootAllocatorBase(other) {}
|
|
@@ -474,7 +488,7 @@ class StrongRootAllocator<LocalUnchecked<T>> : public StrongRootAllocatorBase {
|
|
|
474
488
|
return deallocate_impl(reinterpret_cast<Address*>(p), n);
|
|
475
489
|
}
|
|
476
490
|
};
|
|
477
|
-
#endif //
|
|
491
|
+
#endif // V8_ENABLE_DIRECT_HANDLE
|
|
478
492
|
} // namespace internal
|
|
479
493
|
|
|
480
494
|
template <typename T>
|
|
@@ -482,7 +496,7 @@ class LocalVector {
|
|
|
482
496
|
private:
|
|
483
497
|
using element_type = internal::LocalUnchecked<T>;
|
|
484
498
|
|
|
485
|
-
#ifdef
|
|
499
|
+
#ifdef V8_ENABLE_DIRECT_HANDLE
|
|
486
500
|
using allocator_type = internal::StrongRootAllocator<element_type>;
|
|
487
501
|
|
|
488
502
|
static allocator_type make_allocator(Isolate* isolate) noexcept {
|
|
@@ -494,7 +508,7 @@ class LocalVector {
|
|
|
494
508
|
static allocator_type make_allocator(Isolate* isolate) noexcept {
|
|
495
509
|
return allocator_type();
|
|
496
510
|
}
|
|
497
|
-
#endif //
|
|
511
|
+
#endif // V8_ENABLE_DIRECT_HANDLE
|
|
498
512
|
|
|
499
513
|
using vector_type = std::vector<element_type, allocator_type>;
|
|
500
514
|
|
|
@@ -561,13 +575,18 @@ class LocalVector {
|
|
|
561
575
|
|
|
562
576
|
LocalVector<T>& operator=(std::initializer_list<Local<T>> init) {
|
|
563
577
|
backing_.clear();
|
|
578
|
+
backing_.reserve(init.size());
|
|
564
579
|
backing_.insert(backing_.end(), init.begin(), init.end());
|
|
565
580
|
return *this;
|
|
566
581
|
}
|
|
567
582
|
|
|
568
583
|
void push_back(const Local<T>& x) { backing_.push_back(x); }
|
|
569
584
|
void pop_back() { backing_.pop_back(); }
|
|
570
|
-
|
|
585
|
+
|
|
586
|
+
template <typename... Args>
|
|
587
|
+
void emplace_back(Args&&... args) {
|
|
588
|
+
backing_.push_back(value_type{std::forward<Args>(args)...});
|
|
589
|
+
}
|
|
571
590
|
|
|
572
591
|
void clear() noexcept { backing_.clear(); }
|
|
573
592
|
void resize(size_t n) { backing_.resize(n); }
|
|
@@ -615,9 +634,22 @@ using Handle = Local<T>;
|
|
|
615
634
|
template <class T>
|
|
616
635
|
class MaybeLocal {
|
|
617
636
|
public:
|
|
618
|
-
|
|
637
|
+
/**
|
|
638
|
+
* Default constructor: Returns an empty handle.
|
|
639
|
+
*/
|
|
640
|
+
V8_INLINE MaybeLocal() = default;
|
|
641
|
+
/**
|
|
642
|
+
* Implicitly construct MaybeLocal from Local.
|
|
643
|
+
*/
|
|
619
644
|
template <class S>
|
|
645
|
+
requires std::is_base_of_v<T, S>
|
|
620
646
|
V8_INLINE MaybeLocal(Local<S> that) : local_(that) {}
|
|
647
|
+
/**
|
|
648
|
+
* Implicitly up-cast MaybeLocal<S> to MaybeLocal<T> if T is a base of S.
|
|
649
|
+
*/
|
|
650
|
+
template <class S>
|
|
651
|
+
requires std::is_base_of_v<T, S>
|
|
652
|
+
V8_INLINE MaybeLocal(MaybeLocal<S> that) : local_(that.local_) {}
|
|
621
653
|
|
|
622
654
|
V8_INLINE bool IsEmpty() const { return local_.IsEmpty(); }
|
|
623
655
|
|
|
@@ -652,23 +684,17 @@ class MaybeLocal {
|
|
|
652
684
|
/**
|
|
653
685
|
* Cast a handle to a subclass, e.g. MaybeLocal<Value> to MaybeLocal<Object>.
|
|
654
686
|
* This is only valid if the handle actually refers to a value of the target
|
|
655
|
-
* type.
|
|
687
|
+
* type or if the handle is empty.
|
|
656
688
|
*/
|
|
657
689
|
template <class S>
|
|
658
690
|
V8_INLINE static MaybeLocal<T> Cast(MaybeLocal<S> that) {
|
|
659
|
-
|
|
660
|
-
// If we're going to perform the type check then we have to check
|
|
661
|
-
// that the handle isn't empty before doing the checked cast.
|
|
662
|
-
if (that.IsEmpty()) return MaybeLocal<T>();
|
|
663
|
-
T::Cast(that.local_.template value<S>());
|
|
664
|
-
#endif
|
|
665
|
-
return MaybeLocal<T>(that.local_);
|
|
691
|
+
return MaybeLocal<T>{Local<T>::Cast(that.local_)};
|
|
666
692
|
}
|
|
667
693
|
|
|
668
694
|
/**
|
|
669
695
|
* Calling this is equivalent to MaybeLocal<S>::Cast().
|
|
670
696
|
* In particular, this is only valid if the handle actually refers to a value
|
|
671
|
-
* of the target type.
|
|
697
|
+
* of the target type or if the handle is empty.
|
|
672
698
|
*/
|
|
673
699
|
template <class S>
|
|
674
700
|
V8_INLINE MaybeLocal<S> As() const {
|
|
@@ -717,7 +743,7 @@ class V8_EXPORT V8_NODISCARD EscapableHandleScope
|
|
|
717
743
|
V8_INLINE ~EscapableHandleScope() = default;
|
|
718
744
|
template <class T>
|
|
719
745
|
V8_INLINE Local<T> Escape(Local<T> value) {
|
|
720
|
-
#ifdef
|
|
746
|
+
#ifdef V8_ENABLE_DIRECT_HANDLE
|
|
721
747
|
return value;
|
|
722
748
|
#else
|
|
723
749
|
if (value.IsEmpty()) return value;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#include <type_traits>
|
|
9
9
|
#include <utility>
|
|
10
10
|
|
|
11
|
+
#include "cppgc/internal/conditional-stack-allocated.h" // NOLINT(build/include_directory)
|
|
11
12
|
#include "v8-internal.h" // NOLINT(build/include_directory)
|
|
12
13
|
#include "v8config.h" // NOLINT(build/include_directory)
|
|
13
14
|
|
|
@@ -29,7 +30,7 @@ V8_EXPORT void FromJustIsNothing();
|
|
|
29
30
|
* "Nothing" value is returned.
|
|
30
31
|
*/
|
|
31
32
|
template <class T>
|
|
32
|
-
class Maybe {
|
|
33
|
+
class Maybe : public cppgc::internal::ConditionalStackAllocatedBase<T> {
|
|
33
34
|
public:
|
|
34
35
|
V8_INLINE bool IsNothing() const { return !has_value_; }
|
|
35
36
|
V8_INLINE bool IsJust() const { return has_value_; }
|
|
@@ -8,11 +8,46 @@
|
|
|
8
8
|
#include <stddef.h>
|
|
9
9
|
|
|
10
10
|
#include <array>
|
|
11
|
+
#include <cstddef>
|
|
11
12
|
#include <iterator>
|
|
12
13
|
#include <type_traits>
|
|
13
14
|
|
|
14
15
|
#include "v8config.h" // NOLINT(build/include_directory)
|
|
15
16
|
|
|
17
|
+
// TODO(pkasting): Use <compare>/spaceship unconditionally after dropping
|
|
18
|
+
// support for old libstdc++ versions.
|
|
19
|
+
#if __has_include(<version>)
|
|
20
|
+
#include <version>
|
|
21
|
+
#endif
|
|
22
|
+
#if defined(__cpp_lib_three_way_comparison) && \
|
|
23
|
+
__cpp_lib_three_way_comparison >= 201711L
|
|
24
|
+
#define V8_HAVE_SPACESHIP_OPERATOR 1
|
|
25
|
+
#else
|
|
26
|
+
#define V8_HAVE_SPACESHIP_OPERATOR 0
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
// TODO(pkasting): Make this block unconditional after dropping support for old
|
|
30
|
+
// libstdc++ versions.
|
|
31
|
+
#if __has_include(<ranges>)
|
|
32
|
+
#include <ranges>
|
|
33
|
+
|
|
34
|
+
namespace v8 {
|
|
35
|
+
|
|
36
|
+
template <typename T>
|
|
37
|
+
class V8_EXPORT MemorySpan;
|
|
38
|
+
|
|
39
|
+
} // namespace v8
|
|
40
|
+
|
|
41
|
+
// Mark `MemorySpan` as satisfying the `view` and `borrowed_range` concepts.
|
|
42
|
+
// This should be done before the definition of `MemorySpan`, so that any
|
|
43
|
+
// inlined calls to range functionality use the correct specializations.
|
|
44
|
+
template <typename T>
|
|
45
|
+
inline constexpr bool std::ranges::enable_view<v8::MemorySpan<T>> = true;
|
|
46
|
+
template <typename T>
|
|
47
|
+
inline constexpr bool std::ranges::enable_borrowed_range<v8::MemorySpan<T>> =
|
|
48
|
+
true;
|
|
49
|
+
#endif
|
|
50
|
+
|
|
16
51
|
namespace v8 {
|
|
17
52
|
|
|
18
53
|
/**
|
|
@@ -53,13 +88,13 @@ class V8_EXPORT MemorySpan {
|
|
|
53
88
|
is_compatible_iterator<It>::value;
|
|
54
89
|
|
|
55
90
|
template <typename U>
|
|
56
|
-
static constexpr U* to_address(U* p) noexcept {
|
|
91
|
+
[[nodiscard]] static constexpr U* to_address(U* p) noexcept {
|
|
57
92
|
return p;
|
|
58
93
|
}
|
|
59
94
|
|
|
60
95
|
template <typename It,
|
|
61
96
|
typename = std::void_t<decltype(std::declval<It&>().operator->())>>
|
|
62
|
-
static constexpr auto to_address(It it) noexcept {
|
|
97
|
+
[[nodiscard]] static constexpr auto to_address(It it) noexcept {
|
|
63
98
|
return it.operator->();
|
|
64
99
|
}
|
|
65
100
|
|
|
@@ -108,50 +143,139 @@ class V8_EXPORT MemorySpan {
|
|
|
108
143
|
: data_(a.data()), size_{N} {}
|
|
109
144
|
|
|
110
145
|
/** Returns a pointer to the beginning of the buffer. */
|
|
111
|
-
constexpr T* data() const { return data_; }
|
|
146
|
+
[[nodiscard]] constexpr T* data() const { return data_; }
|
|
112
147
|
/** Returns the number of elements that the buffer holds. */
|
|
113
|
-
constexpr size_t size() const { return size_; }
|
|
148
|
+
[[nodiscard]] constexpr size_t size() const { return size_; }
|
|
114
149
|
|
|
115
|
-
constexpr T& operator[](size_t i) const { return data_[i]; }
|
|
150
|
+
[[nodiscard]] constexpr T& operator[](size_t i) const { return data_[i]; }
|
|
116
151
|
|
|
117
152
|
/** Returns true if the buffer is empty. */
|
|
118
|
-
constexpr bool empty() const { return size() == 0; }
|
|
153
|
+
[[nodiscard]] constexpr bool empty() const { return size() == 0; }
|
|
119
154
|
|
|
120
155
|
class Iterator {
|
|
121
156
|
public:
|
|
122
|
-
using iterator_category = std::forward_iterator_tag;
|
|
123
|
-
using value_type = T;
|
|
124
157
|
using difference_type = std::ptrdiff_t;
|
|
158
|
+
using value_type = T;
|
|
125
159
|
using pointer = value_type*;
|
|
126
160
|
using reference = value_type&;
|
|
161
|
+
using iterator_category = std::random_access_iterator_tag;
|
|
162
|
+
// There seems to be no feature-test macro covering this, so use the
|
|
163
|
+
// presence of `<ranges>` as a crude proxy, since it was added to the
|
|
164
|
+
// standard as part of the Ranges papers.
|
|
165
|
+
// TODO(pkasting): Add this unconditionally after dropping support for old
|
|
166
|
+
// libstdc++ versions.
|
|
167
|
+
#if __has_include(<ranges>)
|
|
168
|
+
using iterator_concept = std::contiguous_iterator_tag;
|
|
169
|
+
#endif
|
|
170
|
+
|
|
171
|
+
// Required to satisfy `std::semiregular<>`.
|
|
172
|
+
constexpr Iterator() = default;
|
|
173
|
+
|
|
174
|
+
[[nodiscard]] friend constexpr bool operator==(const Iterator& a,
|
|
175
|
+
const Iterator& b) {
|
|
176
|
+
// TODO(pkasting): Replace this body with `= default` after dropping
|
|
177
|
+
// support for old gcc versions.
|
|
178
|
+
return a.ptr_ == b.ptr_;
|
|
179
|
+
}
|
|
180
|
+
#if V8_HAVE_SPACESHIP_OPERATOR
|
|
181
|
+
[[nodiscard]] friend constexpr auto operator<=>(const Iterator&,
|
|
182
|
+
const Iterator&) = default;
|
|
183
|
+
#else
|
|
184
|
+
// Assume that if spaceship isn't present, operator rewriting might not be
|
|
185
|
+
// either.
|
|
186
|
+
[[nodiscard]] friend constexpr bool operator!=(const Iterator& a,
|
|
187
|
+
const Iterator& b) {
|
|
188
|
+
return a.ptr_ != b.ptr_;
|
|
189
|
+
}
|
|
127
190
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
bool operator
|
|
191
|
+
[[nodiscard]] friend constexpr bool operator<(const Iterator& a,
|
|
192
|
+
const Iterator& b) {
|
|
193
|
+
return a.ptr_ < b.ptr_;
|
|
194
|
+
}
|
|
195
|
+
[[nodiscard]] friend constexpr bool operator<=(const Iterator& a,
|
|
196
|
+
const Iterator& b) {
|
|
197
|
+
return a.ptr_ <= b.ptr_;
|
|
198
|
+
}
|
|
199
|
+
[[nodiscard]] friend constexpr bool operator>(const Iterator& a,
|
|
200
|
+
const Iterator& b) {
|
|
201
|
+
return a.ptr_ > b.ptr_;
|
|
202
|
+
}
|
|
203
|
+
[[nodiscard]] friend constexpr bool operator>=(const Iterator& a,
|
|
204
|
+
const Iterator& b) {
|
|
205
|
+
return a.ptr_ >= b.ptr_;
|
|
206
|
+
}
|
|
207
|
+
#endif
|
|
133
208
|
|
|
134
|
-
Iterator& operator++() {
|
|
209
|
+
constexpr Iterator& operator++() {
|
|
135
210
|
++ptr_;
|
|
136
211
|
return *this;
|
|
137
212
|
}
|
|
138
213
|
|
|
139
|
-
Iterator operator++(int) {
|
|
140
|
-
Iterator temp
|
|
141
|
-
|
|
214
|
+
constexpr Iterator operator++(int) {
|
|
215
|
+
Iterator temp = *this;
|
|
216
|
+
++*this;
|
|
142
217
|
return temp;
|
|
143
218
|
}
|
|
144
219
|
|
|
220
|
+
constexpr Iterator& operator--() {
|
|
221
|
+
--ptr_;
|
|
222
|
+
return *this;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
constexpr Iterator operator--(int) {
|
|
226
|
+
Iterator temp = *this;
|
|
227
|
+
--*this;
|
|
228
|
+
return temp;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
constexpr Iterator& operator+=(difference_type rhs) {
|
|
232
|
+
ptr_ += rhs;
|
|
233
|
+
return *this;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
[[nodiscard]] friend constexpr Iterator operator+(Iterator lhs,
|
|
237
|
+
difference_type rhs) {
|
|
238
|
+
lhs += rhs;
|
|
239
|
+
return lhs;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
[[nodiscard]] friend constexpr Iterator operator+(difference_type lhs,
|
|
243
|
+
const Iterator& rhs) {
|
|
244
|
+
return rhs + lhs;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
constexpr Iterator& operator-=(difference_type rhs) {
|
|
248
|
+
ptr_ -= rhs;
|
|
249
|
+
return *this;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
[[nodiscard]] friend constexpr Iterator operator-(Iterator lhs,
|
|
253
|
+
difference_type rhs) {
|
|
254
|
+
lhs -= rhs;
|
|
255
|
+
return lhs;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
[[nodiscard]] friend constexpr difference_type operator-(
|
|
259
|
+
const Iterator& lhs, const Iterator& rhs) {
|
|
260
|
+
return lhs.ptr_ - rhs.ptr_;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
[[nodiscard]] constexpr reference operator*() const { return *ptr_; }
|
|
264
|
+
[[nodiscard]] constexpr pointer operator->() const { return ptr_; }
|
|
265
|
+
[[nodiscard]] constexpr reference operator[](size_t offset) const {
|
|
266
|
+
return ptr_[offset];
|
|
267
|
+
}
|
|
268
|
+
|
|
145
269
|
private:
|
|
146
270
|
friend class MemorySpan<T>;
|
|
147
271
|
|
|
148
|
-
explicit Iterator(T* ptr) : ptr_(ptr) {}
|
|
272
|
+
constexpr explicit Iterator(T* ptr) : ptr_(ptr) {}
|
|
149
273
|
|
|
150
274
|
T* ptr_ = nullptr;
|
|
151
275
|
};
|
|
152
276
|
|
|
153
|
-
Iterator begin() const { return Iterator(data_); }
|
|
154
|
-
Iterator end() const { return Iterator(data_ + size_); }
|
|
277
|
+
[[nodiscard]] Iterator begin() const { return Iterator(data_); }
|
|
278
|
+
[[nodiscard]] Iterator end() const { return Iterator(data_ + size_); }
|
|
155
279
|
|
|
156
280
|
private:
|
|
157
281
|
T* data_ = nullptr;
|
|
@@ -171,25 +295,26 @@ class V8_EXPORT MemorySpan {
|
|
|
171
295
|
|
|
172
296
|
namespace detail {
|
|
173
297
|
template <class T, std::size_t N, std::size_t... I>
|
|
174
|
-
constexpr std::array<std::remove_cv_t<T>, N> to_array_lvalue_impl(
|
|
298
|
+
[[nodiscard]] constexpr std::array<std::remove_cv_t<T>, N> to_array_lvalue_impl(
|
|
175
299
|
T (&a)[N], std::index_sequence<I...>) {
|
|
176
300
|
return {{a[I]...}};
|
|
177
301
|
}
|
|
178
302
|
|
|
179
303
|
template <class T, std::size_t N, std::size_t... I>
|
|
180
|
-
constexpr std::array<std::remove_cv_t<T>, N> to_array_rvalue_impl(
|
|
304
|
+
[[nodiscard]] constexpr std::array<std::remove_cv_t<T>, N> to_array_rvalue_impl(
|
|
181
305
|
T (&&a)[N], std::index_sequence<I...>) {
|
|
182
306
|
return {{std::move(a[I])...}};
|
|
183
307
|
}
|
|
184
308
|
} // namespace detail
|
|
185
309
|
|
|
186
310
|
template <class T, std::size_t N>
|
|
187
|
-
constexpr std::array<std::remove_cv_t<T>, N> to_array(T (&a)[N]) {
|
|
311
|
+
[[nodiscard]] constexpr std::array<std::remove_cv_t<T>, N> to_array(T (&a)[N]) {
|
|
188
312
|
return detail::to_array_lvalue_impl(a, std::make_index_sequence<N>{});
|
|
189
313
|
}
|
|
190
314
|
|
|
191
315
|
template <class T, std::size_t N>
|
|
192
|
-
constexpr std::array<std::remove_cv_t<T>, N> to_array(
|
|
316
|
+
[[nodiscard]] constexpr std::array<std::remove_cv_t<T>, N> to_array(
|
|
317
|
+
T (&&a)[N]) {
|
|
193
318
|
return detail::to_array_rvalue_impl(std::move(a),
|
|
194
319
|
std::make_index_sequence<N>{});
|
|
195
320
|
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
#include <iosfwd>
|
|
11
11
|
|
|
12
|
+
#include "v8-callbacks.h" // NOLINT(build/include_directory)
|
|
12
13
|
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
|
13
14
|
#include "v8-maybe.h" // NOLINT(build/include_directory)
|
|
14
15
|
#include "v8-primitive.h" // NOLINT(build/include_directory)
|
|
@@ -61,27 +62,6 @@ class ScriptOriginOptions {
|
|
|
61
62
|
*/
|
|
62
63
|
class V8_EXPORT ScriptOrigin {
|
|
63
64
|
public:
|
|
64
|
-
V8_DEPRECATE_SOON("Use constructor without the isolate.")
|
|
65
|
-
V8_INLINE ScriptOrigin(Isolate* isolate, Local<Value> resource_name,
|
|
66
|
-
int resource_line_offset = 0,
|
|
67
|
-
int resource_column_offset = 0,
|
|
68
|
-
bool resource_is_shared_cross_origin = false,
|
|
69
|
-
int script_id = -1,
|
|
70
|
-
Local<Value> source_map_url = Local<Value>(),
|
|
71
|
-
bool resource_is_opaque = false, bool is_wasm = false,
|
|
72
|
-
bool is_module = false,
|
|
73
|
-
Local<Data> host_defined_options = Local<Data>())
|
|
74
|
-
: resource_name_(resource_name),
|
|
75
|
-
resource_line_offset_(resource_line_offset),
|
|
76
|
-
resource_column_offset_(resource_column_offset),
|
|
77
|
-
options_(resource_is_shared_cross_origin, resource_is_opaque, is_wasm,
|
|
78
|
-
is_module),
|
|
79
|
-
script_id_(script_id),
|
|
80
|
-
source_map_url_(source_map_url),
|
|
81
|
-
host_defined_options_(host_defined_options) {
|
|
82
|
-
VerifyHostDefinedOptions();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
65
|
V8_INLINE ScriptOrigin(Local<Value> resource_name,
|
|
86
66
|
int resource_line_offset = 0,
|
|
87
67
|
int resource_column_offset = 0,
|
|
@@ -206,7 +186,14 @@ class V8_EXPORT Message {
|
|
|
206
186
|
bool IsSharedCrossOrigin() const;
|
|
207
187
|
bool IsOpaque() const;
|
|
208
188
|
|
|
209
|
-
|
|
189
|
+
/**
|
|
190
|
+
* If provided, the callback can be used to selectively include
|
|
191
|
+
* or redact frames based on their script names. (true to include a frame)
|
|
192
|
+
*/
|
|
193
|
+
static void PrintCurrentStackTrace(
|
|
194
|
+
Isolate* isolate, std::ostream& out,
|
|
195
|
+
PrintCurrentStackTraceFilterCallback should_include_frame_callback =
|
|
196
|
+
nullptr);
|
|
210
197
|
|
|
211
198
|
static const int kNoLineNumberInfo = 0;
|
|
212
199
|
static const int kNoColumnInfo = 0;
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
#include <stddef.h>
|
|
9
9
|
#include <stdint.h>
|
|
10
10
|
|
|
11
|
+
#include <optional>
|
|
11
12
|
#include <vector>
|
|
12
13
|
|
|
13
14
|
#include "v8-internal.h" // NOLINT(build/include_directory)
|
|
15
|
+
#include "v8-isolate.h" // NOLINT(build/include_directory)
|
|
14
16
|
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
|
15
17
|
#include "v8config.h" // NOLINT(build/include_directory)
|
|
16
18
|
|
|
@@ -37,6 +39,10 @@ struct GarbageCollectionSizes {
|
|
|
37
39
|
|
|
38
40
|
struct GarbageCollectionFullCycle {
|
|
39
41
|
int reason = -1;
|
|
42
|
+
// The priority of the isolate during the GC cycle. A nullopt value denotes a
|
|
43
|
+
// mixed priority cycle, meaning the Isolate's priority was changed while the
|
|
44
|
+
// cycle was in progress.
|
|
45
|
+
std::optional<v8::Isolate::Priority> priority = std::nullopt;
|
|
40
46
|
GarbageCollectionPhases total;
|
|
41
47
|
GarbageCollectionPhases total_cpp;
|
|
42
48
|
GarbageCollectionPhases main_thread;
|
|
@@ -55,6 +61,10 @@ struct GarbageCollectionFullCycle {
|
|
|
55
61
|
double efficiency_cpp_in_bytes_per_us = -1.0;
|
|
56
62
|
double main_thread_efficiency_in_bytes_per_us = -1.0;
|
|
57
63
|
double main_thread_efficiency_cpp_in_bytes_per_us = -1.0;
|
|
64
|
+
double collection_weight_in_percent = -1.0;
|
|
65
|
+
double collection_weight_cpp_in_percent = -1.0;
|
|
66
|
+
double main_thread_collection_weight_in_percent = -1.0;
|
|
67
|
+
double main_thread_collection_weight_cpp_in_percent = -1.0;
|
|
58
68
|
int64_t incremental_marking_start_stop_wall_clock_duration_in_us = -1;
|
|
59
69
|
};
|
|
60
70
|
|
|
@@ -82,6 +92,10 @@ using GarbageCollectionFullMainThreadBatchedIncrementalSweep =
|
|
|
82
92
|
|
|
83
93
|
struct GarbageCollectionYoungCycle {
|
|
84
94
|
int reason = -1;
|
|
95
|
+
// The priority of the isolate during the GC cycle. A nullopt value denotes a
|
|
96
|
+
// mixed priority cycle, meaning the Isolate's priority was changed while the
|
|
97
|
+
// cycle was in progress.
|
|
98
|
+
std::optional<v8::Isolate::Priority> priority = std::nullopt;
|
|
85
99
|
int64_t total_wall_clock_duration_in_us = -1;
|
|
86
100
|
int64_t main_thread_wall_clock_duration_in_us = -1;
|
|
87
101
|
double collection_rate_in_percent = -1.0;
|
|
@@ -118,11 +118,6 @@ class V8_EXPORT V8_NODISCARD MicrotasksScope {
|
|
|
118
118
|
public:
|
|
119
119
|
enum Type { kRunMicrotasks, kDoNotRunMicrotasks };
|
|
120
120
|
|
|
121
|
-
V8_DEPRECATE_SOON(
|
|
122
|
-
"May be incorrect if context was created with non-default microtask "
|
|
123
|
-
"queue")
|
|
124
|
-
MicrotasksScope(Isolate* isolate, Type type);
|
|
125
|
-
|
|
126
121
|
MicrotasksScope(Local<Context> context, Type type);
|
|
127
122
|
MicrotasksScope(Isolate* isolate, MicrotaskQueue* microtask_queue, Type type);
|
|
128
123
|
~MicrotasksScope();
|