libv8-node 15.5.1.0.beta1-aarch64-linux-musl

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 +1 -0
  3. data/ext/libv8-node/location.rb +76 -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 +126 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 97da1ad17a32768ef6959889081f2b81542a2ca5bc8bc61b2aab8eb116b4bd1b
4
+ data.tar.gz: 4be6e795be9498959db76f1d77853edfc900736c733b5c319eb15b62c8a13b4c
5
+ SHA512:
6
+ metadata.gz: 8c93acc85f563e268e3faf1a7558561cf7863f14b69210a133e976d32617577e35a9f5f21c7f2b479b82e8127f6023a1e6258ca17383dee2283b14db8d3267ce
7
+ data.tar.gz: 4f97ebc39e4d38091674762120af9c4bcbc523f3b0002fb7822d5499510fd3a68a3f0cb944e3c1463c1a78a9931e0b8672b37475f8dce17cd0327ee024530568
@@ -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.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,30 @@
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
+ 'out.gn',
17
+ 'libv8',
18
+ 'obj',
19
+ "libv8_monolith.#{config['LIBEXT']}"))]
20
+ end
21
+
22
+ def config
23
+ RbConfig::MAKEFILE_CONFIG
24
+ end
25
+
26
+ def vendored_source_path
27
+ File.expand_path('../../vendor/v8', __dir__)
28
+ end
29
+ end
30
+ end
data/lib/libv8-node.rb ADDED
@@ -0,0 +1 @@
1
+ require 'libv8/node'
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
@@ -0,0 +1,7 @@
1
+ module Libv8; end
2
+
3
+ module Libv8::Node
4
+ VERSION = '15.5.1.0.beta1'.freeze
5
+ NODE_VERSION = '15.5.1'.freeze
6
+ LIBV8_VERSION = '8.6.395.17'.freeze # from v8/include/v8-version.h
7
+ end
@@ -0,0 +1,173 @@
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 <stdint.h>
9
+
10
+ #include <atomic>
11
+
12
+ #include "cppgc/custom-space.h"
13
+ #include "cppgc/garbage-collected.h"
14
+ #include "cppgc/internal/api-constants.h"
15
+ #include "cppgc/internal/gc-info.h"
16
+
17
+ namespace cppgc {
18
+
19
+ template <typename T>
20
+ class MakeGarbageCollectedTraitBase;
21
+
22
+ namespace internal {
23
+ class ObjectAllocator;
24
+ } // namespace internal
25
+
26
+ /**
27
+ * AllocationHandle is used to allocate garbage-collected objects.
28
+ */
29
+ class AllocationHandle;
30
+
31
+ namespace internal {
32
+
33
+ class V8_EXPORT MakeGarbageCollectedTraitInternal {
34
+ protected:
35
+ static inline void MarkObjectAsFullyConstructed(const void* payload) {
36
+ // See api_constants for an explanation of the constants.
37
+ std::atomic<uint16_t>* atomic_mutable_bitfield =
38
+ reinterpret_cast<std::atomic<uint16_t>*>(
39
+ const_cast<uint16_t*>(reinterpret_cast<const uint16_t*>(
40
+ reinterpret_cast<const uint8_t*>(payload) -
41
+ api_constants::kFullyConstructedBitFieldOffsetFromPayload)));
42
+ uint16_t value = atomic_mutable_bitfield->load(std::memory_order_relaxed);
43
+ value = value | api_constants::kFullyConstructedBitMask;
44
+ atomic_mutable_bitfield->store(value, std::memory_order_release);
45
+ }
46
+
47
+ static void* Allocate(cppgc::AllocationHandle& handle, size_t size,
48
+ GCInfoIndex index);
49
+ static void* Allocate(cppgc::AllocationHandle& handle, size_t size,
50
+ GCInfoIndex index, CustomSpaceIndex space_index);
51
+
52
+ friend class HeapObjectHeader;
53
+ };
54
+
55
+ } // namespace internal
56
+
57
+ /**
58
+ * Base trait that provides utilities for advancers users that have custom
59
+ * allocation needs (e.g., overriding size). It's expected that users override
60
+ * MakeGarbageCollectedTrait (see below) and inherit from
61
+ * MakeGarbageCollectedTraitBase and make use of the low-level primitives
62
+ * offered to allocate and construct an object.
63
+ */
64
+ template <typename T>
65
+ class MakeGarbageCollectedTraitBase
66
+ : private internal::MakeGarbageCollectedTraitInternal {
67
+ private:
68
+ template <typename U, typename CustomSpace>
69
+ struct SpacePolicy {
70
+ static void* Allocate(AllocationHandle& handle, size_t size) {
71
+ // Custom space.
72
+ static_assert(std::is_base_of<CustomSpaceBase, CustomSpace>::value,
73
+ "Custom space must inherit from CustomSpaceBase.");
74
+ return internal::MakeGarbageCollectedTraitInternal::Allocate(
75
+ handle, size, internal::GCInfoTrait<T>::Index(),
76
+ CustomSpace::kSpaceIndex);
77
+ }
78
+ };
79
+
80
+ template <typename U>
81
+ struct SpacePolicy<U, void> {
82
+ static void* Allocate(AllocationHandle& handle, size_t size) {
83
+ // Default space.
84
+ return internal::MakeGarbageCollectedTraitInternal::Allocate(
85
+ handle, size, internal::GCInfoTrait<T>::Index());
86
+ }
87
+ };
88
+
89
+ protected:
90
+ /**
91
+ * Allocates memory for an object of type T.
92
+ *
93
+ * \param handle AllocationHandle identifying the heap to allocate the object
94
+ * on.
95
+ * \param size The size that should be reserved for the object.
96
+ * \returns the memory to construct an object of type T on.
97
+ */
98
+ static void* Allocate(AllocationHandle& handle, size_t size) {
99
+ return SpacePolicy<T, typename SpaceTrait<T>::Space>::Allocate(handle,
100
+ size);
101
+ }
102
+
103
+ /**
104
+ * Marks an object as fully constructed, resulting in precise handling by the
105
+ * garbage collector.
106
+ *
107
+ * \param payload The base pointer the object is allocated at.
108
+ */
109
+ static void MarkObjectAsFullyConstructed(const void* payload) {
110
+ internal::MakeGarbageCollectedTraitInternal::MarkObjectAsFullyConstructed(
111
+ payload);
112
+ }
113
+ };
114
+
115
+ /**
116
+ * Default trait class that specifies how to construct an object of type T.
117
+ * Advanced users may override how an object is constructed using the utilities
118
+ * that are provided through MakeGarbageCollectedTraitBase.
119
+ *
120
+ * Any trait overriding construction must
121
+ * - allocate through MakeGarbageCollectedTraitBase<T>::Allocate;
122
+ * - mark the object as fully constructed using
123
+ * MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed;
124
+ */
125
+ template <typename T>
126
+ class MakeGarbageCollectedTrait : public MakeGarbageCollectedTraitBase<T> {
127
+ public:
128
+ template <typename... Args>
129
+ static T* Call(AllocationHandle& handle, Args&&... args) {
130
+ static_assert(internal::IsGarbageCollectedType<T>::value,
131
+ "T needs to be a garbage collected object");
132
+ static_assert(
133
+ !internal::IsGarbageCollectedMixinType<T>::value ||
134
+ sizeof(T) <= internal::api_constants::kLargeObjectSizeThreshold,
135
+ "GarbageCollectedMixin may not be a large object");
136
+ void* memory =
137
+ MakeGarbageCollectedTraitBase<T>::Allocate(handle, sizeof(T));
138
+ T* object = ::new (memory) T(std::forward<Args>(args)...);
139
+ MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed(object);
140
+ return object;
141
+ }
142
+ };
143
+
144
+ /**
145
+ * Allows users to specify a post-construction callback for specific types. The
146
+ * callback is invoked on the instance of type T right after it has been
147
+ * constructed. This can be useful when the callback requires a
148
+ * fully-constructed object to be able to dispatch to virtual methods.
149
+ */
150
+ template <typename T, typename = void>
151
+ struct PostConstructionCallbackTrait {
152
+ static void Call(T*) {}
153
+ };
154
+
155
+ /**
156
+ * Constructs a managed object of type T where T transitively inherits from
157
+ * GarbageCollected.
158
+ *
159
+ * \param args List of arguments with which an instance of T will be
160
+ * constructed.
161
+ * \returns an instance of type T.
162
+ */
163
+ template <typename T, typename... Args>
164
+ T* MakeGarbageCollected(AllocationHandle& handle, Args&&... args) {
165
+ T* object =
166
+ MakeGarbageCollectedTrait<T>::Call(handle, std::forward<Args>(args)...);
167
+ PostConstructionCallbackTrait<T>::Call(object);
168
+ return object;
169
+ }
170
+
171
+ } // namespace cppgc
172
+
173
+ #endif // INCLUDE_CPPGC_ALLOCATION_H_
@@ -0,0 +1,26 @@
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
+ // Indicator for the stack state of the embedder.
14
+ enum class EmbedderStackState {
15
+ kMayContainHeapPointers,
16
+ kNoHeapPointers,
17
+ kUnknown V8_ENUM_DEPRECATE_SOON("Use kMayContainHeapPointers") =
18
+ kMayContainHeapPointers,
19
+ kNonEmpty V8_ENUM_DEPRECATE_SOON("Use kMayContainHeapPointers") =
20
+ kMayContainHeapPointers,
21
+ kEmpty V8_ENUM_DEPRECATE_SOON("Use kNoHeapPointers") = kNoHeapPointers,
22
+ };
23
+
24
+ } // namespace cppgc
25
+
26
+ #endif // INCLUDE_CPPGC_COMMON_H_
@@ -0,0 +1,62 @@
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_CUSTOM_SPACE_H_
6
+ #define INCLUDE_CPPGC_CUSTOM_SPACE_H_
7
+
8
+ #include <stddef.h>
9
+
10
+ namespace cppgc {
11
+
12
+ struct CustomSpaceIndex {
13
+ CustomSpaceIndex(size_t value) : value(value) {} // NOLINT
14
+ size_t value;
15
+ };
16
+
17
+ /**
18
+ * Top-level base class for custom spaces. Users must inherit from CustomSpace
19
+ * below.
20
+ */
21
+ class CustomSpaceBase {
22
+ public:
23
+ virtual ~CustomSpaceBase() = default;
24
+ virtual CustomSpaceIndex GetCustomSpaceIndex() const = 0;
25
+ };
26
+
27
+ /**
28
+ * Base class custom spaces should directly inherit from. The class inheriting
29
+ * from CustomSpace must define kSpaceIndex as unique space index. These
30
+ * indices need for form a sequence starting at 0.
31
+ *
32
+ * Example:
33
+ * \code
34
+ * class CustomSpace1 : public CustomSpace<CustomSpace1> {
35
+ * public:
36
+ * static constexpr CustomSpaceIndex kSpaceIndex = 0;
37
+ * };
38
+ * class CustomSpace2 : public CustomSpace<CustomSpace2> {
39
+ * public:
40
+ * static constexpr CustomSpaceIndex kSpaceIndex = 1;
41
+ * };
42
+ * \endcode
43
+ */
44
+ template <typename ConcreteCustomSpace>
45
+ class CustomSpace : public CustomSpaceBase {
46
+ public:
47
+ CustomSpaceIndex GetCustomSpaceIndex() const final {
48
+ return ConcreteCustomSpace::kSpaceIndex;
49
+ }
50
+ };
51
+
52
+ /**
53
+ * User-overridable trait that allows pinning types to custom spaces.
54
+ */
55
+ template <typename T, typename = void>
56
+ struct SpaceTrait {
57
+ using Space = void;
58
+ };
59
+
60
+ } // namespace cppgc
61
+
62
+ #endif // INCLUDE_CPPGC_CUSTOM_SPACE_H_
@@ -0,0 +1,76 @@
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_DEFAULT_PLATFORM_H_
6
+ #define INCLUDE_CPPGC_DEFAULT_PLATFORM_H_
7
+
8
+ #include <memory>
9
+ #include <thread> // NOLINT(build/c++11)
10
+ #include <vector>
11
+
12
+ #include "cppgc/platform.h"
13
+ #include "v8config.h" // NOLINT(build/include_directory)
14
+
15
+ namespace cppgc {
16
+
17
+ /**
18
+ * Default task runner implementation. Keep posted tasks in a list that can be
19
+ * processed by calling RunSingleTask() or RunUntilIdle().
20
+ */
21
+ class V8_EXPORT DefaultTaskRunner final : public cppgc::TaskRunner {
22
+ public:
23
+ DefaultTaskRunner() = default;
24
+
25
+ DefaultTaskRunner(const DefaultTaskRunner&) = delete;
26
+ DefaultTaskRunner& operator=(const DefaultTaskRunner&) = delete;
27
+
28
+ void PostTask(std::unique_ptr<cppgc::Task> task) override;
29
+ void PostNonNestableTask(std::unique_ptr<cppgc::Task> task) override;
30
+ void PostDelayedTask(std::unique_ptr<cppgc::Task> task, double) override;
31
+ void PostNonNestableDelayedTask(std::unique_ptr<cppgc::Task> task,
32
+ double) override;
33
+
34
+ void PostIdleTask(std::unique_ptr<cppgc::IdleTask> task) override;
35
+ bool IdleTasksEnabled() override { return true; }
36
+
37
+ bool RunSingleTask();
38
+ bool RunSingleIdleTask(double duration_in_seconds);
39
+
40
+ void RunUntilIdle();
41
+
42
+ private:
43
+ std::vector<std::unique_ptr<cppgc::Task>> tasks_;
44
+ std::vector<std::unique_ptr<cppgc::IdleTask>> idle_tasks_;
45
+ };
46
+
47
+ /**
48
+ * Default platform implementation that uses std::thread for spawning job tasks.
49
+ */
50
+ class V8_EXPORT DefaultPlatform final : public Platform {
51
+ public:
52
+ DefaultPlatform();
53
+ ~DefaultPlatform() noexcept override;
54
+
55
+ cppgc::PageAllocator* GetPageAllocator() final;
56
+
57
+ double MonotonicallyIncreasingTime() final;
58
+
59
+ std::shared_ptr<cppgc::TaskRunner> GetForegroundTaskRunner() final;
60
+
61
+ std::unique_ptr<cppgc::JobHandle> PostJob(
62
+ cppgc::TaskPriority priority,
63
+ std::unique_ptr<cppgc::JobTask> job_task) final;
64
+
65
+ void WaitAllForegroundTasks();
66
+ void WaitAllBackgroundTasks();
67
+
68
+ private:
69
+ std::unique_ptr<PageAllocator> page_allocator_;
70
+ std::shared_ptr<DefaultTaskRunner> foreground_task_runner_;
71
+ std::vector<std::shared_ptr<std::thread>> job_threads_;
72
+ };
73
+
74
+ } // namespace cppgc
75
+
76
+ #endif // INCLUDE_CPPGC_DEFAULT_PLATFORM_H_