libv8-node 15.5.1.0.beta1-arm64-darwin-20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/ext/libv8-node/.location.yml +2 -0
  3. data/ext/libv8-node/location.rb +91 -0
  4. data/ext/libv8-node/paths.rb +30 -0
  5. data/lib/libv8-node.rb +1 -0
  6. data/lib/libv8/node.rb +11 -0
  7. data/lib/libv8/node/version.rb +7 -0
  8. data/vendor/v8/include/cppgc/allocation.h +173 -0
  9. data/vendor/v8/include/cppgc/common.h +26 -0
  10. data/vendor/v8/include/cppgc/custom-space.h +62 -0
  11. data/vendor/v8/include/cppgc/default-platform.h +76 -0
  12. data/vendor/v8/include/cppgc/garbage-collected.h +116 -0
  13. data/vendor/v8/include/cppgc/heap.h +139 -0
  14. data/vendor/v8/include/cppgc/internal/api-constants.h +47 -0
  15. data/vendor/v8/include/cppgc/internal/atomic-entry-flag.h +48 -0
  16. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +67 -0
  17. data/vendor/v8/include/cppgc/internal/compiler-specific.h +38 -0
  18. data/vendor/v8/include/cppgc/internal/finalizer-trait.h +90 -0
  19. data/vendor/v8/include/cppgc/internal/gc-info.h +45 -0
  20. data/vendor/v8/include/cppgc/internal/logging.h +50 -0
  21. data/vendor/v8/include/cppgc/internal/persistent-node.h +116 -0
  22. data/vendor/v8/include/cppgc/internal/pointer-policies.h +134 -0
  23. data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +30 -0
  24. data/vendor/v8/include/cppgc/internal/process-heap.h +34 -0
  25. data/vendor/v8/include/cppgc/internal/write-barrier.h +78 -0
  26. data/vendor/v8/include/cppgc/liveness-broker.h +68 -0
  27. data/vendor/v8/include/cppgc/macros.h +24 -0
  28. data/vendor/v8/include/cppgc/member.h +226 -0
  29. data/vendor/v8/include/cppgc/persistent.h +341 -0
  30. data/vendor/v8/include/cppgc/platform.h +130 -0
  31. data/vendor/v8/include/cppgc/prefinalizer.h +52 -0
  32. data/vendor/v8/include/cppgc/source-location.h +91 -0
  33. data/vendor/v8/include/cppgc/trace-trait.h +111 -0
  34. data/vendor/v8/include/cppgc/type-traits.h +109 -0
  35. data/vendor/v8/include/cppgc/visitor.h +213 -0
  36. data/vendor/v8/include/libplatform/libplatform-export.h +29 -0
  37. data/vendor/v8/include/libplatform/libplatform.h +106 -0
  38. data/vendor/v8/include/libplatform/v8-tracing.h +332 -0
  39. data/vendor/v8/include/v8-cppgc.h +226 -0
  40. data/vendor/v8/include/v8-fast-api-calls.h +388 -0
  41. data/vendor/v8/include/v8-inspector-protocol.h +13 -0
  42. data/vendor/v8/include/v8-inspector.h +327 -0
  43. data/vendor/v8/include/v8-internal.h +427 -0
  44. data/vendor/v8/include/v8-metrics.h +133 -0
  45. data/vendor/v8/include/v8-platform.h +684 -0
  46. data/vendor/v8/include/v8-profiler.h +1059 -0
  47. data/vendor/v8/include/v8-util.h +652 -0
  48. data/vendor/v8/include/v8-value-serializer-version.h +24 -0
  49. data/vendor/v8/include/v8-version-string.h +38 -0
  50. data/vendor/v8/include/v8-version.h +20 -0
  51. data/vendor/v8/include/v8-wasm-trap-handler-posix.h +31 -0
  52. data/vendor/v8/include/v8-wasm-trap-handler-win.h +28 -0
  53. data/vendor/v8/include/v8.h +12098 -0
  54. data/vendor/v8/include/v8config.h +484 -0
  55. data/vendor/v8/out.gn/libv8/obj/libv8_monolith.a +0 -0
  56. metadata +112 -0
@@ -0,0 +1,90 @@
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_INTERNAL_FINALIZER_TRAIT_H_
6
+ #define INCLUDE_CPPGC_INTERNAL_FINALIZER_TRAIT_H_
7
+
8
+ #include <type_traits>
9
+
10
+ #include "cppgc/type-traits.h"
11
+
12
+ namespace cppgc {
13
+ namespace internal {
14
+
15
+ using FinalizationCallback = void (*)(void*);
16
+
17
+ template <typename T, typename = void>
18
+ struct HasFinalizeGarbageCollectedObject : std::false_type {};
19
+
20
+ template <typename T>
21
+ struct HasFinalizeGarbageCollectedObject<
22
+ T, void_t<decltype(std::declval<T>().FinalizeGarbageCollectedObject())>>
23
+ : std::true_type {};
24
+
25
+ // The FinalizerTraitImpl specifies how to finalize objects.
26
+ template <typename T, bool isFinalized>
27
+ struct FinalizerTraitImpl;
28
+
29
+ template <typename T>
30
+ struct FinalizerTraitImpl<T, true> {
31
+ private:
32
+ // Dispatch to custom FinalizeGarbageCollectedObject().
33
+ struct Custom {
34
+ static void Call(void* obj) {
35
+ static_cast<T*>(obj)->FinalizeGarbageCollectedObject();
36
+ }
37
+ };
38
+
39
+ // Dispatch to regular destructor.
40
+ struct Destructor {
41
+ static void Call(void* obj) { static_cast<T*>(obj)->~T(); }
42
+ };
43
+
44
+ using FinalizeImpl =
45
+ std::conditional_t<HasFinalizeGarbageCollectedObject<T>::value, Custom,
46
+ Destructor>;
47
+
48
+ public:
49
+ static void Finalize(void* obj) {
50
+ static_assert(sizeof(T), "T must be fully defined");
51
+ FinalizeImpl::Call(obj);
52
+ }
53
+ };
54
+
55
+ template <typename T>
56
+ struct FinalizerTraitImpl<T, false> {
57
+ static void Finalize(void* obj) {
58
+ static_assert(sizeof(T), "T must be fully defined");
59
+ }
60
+ };
61
+
62
+ // The FinalizerTrait is used to determine if a type requires finalization and
63
+ // what finalization means.
64
+ template <typename T>
65
+ struct FinalizerTrait {
66
+ private:
67
+ // Object has a finalizer if it has
68
+ // - a custom FinalizeGarbageCollectedObject method, or
69
+ // - a destructor.
70
+ static constexpr bool kNonTrivialFinalizer =
71
+ internal::HasFinalizeGarbageCollectedObject<T>::value ||
72
+ !std::is_trivially_destructible<typename std::remove_cv<T>::type>::value;
73
+
74
+ static void Finalize(void* obj) {
75
+ internal::FinalizerTraitImpl<T, kNonTrivialFinalizer>::Finalize(obj);
76
+ }
77
+
78
+ public:
79
+ // The callback used to finalize an object of type T.
80
+ static constexpr FinalizationCallback kCallback =
81
+ kNonTrivialFinalizer ? Finalize : nullptr;
82
+ };
83
+
84
+ template <typename T>
85
+ constexpr FinalizationCallback FinalizerTrait<T>::kCallback;
86
+
87
+ } // namespace internal
88
+ } // namespace cppgc
89
+
90
+ #endif // INCLUDE_CPPGC_INTERNAL_FINALIZER_TRAIT_H_
@@ -0,0 +1,45 @@
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_INTERNAL_GC_INFO_H_
6
+ #define INCLUDE_CPPGC_INTERNAL_GC_INFO_H_
7
+
8
+ #include <stdint.h>
9
+
10
+ #include "cppgc/internal/finalizer-trait.h"
11
+ #include "cppgc/trace-trait.h"
12
+ #include "v8config.h" // NOLINT(build/include_directory)
13
+
14
+ namespace cppgc {
15
+ namespace internal {
16
+
17
+ using GCInfoIndex = uint16_t;
18
+
19
+ class V8_EXPORT RegisteredGCInfoIndex final {
20
+ public:
21
+ RegisteredGCInfoIndex(FinalizationCallback finalization_callback,
22
+ TraceCallback trace_callback, bool has_v_table);
23
+ GCInfoIndex GetIndex() const { return index_; }
24
+
25
+ private:
26
+ const GCInfoIndex index_;
27
+ };
28
+
29
+ // Trait determines how the garbage collector treats objects wrt. to traversing,
30
+ // finalization, and naming.
31
+ template <typename T>
32
+ struct GCInfoTrait {
33
+ static GCInfoIndex Index() {
34
+ static_assert(sizeof(T), "T must be fully defined");
35
+ static const RegisteredGCInfoIndex registered_index(
36
+ FinalizerTrait<T>::kCallback, TraceTrait<T>::Trace,
37
+ std::is_polymorphic<T>::value);
38
+ return registered_index.GetIndex();
39
+ }
40
+ };
41
+
42
+ } // namespace internal
43
+ } // namespace cppgc
44
+
45
+ #endif // INCLUDE_CPPGC_INTERNAL_GC_INFO_H_
@@ -0,0 +1,50 @@
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_INTERNAL_LOGGING_H_
6
+ #define INCLUDE_CPPGC_INTERNAL_LOGGING_H_
7
+
8
+ #include "cppgc/source-location.h"
9
+ #include "v8config.h" // NOLINT(build/include_directory)
10
+
11
+ namespace cppgc {
12
+ namespace internal {
13
+
14
+ void V8_EXPORT DCheckImpl(const char*,
15
+ const SourceLocation& = SourceLocation::Current());
16
+ [[noreturn]] void V8_EXPORT
17
+ FatalImpl(const char*, const SourceLocation& = SourceLocation::Current());
18
+
19
+ // Used to ignore -Wunused-variable.
20
+ template <typename>
21
+ struct EatParams {};
22
+
23
+ #if DEBUG
24
+ #define CPPGC_DCHECK_MSG(condition, message) \
25
+ do { \
26
+ if (V8_UNLIKELY(!(condition))) { \
27
+ ::cppgc::internal::DCheckImpl(message); \
28
+ } \
29
+ } while (false)
30
+ #else
31
+ #define CPPGC_DCHECK_MSG(condition, message) \
32
+ (static_cast<void>(::cppgc::internal::EatParams<decltype( \
33
+ static_cast<void>(condition), message)>{}))
34
+ #endif
35
+
36
+ #define CPPGC_DCHECK(condition) CPPGC_DCHECK_MSG(condition, #condition)
37
+
38
+ #define CPPGC_CHECK_MSG(condition, message) \
39
+ do { \
40
+ if (V8_UNLIKELY(!(condition))) { \
41
+ ::cppgc::internal::FatalImpl(message); \
42
+ } \
43
+ } while (false)
44
+
45
+ #define CPPGC_CHECK(condition) CPPGC_CHECK_MSG(condition, #condition)
46
+
47
+ } // namespace internal
48
+ } // namespace cppgc
49
+
50
+ #endif // INCLUDE_CPPGC_INTERNAL_LOGGING_H_
@@ -0,0 +1,116 @@
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_INTERNAL_PERSISTENT_NODE_H_
6
+ #define INCLUDE_CPPGC_INTERNAL_PERSISTENT_NODE_H_
7
+
8
+ #include <array>
9
+ #include <memory>
10
+ #include <vector>
11
+
12
+ #include "cppgc/internal/logging.h"
13
+ #include "cppgc/trace-trait.h"
14
+ #include "v8config.h" // NOLINT(build/include_directory)
15
+
16
+ namespace cppgc {
17
+
18
+ class Visitor;
19
+
20
+ namespace internal {
21
+
22
+ // PersistentNode represesents a variant of two states:
23
+ // 1) traceable node with a back pointer to the Persistent object;
24
+ // 2) freelist entry.
25
+ class PersistentNode final {
26
+ public:
27
+ PersistentNode() = default;
28
+
29
+ PersistentNode(const PersistentNode&) = delete;
30
+ PersistentNode& operator=(const PersistentNode&) = delete;
31
+
32
+ void InitializeAsUsedNode(void* owner, TraceCallback trace) {
33
+ owner_ = owner;
34
+ trace_ = trace;
35
+ }
36
+
37
+ void InitializeAsFreeNode(PersistentNode* next) {
38
+ next_ = next;
39
+ trace_ = nullptr;
40
+ }
41
+
42
+ void UpdateOwner(void* owner) {
43
+ CPPGC_DCHECK(IsUsed());
44
+ owner_ = owner;
45
+ }
46
+
47
+ PersistentNode* FreeListNext() const {
48
+ CPPGC_DCHECK(!IsUsed());
49
+ return next_;
50
+ }
51
+
52
+ void Trace(Visitor* visitor) const {
53
+ CPPGC_DCHECK(IsUsed());
54
+ trace_(visitor, owner_);
55
+ }
56
+
57
+ bool IsUsed() const { return trace_; }
58
+
59
+ void* owner() const {
60
+ CPPGC_DCHECK(IsUsed());
61
+ return owner_;
62
+ }
63
+
64
+ private:
65
+ // PersistentNode acts as a designated union:
66
+ // If trace_ != nullptr, owner_ points to the corresponding Persistent handle.
67
+ // Otherwise, next_ points to the next freed PersistentNode.
68
+ union {
69
+ void* owner_ = nullptr;
70
+ PersistentNode* next_;
71
+ };
72
+ TraceCallback trace_ = nullptr;
73
+ };
74
+
75
+ class V8_EXPORT PersistentRegion final {
76
+ using PersistentNodeSlots = std::array<PersistentNode, 256u>;
77
+
78
+ public:
79
+ PersistentRegion() = default;
80
+ // Clears Persistent fields to avoid stale pointers after heap teardown.
81
+ ~PersistentRegion();
82
+
83
+ PersistentRegion(const PersistentRegion&) = delete;
84
+ PersistentRegion& operator=(const PersistentRegion&) = delete;
85
+
86
+ PersistentNode* AllocateNode(void* owner, TraceCallback trace) {
87
+ if (!free_list_head_) {
88
+ EnsureNodeSlots();
89
+ }
90
+ PersistentNode* node = free_list_head_;
91
+ free_list_head_ = free_list_head_->FreeListNext();
92
+ node->InitializeAsUsedNode(owner, trace);
93
+ return node;
94
+ }
95
+
96
+ void FreeNode(PersistentNode* node) {
97
+ node->InitializeAsFreeNode(free_list_head_);
98
+ free_list_head_ = node;
99
+ }
100
+
101
+ void Trace(Visitor*);
102
+
103
+ size_t NodesInUse() const;
104
+
105
+ private:
106
+ void EnsureNodeSlots();
107
+
108
+ std::vector<std::unique_ptr<PersistentNodeSlots>> nodes_;
109
+ PersistentNode* free_list_head_ = nullptr;
110
+ };
111
+
112
+ } // namespace internal
113
+
114
+ } // namespace cppgc
115
+
116
+ #endif // INCLUDE_CPPGC_INTERNAL_PERSISTENT_NODE_H_
@@ -0,0 +1,134 @@
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_INTERNAL_POINTER_POLICIES_H_
6
+ #define INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_
7
+
8
+ #include <cstdint>
9
+ #include <type_traits>
10
+
11
+ #include "cppgc/internal/write-barrier.h"
12
+ #include "cppgc/source-location.h"
13
+ #include "v8config.h" // NOLINT(build/include_directory)
14
+
15
+ namespace cppgc {
16
+ namespace internal {
17
+
18
+ class PersistentRegion;
19
+
20
+ // Tags to distinguish between strong and weak member types.
21
+ class StrongMemberTag;
22
+ class WeakMemberTag;
23
+ class UntracedMemberTag;
24
+
25
+ struct DijkstraWriteBarrierPolicy {
26
+ static void InitializingBarrier(const void*, const void*) {
27
+ // Since in initializing writes the source object is always white, having no
28
+ // barrier doesn't break the tri-color invariant.
29
+ }
30
+ static void AssigningBarrier(const void* slot, const void* value) {
31
+ WriteBarrier::MarkingBarrier(slot, value);
32
+ }
33
+ };
34
+
35
+ struct NoWriteBarrierPolicy {
36
+ static void InitializingBarrier(const void*, const void*) {}
37
+ static void AssigningBarrier(const void*, const void*) {}
38
+ };
39
+
40
+ class V8_EXPORT EnabledCheckingPolicy {
41
+ protected:
42
+ EnabledCheckingPolicy();
43
+ void CheckPointer(const void* ptr);
44
+
45
+ private:
46
+ void* impl_;
47
+ };
48
+
49
+ class DisabledCheckingPolicy {
50
+ protected:
51
+ void CheckPointer(const void* raw) {}
52
+ };
53
+
54
+ #if V8_ENABLE_CHECKS
55
+ using DefaultCheckingPolicy = EnabledCheckingPolicy;
56
+ #else
57
+ using DefaultCheckingPolicy = DisabledCheckingPolicy;
58
+ #endif
59
+
60
+ class KeepLocationPolicy {
61
+ public:
62
+ constexpr const SourceLocation& Location() const { return location_; }
63
+
64
+ protected:
65
+ constexpr explicit KeepLocationPolicy(const SourceLocation& location)
66
+ : location_(location) {}
67
+
68
+ // KeepLocationPolicy must not copy underlying source locations.
69
+ KeepLocationPolicy(const KeepLocationPolicy&) = delete;
70
+ KeepLocationPolicy& operator=(const KeepLocationPolicy&) = delete;
71
+
72
+ // Location of the original moved from object should be preserved.
73
+ KeepLocationPolicy(KeepLocationPolicy&&) = default;
74
+ KeepLocationPolicy& operator=(KeepLocationPolicy&&) = default;
75
+
76
+ private:
77
+ SourceLocation location_;
78
+ };
79
+
80
+ class IgnoreLocationPolicy {
81
+ public:
82
+ constexpr SourceLocation Location() const { return {}; }
83
+
84
+ protected:
85
+ constexpr explicit IgnoreLocationPolicy(const SourceLocation&) {}
86
+ };
87
+
88
+ #if CPPGC_SUPPORTS_OBJECT_NAMES
89
+ using DefaultLocationPolicy = KeepLocationPolicy;
90
+ #else
91
+ using DefaultLocationPolicy = IgnoreLocationPolicy;
92
+ #endif
93
+
94
+ struct StrongPersistentPolicy {
95
+ using IsStrongPersistent = std::true_type;
96
+
97
+ static V8_EXPORT PersistentRegion& GetPersistentRegion(void* object);
98
+ };
99
+
100
+ struct WeakPersistentPolicy {
101
+ using IsStrongPersistent = std::false_type;
102
+
103
+ static V8_EXPORT PersistentRegion& GetPersistentRegion(void* object);
104
+ };
105
+
106
+ // Persistent/Member forward declarations.
107
+ template <typename T, typename WeaknessPolicy,
108
+ typename LocationPolicy = DefaultLocationPolicy,
109
+ typename CheckingPolicy = DefaultCheckingPolicy>
110
+ class BasicPersistent;
111
+ template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
112
+ typename CheckingPolicy = DefaultCheckingPolicy>
113
+ class BasicMember;
114
+
115
+ // Special tag type used to denote some sentinel member. The semantics of the
116
+ // sentinel is defined by the embedder.
117
+ struct SentinelPointer {
118
+ template <typename T>
119
+ operator T*() const { // NOLINT
120
+ static constexpr intptr_t kSentinelValue = 1;
121
+ return reinterpret_cast<T*>(kSentinelValue);
122
+ }
123
+ // Hidden friends.
124
+ friend bool operator==(SentinelPointer, SentinelPointer) { return true; }
125
+ friend bool operator!=(SentinelPointer, SentinelPointer) { return false; }
126
+ };
127
+
128
+ } // namespace internal
129
+
130
+ constexpr internal::SentinelPointer kSentinelPointer;
131
+
132
+ } // namespace cppgc
133
+
134
+ #endif // INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_
@@ -0,0 +1,30 @@
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_INTERNAL_PREFINALIZER_HANDLER_H_
6
+ #define INCLUDE_CPPGC_INTERNAL_PREFINALIZER_HANDLER_H_
7
+
8
+ #include "cppgc/heap.h"
9
+ #include "cppgc/liveness-broker.h"
10
+
11
+ namespace cppgc {
12
+ namespace internal {
13
+
14
+ class V8_EXPORT PreFinalizerRegistrationDispatcher final {
15
+ public:
16
+ using PreFinalizerCallback = bool (*)(const LivenessBroker&, void*);
17
+ struct PreFinalizer {
18
+ void* object;
19
+ PreFinalizerCallback callback;
20
+
21
+ bool operator==(const PreFinalizer& other);
22
+ };
23
+
24
+ static void RegisterPrefinalizer(PreFinalizer pre_finalizer);
25
+ };
26
+
27
+ } // namespace internal
28
+ } // namespace cppgc
29
+
30
+ #endif // INCLUDE_CPPGC_INTERNAL_PREFINALIZER_HANDLER_H_