libv8-node 16.10.0.0-x86_64-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/ext/libv8-node/.location.yml +1 -0
  3. data/ext/libv8-node/location.rb +76 -0
  4. data/ext/libv8-node/paths.rb +34 -0
  5. data/lib/libv8/node/version.rb +7 -0
  6. data/lib/libv8/node.rb +11 -0
  7. data/lib/libv8-node.rb +1 -0
  8. data/vendor/v8/include/cppgc/allocation.h +232 -0
  9. data/vendor/v8/include/cppgc/common.h +29 -0
  10. data/vendor/v8/include/cppgc/cross-thread-persistent.h +384 -0
  11. data/vendor/v8/include/cppgc/custom-space.h +97 -0
  12. data/vendor/v8/include/cppgc/default-platform.h +75 -0
  13. data/vendor/v8/include/cppgc/ephemeron-pair.h +30 -0
  14. data/vendor/v8/include/cppgc/explicit-management.h +82 -0
  15. data/vendor/v8/include/cppgc/garbage-collected.h +117 -0
  16. data/vendor/v8/include/cppgc/heap-consistency.h +236 -0
  17. data/vendor/v8/include/cppgc/heap-state.h +70 -0
  18. data/vendor/v8/include/cppgc/heap-statistics.h +120 -0
  19. data/vendor/v8/include/cppgc/heap.h +201 -0
  20. data/vendor/v8/include/cppgc/internal/api-constants.h +47 -0
  21. data/vendor/v8/include/cppgc/internal/atomic-entry-flag.h +48 -0
  22. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +68 -0
  23. data/vendor/v8/include/cppgc/internal/compiler-specific.h +38 -0
  24. data/vendor/v8/include/cppgc/internal/finalizer-trait.h +90 -0
  25. data/vendor/v8/include/cppgc/internal/gc-info.h +76 -0
  26. data/vendor/v8/include/cppgc/internal/logging.h +50 -0
  27. data/vendor/v8/include/cppgc/internal/name-trait.h +111 -0
  28. data/vendor/v8/include/cppgc/internal/persistent-node.h +172 -0
  29. data/vendor/v8/include/cppgc/internal/pointer-policies.h +175 -0
  30. data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +30 -0
  31. data/vendor/v8/include/cppgc/internal/write-barrier.h +396 -0
  32. data/vendor/v8/include/cppgc/liveness-broker.h +74 -0
  33. data/vendor/v8/include/cppgc/macros.h +26 -0
  34. data/vendor/v8/include/cppgc/member.h +286 -0
  35. data/vendor/v8/include/cppgc/name-provider.h +65 -0
  36. data/vendor/v8/include/cppgc/object-size-trait.h +58 -0
  37. data/vendor/v8/include/cppgc/persistent.h +365 -0
  38. data/vendor/v8/include/cppgc/platform.h +153 -0
  39. data/vendor/v8/include/cppgc/prefinalizer.h +52 -0
  40. data/vendor/v8/include/cppgc/process-heap-statistics.h +36 -0
  41. data/vendor/v8/include/cppgc/sentinel-pointer.h +32 -0
  42. data/vendor/v8/include/cppgc/source-location.h +92 -0
  43. data/vendor/v8/include/cppgc/testing.h +99 -0
  44. data/vendor/v8/include/cppgc/trace-trait.h +116 -0
  45. data/vendor/v8/include/cppgc/type-traits.h +247 -0
  46. data/vendor/v8/include/cppgc/visitor.h +377 -0
  47. data/vendor/v8/include/libplatform/libplatform-export.h +29 -0
  48. data/vendor/v8/include/libplatform/libplatform.h +117 -0
  49. data/vendor/v8/include/libplatform/v8-tracing.h +334 -0
  50. data/vendor/v8/include/v8-cppgc.h +325 -0
  51. data/vendor/v8/include/v8-fast-api-calls.h +791 -0
  52. data/vendor/v8/include/v8-inspector-protocol.h +13 -0
  53. data/vendor/v8/include/v8-inspector.h +348 -0
  54. data/vendor/v8/include/v8-internal.h +499 -0
  55. data/vendor/v8/include/v8-metrics.h +202 -0
  56. data/vendor/v8/include/v8-platform.h +709 -0
  57. data/vendor/v8/include/v8-profiler.h +1123 -0
  58. data/vendor/v8/include/v8-unwinder-state.h +30 -0
  59. data/vendor/v8/include/v8-util.h +652 -0
  60. data/vendor/v8/include/v8-value-serializer-version.h +24 -0
  61. data/vendor/v8/include/v8-version-string.h +38 -0
  62. data/vendor/v8/include/v8-version.h +20 -0
  63. data/vendor/v8/include/v8-wasm-trap-handler-posix.h +31 -0
  64. data/vendor/v8/include/v8-wasm-trap-handler-win.h +28 -0
  65. data/vendor/v8/include/v8.h +12648 -0
  66. data/vendor/v8/include/v8config.h +515 -0
  67. data/vendor/v8/x86_64-darwin/libv8/obj/libv8_monolith.a +0 -0
  68. metadata +138 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5924d92beb20a979b10cf256446714cc68437ab79326b59d195f72de8ac5fcc4
4
+ data.tar.gz: '000396d9580179762dda3a7cfcb5e6028019ad3ad1fd2d70f4cbfdeadaf2ae48'
5
+ SHA512:
6
+ metadata.gz: 1668e2916b9ec51747013e4b702a536ae4b230a8f1cd3ceae88798860c6618cae5dedc7ccd8d4e54e9c031ec8ab13f513a20c11f1a3c21dc9c71ad96f277a444
7
+ data.tar.gz: 4fb5f36278af7dc3951296c6c25fcdc2a2aeb835b4bc6c870c52fbe46a699e23da42d5348544144b51c2b05f4af1dfff975e0d8097146e94791dc1e67833172a
@@ -0,0 +1 @@
1
+ --- !ruby/object:Libv8::Node::Location::Vendor {}
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+ require 'pathname'
5
+ require File.expand_path('paths', __dir__)
6
+
7
+ module Libv8; end
8
+
9
+ module Libv8::Node
10
+ class Location
11
+ def install!
12
+ File.open(Pathname(__FILE__).dirname.join('.location.yml'), 'w') do |f|
13
+ f.write(to_yaml)
14
+ end
15
+
16
+ 0
17
+ end
18
+
19
+ def self.load!
20
+ File.open(Pathname(__FILE__).dirname.join('.location.yml')) do |f|
21
+ YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(f) : YAML.load(f) # rubocop:disable Security/YAMLLoad
22
+ end
23
+ end
24
+
25
+ class Vendor < Location
26
+ def install!
27
+ require File.expand_path('builder', __dir__)
28
+
29
+ builder = Libv8::Node::Builder.new
30
+ exit_status = builder.build_libv8!
31
+ builder.remove_intermediates!
32
+
33
+ super if exit_status == 0
34
+
35
+ verify_installation!
36
+
37
+ exit_status
38
+ end
39
+
40
+ def configure(context = MkmfContext.new)
41
+ context.incflags.insert(0, Libv8::Node::Paths.include_paths.map { |p| "-I#{p}" }.join(' ') << ' ')
42
+ context.ldflags.insert(0, Libv8::Node::Paths.object_paths.join(' ') << ' ')
43
+ end
44
+
45
+ def verify_installation!
46
+ include_paths = Libv8::Node::Paths.include_paths
47
+
48
+ unless include_paths.detect { |p| Pathname(p).join('v8.h').exist? }
49
+ raise(HeaderNotFound, "Unable to locate 'v8.h' in the libv8 header paths: #{include_paths.inspect}")
50
+ end
51
+
52
+ Libv8::Node::Paths.object_paths.each do |p|
53
+ raise(ArchiveNotFound, p) unless File.exist?(p)
54
+ end
55
+ end
56
+
57
+ class HeaderNotFound < StandardError; end
58
+
59
+ class ArchiveNotFound < StandardError
60
+ def initialize(filename)
61
+ super "libv8 did not install properly, expected binary v8 archive '#{filename}'to exist, but it was not found"
62
+ end
63
+ end
64
+ end
65
+
66
+ class MkmfContext
67
+ def incflags
68
+ $INCFLAGS # rubocop:disable Style/GlobalVars
69
+ end
70
+
71
+ def ldflags
72
+ $LDFLAGS # rubocop:disable Style/GlobalVars
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,34 @@
1
+ require 'rbconfig'
2
+ require 'shellwords'
3
+
4
+ module Libv8; end
5
+
6
+ module Libv8::Node
7
+ module Paths
8
+ module_function
9
+
10
+ def include_paths
11
+ [Shellwords.escape(File.join(vendored_source_path, 'include'))]
12
+ end
13
+
14
+ def object_paths
15
+ [Shellwords.escape(File.join(vendored_source_path,
16
+ platform,
17
+ 'libv8',
18
+ 'obj',
19
+ "libv8_monolith.#{config['LIBEXT']}"))]
20
+ end
21
+
22
+ def platform
23
+ Gem::Platform.local.to_s.gsub(/-darwin-?\d+/, '-darwin')
24
+ end
25
+
26
+ def config
27
+ RbConfig::MAKEFILE_CONFIG
28
+ end
29
+
30
+ def vendored_source_path
31
+ File.expand_path('../../vendor/v8', __dir__)
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ module Libv8; end
2
+
3
+ module Libv8::Node
4
+ VERSION = '16.10.0.0'.freeze
5
+ NODE_VERSION = '16.10.0'.freeze
6
+ LIBV8_VERSION = '9.3.345.19'.freeze # from v8/include/v8-version.h
7
+ end
data/lib/libv8/node.rb ADDED
@@ -0,0 +1,11 @@
1
+ require 'libv8/node/version'
2
+ require 'libv8-node/location'
3
+
4
+ module Libv8; end
5
+
6
+ module Libv8::Node
7
+ def self.configure_makefile
8
+ location = Location.load!
9
+ location.configure
10
+ end
11
+ end
data/lib/libv8-node.rb ADDED
@@ -0,0 +1 @@
1
+ require 'libv8/node'
@@ -0,0 +1,232 @@
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_ALLOCATION_H_
6
+ #define INCLUDE_CPPGC_ALLOCATION_H_
7
+
8
+ #include <atomic>
9
+ #include <cstddef>
10
+ #include <cstdint>
11
+ #include <new>
12
+ #include <type_traits>
13
+
14
+ #include "cppgc/custom-space.h"
15
+ #include "cppgc/internal/api-constants.h"
16
+ #include "cppgc/internal/gc-info.h"
17
+ #include "cppgc/type-traits.h"
18
+ #include "v8config.h" // NOLINT(build/include_directory)
19
+
20
+ namespace cppgc {
21
+
22
+ /**
23
+ * AllocationHandle is used to allocate garbage-collected objects.
24
+ */
25
+ class AllocationHandle;
26
+
27
+ namespace internal {
28
+
29
+ class V8_EXPORT MakeGarbageCollectedTraitInternal {
30
+ protected:
31
+ static inline void MarkObjectAsFullyConstructed(const void* payload) {
32
+ // See api_constants for an explanation of the constants.
33
+ std::atomic<uint16_t>* atomic_mutable_bitfield =
34
+ reinterpret_cast<std::atomic<uint16_t>*>(
35
+ const_cast<uint16_t*>(reinterpret_cast<const uint16_t*>(
36
+ reinterpret_cast<const uint8_t*>(payload) -
37
+ api_constants::kFullyConstructedBitFieldOffsetFromPayload)));
38
+ atomic_mutable_bitfield->fetch_or(api_constants::kFullyConstructedBitMask,
39
+ std::memory_order_release);
40
+ }
41
+
42
+ template <typename U, typename CustomSpace>
43
+ struct SpacePolicy {
44
+ static void* Allocate(AllocationHandle& handle, size_t size) {
45
+ // Custom space.
46
+ static_assert(std::is_base_of<CustomSpaceBase, CustomSpace>::value,
47
+ "Custom space must inherit from CustomSpaceBase.");
48
+ return MakeGarbageCollectedTraitInternal::Allocate(
49
+ handle, size, internal::GCInfoTrait<U>::Index(),
50
+ CustomSpace::kSpaceIndex);
51
+ }
52
+ };
53
+
54
+ template <typename U>
55
+ struct SpacePolicy<U, void> {
56
+ static void* Allocate(AllocationHandle& handle, size_t size) {
57
+ // Default space.
58
+ return MakeGarbageCollectedTraitInternal::Allocate(
59
+ handle, size, internal::GCInfoTrait<U>::Index());
60
+ }
61
+ };
62
+
63
+ private:
64
+ static void* Allocate(cppgc::AllocationHandle& handle, size_t size,
65
+ GCInfoIndex index);
66
+ static void* Allocate(cppgc::AllocationHandle& handle, size_t size,
67
+ GCInfoIndex index, CustomSpaceIndex space_index);
68
+
69
+ friend class HeapObjectHeader;
70
+ };
71
+
72
+ } // namespace internal
73
+
74
+ /**
75
+ * Base trait that provides utilities for advancers users that have custom
76
+ * allocation needs (e.g., overriding size). It's expected that users override
77
+ * MakeGarbageCollectedTrait (see below) and inherit from
78
+ * MakeGarbageCollectedTraitBase and make use of the low-level primitives
79
+ * offered to allocate and construct an object.
80
+ */
81
+ template <typename T>
82
+ class MakeGarbageCollectedTraitBase
83
+ : private internal::MakeGarbageCollectedTraitInternal {
84
+ private:
85
+ static_assert(internal::IsGarbageCollectedType<T>::value,
86
+ "T needs to be a garbage collected object");
87
+ static_assert(!IsGarbageCollectedWithMixinTypeV<T> ||
88
+ sizeof(T) <=
89
+ internal::api_constants::kLargeObjectSizeThreshold,
90
+ "GarbageCollectedMixin may not be a large object");
91
+
92
+ protected:
93
+ /**
94
+ * Allocates memory for an object of type T.
95
+ *
96
+ * \param handle AllocationHandle identifying the heap to allocate the object
97
+ * on.
98
+ * \param size The size that should be reserved for the object.
99
+ * \returns the memory to construct an object of type T on.
100
+ */
101
+ V8_INLINE static void* Allocate(AllocationHandle& handle, size_t size) {
102
+ static_assert(
103
+ std::is_base_of<typename T::ParentMostGarbageCollectedType, T>::value,
104
+ "U of GarbageCollected<U> must be a base of T. Check "
105
+ "GarbageCollected<T> base class inheritance.");
106
+ return SpacePolicy<
107
+ typename internal::GCInfoFolding<
108
+ T, typename T::ParentMostGarbageCollectedType>::ResultType,
109
+ typename SpaceTrait<T>::Space>::Allocate(handle, size);
110
+ }
111
+
112
+ /**
113
+ * Marks an object as fully constructed, resulting in precise handling by the
114
+ * garbage collector.
115
+ *
116
+ * \param payload The base pointer the object is allocated at.
117
+ */
118
+ V8_INLINE static void MarkObjectAsFullyConstructed(const void* payload) {
119
+ internal::MakeGarbageCollectedTraitInternal::MarkObjectAsFullyConstructed(
120
+ payload);
121
+ }
122
+ };
123
+
124
+ /**
125
+ * Passed to MakeGarbageCollected to specify how many bytes should be appended
126
+ * to the allocated object.
127
+ *
128
+ * Example:
129
+ * \code
130
+ * class InlinedArray final : public GarbageCollected<InlinedArray> {
131
+ * public:
132
+ * explicit InlinedArray(size_t bytes) : size(bytes), byte_array(this + 1) {}
133
+ * void Trace(Visitor*) const {}
134
+
135
+ * size_t size;
136
+ * char* byte_array;
137
+ * };
138
+ *
139
+ * auto* inlined_array = MakeGarbageCollected<InlinedArray(
140
+ * GetAllocationHandle(), AdditionalBytes(4), 4);
141
+ * for (size_t i = 0; i < 4; i++) {
142
+ * Process(inlined_array->byte_array[i]);
143
+ * }
144
+ * \endcode
145
+ */
146
+ struct AdditionalBytes {
147
+ constexpr explicit AdditionalBytes(size_t bytes) : value(bytes) {}
148
+ const size_t value;
149
+ };
150
+
151
+ /**
152
+ * Default trait class that specifies how to construct an object of type T.
153
+ * Advanced users may override how an object is constructed using the utilities
154
+ * that are provided through MakeGarbageCollectedTraitBase.
155
+ *
156
+ * Any trait overriding construction must
157
+ * - allocate through `MakeGarbageCollectedTraitBase<T>::Allocate`;
158
+ * - mark the object as fully constructed using
159
+ * `MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed`;
160
+ */
161
+ template <typename T>
162
+ class MakeGarbageCollectedTrait : public MakeGarbageCollectedTraitBase<T> {
163
+ public:
164
+ template <typename... Args>
165
+ static T* Call(AllocationHandle& handle, Args&&... args) {
166
+ void* memory =
167
+ MakeGarbageCollectedTraitBase<T>::Allocate(handle, sizeof(T));
168
+ T* object = ::new (memory) T(std::forward<Args>(args)...);
169
+ MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed(object);
170
+ return object;
171
+ }
172
+
173
+ template <typename... Args>
174
+ static T* Call(AllocationHandle& handle, AdditionalBytes additional_bytes,
175
+ Args&&... args) {
176
+ void* memory = MakeGarbageCollectedTraitBase<T>::Allocate(
177
+ handle, sizeof(T) + additional_bytes.value);
178
+ T* object = ::new (memory) T(std::forward<Args>(args)...);
179
+ MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed(object);
180
+ return object;
181
+ }
182
+ };
183
+
184
+ /**
185
+ * Allows users to specify a post-construction callback for specific types. The
186
+ * callback is invoked on the instance of type T right after it has been
187
+ * constructed. This can be useful when the callback requires a
188
+ * fully-constructed object to be able to dispatch to virtual methods.
189
+ */
190
+ template <typename T, typename = void>
191
+ struct PostConstructionCallbackTrait {
192
+ static void Call(T*) {}
193
+ };
194
+
195
+ /**
196
+ * Constructs a managed object of type T where T transitively inherits from
197
+ * GarbageCollected.
198
+ *
199
+ * \param args List of arguments with which an instance of T will be
200
+ * constructed.
201
+ * \returns an instance of type T.
202
+ */
203
+ template <typename T, typename... Args>
204
+ T* MakeGarbageCollected(AllocationHandle& handle, Args&&... args) {
205
+ T* object =
206
+ MakeGarbageCollectedTrait<T>::Call(handle, std::forward<Args>(args)...);
207
+ PostConstructionCallbackTrait<T>::Call(object);
208
+ return object;
209
+ }
210
+
211
+ /**
212
+ * Constructs a managed object of type T where T transitively inherits from
213
+ * GarbageCollected. Created objects will have additional bytes appended to
214
+ * it. Allocated memory would suffice for `sizeof(T) + additional_bytes`.
215
+ *
216
+ * \param additional_bytes Denotes how many bytes to append to T.
217
+ * \param args List of arguments with which an instance of T will be
218
+ * constructed.
219
+ * \returns an instance of type T.
220
+ */
221
+ template <typename T, typename... Args>
222
+ T* MakeGarbageCollected(AllocationHandle& handle,
223
+ AdditionalBytes additional_bytes, Args&&... args) {
224
+ T* object = MakeGarbageCollectedTrait<T>::Call(handle, additional_bytes,
225
+ std::forward<Args>(args)...);
226
+ PostConstructionCallbackTrait<T>::Call(object);
227
+ return object;
228
+ }
229
+
230
+ } // namespace cppgc
231
+
232
+ #endif // INCLUDE_CPPGC_ALLOCATION_H_
@@ -0,0 +1,29 @@
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_COMMON_H_
6
+ #define INCLUDE_CPPGC_COMMON_H_
7
+
8
+ // TODO(chromium:1056170): Remove dependency on v8.
9
+ #include "v8config.h" // NOLINT(build/include_directory)
10
+
11
+ namespace cppgc {
12
+
13
+ /**
14
+ * Indicator for the stack state of the embedder.
15
+ */
16
+ enum class EmbedderStackState {
17
+ /**
18
+ * Stack may contain interesting heap pointers.
19
+ */
20
+ kMayContainHeapPointers,
21
+ /**
22
+ * Stack does not contain any interesting heap pointers.
23
+ */
24
+ kNoHeapPointers,
25
+ };
26
+
27
+ } // namespace cppgc
28
+
29
+ #endif // INCLUDE_CPPGC_COMMON_H_