libv8-node 15.14.0.1-aarch64-linux-musl → 18.8.0.0-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 +1 -1
- data/ext/libv8-node/paths.rb +5 -1
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/{out.gn → aarch64-linux-musl}/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/allocation.h +184 -47
- data/vendor/v8/include/cppgc/common.h +9 -6
- data/vendor/v8/include/cppgc/cross-thread-persistent.h +465 -0
- data/vendor/v8/include/cppgc/custom-space.h +37 -2
- data/vendor/v8/include/cppgc/default-platform.h +40 -49
- data/vendor/v8/include/cppgc/ephemeron-pair.h +30 -0
- data/vendor/v8/include/cppgc/explicit-management.h +100 -0
- data/vendor/v8/include/cppgc/garbage-collected.h +19 -29
- data/vendor/v8/include/cppgc/heap-consistency.h +266 -0
- data/vendor/v8/include/cppgc/heap-state.h +82 -0
- data/vendor/v8/include/cppgc/heap-statistics.h +120 -0
- data/vendor/v8/include/cppgc/heap.h +73 -6
- data/vendor/v8/include/cppgc/internal/api-constants.h +11 -3
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +27 -15
- data/vendor/v8/include/cppgc/internal/compiler-specific.h +2 -2
- data/vendor/v8/include/cppgc/internal/finalizer-trait.h +4 -1
- data/vendor/v8/include/cppgc/internal/gc-info.h +124 -13
- data/vendor/v8/include/cppgc/internal/logging.h +3 -3
- data/vendor/v8/include/cppgc/internal/name-trait.h +122 -0
- data/vendor/v8/include/cppgc/internal/persistent-node.h +116 -16
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +84 -32
- data/vendor/v8/include/cppgc/internal/write-barrier.h +392 -35
- data/vendor/v8/include/cppgc/liveness-broker.h +11 -2
- data/vendor/v8/include/cppgc/macros.h +2 -0
- data/vendor/v8/include/cppgc/member.h +91 -26
- data/vendor/v8/include/cppgc/name-provider.h +65 -0
- data/vendor/v8/include/cppgc/object-size-trait.h +58 -0
- data/vendor/v8/include/cppgc/persistent.h +70 -41
- data/vendor/v8/include/cppgc/platform.h +52 -26
- data/vendor/v8/include/cppgc/prefinalizer.h +36 -13
- data/vendor/v8/include/cppgc/process-heap-statistics.h +36 -0
- data/vendor/v8/include/cppgc/sentinel-pointer.h +32 -0
- data/vendor/v8/include/cppgc/source-location.h +2 -1
- data/vendor/v8/include/cppgc/testing.h +106 -0
- data/vendor/v8/include/cppgc/trace-trait.h +8 -3
- data/vendor/v8/include/cppgc/type-traits.h +163 -32
- data/vendor/v8/include/cppgc/visitor.h +194 -28
- data/vendor/v8/include/libplatform/libplatform.h +11 -11
- data/vendor/v8/include/libplatform/v8-tracing.h +2 -1
- data/vendor/v8/include/v8-array-buffer.h +445 -0
- data/vendor/v8/include/v8-callbacks.h +397 -0
- data/vendor/v8/include/v8-container.h +129 -0
- data/vendor/v8/include/v8-context.h +407 -0
- data/vendor/v8/include/v8-cppgc.h +151 -159
- data/vendor/v8/include/v8-data.h +80 -0
- data/vendor/v8/include/v8-date.h +43 -0
- data/vendor/v8/include/v8-debug.h +168 -0
- data/vendor/v8/include/v8-embedder-heap.h +218 -0
- data/vendor/v8/include/v8-embedder-state-scope.h +51 -0
- data/vendor/v8/include/v8-exception.h +217 -0
- data/vendor/v8/include/v8-extension.h +62 -0
- data/vendor/v8/include/v8-external.h +37 -0
- data/vendor/v8/include/v8-fast-api-calls.h +703 -152
- data/vendor/v8/include/v8-forward.h +81 -0
- data/vendor/v8/include/v8-function-callback.h +475 -0
- data/vendor/v8/include/v8-function.h +125 -0
- data/vendor/v8/include/v8-initialization.h +315 -0
- data/vendor/v8/include/v8-inspector.h +76 -27
- data/vendor/v8/include/v8-internal.h +285 -51
- data/vendor/v8/include/v8-isolate.h +1709 -0
- data/vendor/v8/include/v8-json.h +47 -0
- data/vendor/v8/include/v8-local-handle.h +455 -0
- data/vendor/v8/include/v8-locker.h +149 -0
- data/vendor/v8/include/v8-maybe.h +137 -0
- data/vendor/v8/include/v8-memory-span.h +43 -0
- data/vendor/v8/include/v8-message.h +216 -0
- data/vendor/v8/include/v8-metrics.h +131 -9
- data/vendor/v8/include/v8-microtask-queue.h +152 -0
- data/vendor/v8/include/v8-microtask.h +28 -0
- data/vendor/v8/include/v8-object.h +775 -0
- data/vendor/v8/include/v8-persistent-handle.h +590 -0
- data/vendor/v8/include/v8-platform.h +433 -25
- data/vendor/v8/include/v8-primitive-object.h +118 -0
- data/vendor/v8/include/v8-primitive.h +866 -0
- data/vendor/v8/include/v8-profiler.h +149 -10
- data/vendor/v8/include/v8-promise.h +174 -0
- data/vendor/v8/include/v8-proxy.h +50 -0
- data/vendor/v8/include/v8-regexp.h +105 -0
- data/vendor/v8/include/v8-script.h +747 -0
- data/vendor/v8/include/v8-snapshot.h +196 -0
- data/vendor/v8/include/v8-statistics.h +217 -0
- data/vendor/v8/include/v8-template.h +1079 -0
- data/vendor/v8/include/v8-traced-handle.h +420 -0
- data/vendor/v8/include/v8-typed-array.h +282 -0
- data/vendor/v8/include/v8-unwinder-state.h +31 -0
- data/vendor/v8/include/v8-unwinder.h +132 -0
- data/vendor/v8/include/v8-util.h +8 -2
- data/vendor/v8/include/v8-value-serializer-version.h +1 -1
- data/vendor/v8/include/v8-value-serializer.h +279 -0
- data/vendor/v8/include/v8-value.h +526 -0
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8-wasm.h +257 -0
- data/vendor/v8/include/v8-weak-callback-info.h +87 -0
- data/vendor/v8/include/v8.h +41 -12051
- data/vendor/v8/include/v8config.h +142 -21
- metadata +64 -10
- data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +0 -30
- data/vendor/v8/include/cppgc/internal/process-heap.h +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4851a6d65632c1e8a4001087e3d8ef2c3b6229539a736560068bcc81d6b7c63a
|
4
|
+
data.tar.gz: 45508ecdb1d31f7decfa7b4fc890f8362deeda5585b43bf9a9128fc7984c6627
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3f2b60b06e15dceaf8e72dcf4ecad18cecdd5cade42260341b1acb2b3e1f3cf88816e61eab0884946d54743f35f72b844bee637e316a38581784cccd6724790
|
7
|
+
data.tar.gz: 8592968b05d662495645552c428b05e4363902783a791cfc3ce011274ce40fd2d051e2a667d230c1ae09d508e79e079f2a75b31faa382112a53dee0c89aef76c
|
data/ext/libv8-node/location.rb
CHANGED
@@ -18,7 +18,7 @@ module Libv8::Node
|
|
18
18
|
|
19
19
|
def self.load!
|
20
20
|
File.open(Pathname(__FILE__).dirname.join('.location.yml')) do |f|
|
21
|
-
YAML.load(f) # rubocop:disable Security/YAMLLoad
|
21
|
+
YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(f) : YAML.load(f) # rubocop:disable Security/YAMLLoad
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
data/ext/libv8-node/paths.rb
CHANGED
@@ -13,12 +13,16 @@ module Libv8::Node
|
|
13
13
|
|
14
14
|
def object_paths
|
15
15
|
[Shellwords.escape(File.join(vendored_source_path,
|
16
|
-
|
16
|
+
platform,
|
17
17
|
'libv8',
|
18
18
|
'obj',
|
19
19
|
"libv8_monolith.#{config['LIBEXT']}"))]
|
20
20
|
end
|
21
21
|
|
22
|
+
def platform
|
23
|
+
Gem::Platform.local.tap { |p| RUBY_PLATFORM =~ /musl/ && p.version.nil? && p.instance_eval { @version = 'musl' } }.to_s.gsub(/-darwin-?\d+/, '-darwin')
|
24
|
+
end
|
25
|
+
|
22
26
|
def config
|
23
27
|
RbConfig::MAKEFILE_CONFIG
|
24
28
|
end
|
data/lib/libv8/node/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Libv8; end
|
2
2
|
|
3
3
|
module Libv8::Node
|
4
|
-
VERSION = '
|
5
|
-
NODE_VERSION = '
|
6
|
-
LIBV8_VERSION = '
|
4
|
+
VERSION = '18.8.0.0'.freeze
|
5
|
+
NODE_VERSION = '18.8.0'.freeze
|
6
|
+
LIBV8_VERSION = '10.2.154.13'.freeze # from v8/include/v8-version.h
|
7
7
|
end
|
Binary file
|
@@ -5,23 +5,37 @@
|
|
5
5
|
#ifndef INCLUDE_CPPGC_ALLOCATION_H_
|
6
6
|
#define INCLUDE_CPPGC_ALLOCATION_H_
|
7
7
|
|
8
|
-
#include <stdint.h>
|
9
|
-
|
10
8
|
#include <atomic>
|
9
|
+
#include <cstddef>
|
10
|
+
#include <cstdint>
|
11
|
+
#include <new>
|
12
|
+
#include <type_traits>
|
13
|
+
#include <utility>
|
11
14
|
|
12
15
|
#include "cppgc/custom-space.h"
|
13
|
-
#include "cppgc/garbage-collected.h"
|
14
16
|
#include "cppgc/internal/api-constants.h"
|
15
17
|
#include "cppgc/internal/gc-info.h"
|
18
|
+
#include "cppgc/type-traits.h"
|
19
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
16
20
|
|
17
|
-
|
21
|
+
#if defined(__has_attribute)
|
22
|
+
#if __has_attribute(assume_aligned)
|
23
|
+
#define CPPGC_DEFAULT_ALIGNED \
|
24
|
+
__attribute__((assume_aligned(api_constants::kDefaultAlignment)))
|
25
|
+
#define CPPGC_DOUBLE_WORD_ALIGNED \
|
26
|
+
__attribute__((assume_aligned(2 * api_constants::kDefaultAlignment)))
|
27
|
+
#endif // __has_attribute(assume_aligned)
|
28
|
+
#endif // defined(__has_attribute)
|
18
29
|
|
19
|
-
|
20
|
-
|
30
|
+
#if !defined(CPPGC_DEFAULT_ALIGNED)
|
31
|
+
#define CPPGC_DEFAULT_ALIGNED
|
32
|
+
#endif
|
21
33
|
|
22
|
-
|
23
|
-
|
24
|
-
|
34
|
+
#if !defined(CPPGC_DOUBLE_WORD_ALIGNED)
|
35
|
+
#define CPPGC_DOUBLE_WORD_ALIGNED
|
36
|
+
#endif
|
37
|
+
|
38
|
+
namespace cppgc {
|
25
39
|
|
26
40
|
/**
|
27
41
|
* AllocationHandle is used to allocate garbage-collected objects.
|
@@ -30,6 +44,9 @@ class AllocationHandle;
|
|
30
44
|
|
31
45
|
namespace internal {
|
32
46
|
|
47
|
+
// Similar to C++17 std::align_val_t;
|
48
|
+
enum class AlignVal : size_t {};
|
49
|
+
|
33
50
|
class V8_EXPORT MakeGarbageCollectedTraitInternal {
|
34
51
|
protected:
|
35
52
|
static inline void MarkObjectAsFullyConstructed(const void* payload) {
|
@@ -39,15 +56,81 @@ class V8_EXPORT MakeGarbageCollectedTraitInternal {
|
|
39
56
|
const_cast<uint16_t*>(reinterpret_cast<const uint16_t*>(
|
40
57
|
reinterpret_cast<const uint8_t*>(payload) -
|
41
58
|
api_constants::kFullyConstructedBitFieldOffsetFromPayload)));
|
59
|
+
// It's safe to split use load+store here (instead of a read-modify-write
|
60
|
+
// operation), since it's guaranteed that this 16-bit bitfield is only
|
61
|
+
// modified by a single thread. This is cheaper in terms of code bloat (on
|
62
|
+
// ARM) and performance.
|
42
63
|
uint16_t value = atomic_mutable_bitfield->load(std::memory_order_relaxed);
|
43
|
-
value
|
64
|
+
value |= api_constants::kFullyConstructedBitMask;
|
44
65
|
atomic_mutable_bitfield->store(value, std::memory_order_release);
|
45
66
|
}
|
46
67
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
68
|
+
// Dispatch based on compile-time information.
|
69
|
+
//
|
70
|
+
// Default implementation is for a custom space with >`kDefaultAlignment` byte
|
71
|
+
// alignment.
|
72
|
+
template <typename GCInfoType, typename CustomSpace, size_t alignment>
|
73
|
+
struct AllocationDispatcher final {
|
74
|
+
static void* Invoke(AllocationHandle& handle, size_t size) {
|
75
|
+
static_assert(std::is_base_of<CustomSpaceBase, CustomSpace>::value,
|
76
|
+
"Custom space must inherit from CustomSpaceBase.");
|
77
|
+
static_assert(
|
78
|
+
!CustomSpace::kSupportsCompaction,
|
79
|
+
"Custom spaces that support compaction do not support allocating "
|
80
|
+
"objects with non-default (i.e. word-sized) alignment.");
|
81
|
+
return MakeGarbageCollectedTraitInternal::Allocate(
|
82
|
+
handle, size, static_cast<AlignVal>(alignment),
|
83
|
+
internal::GCInfoTrait<GCInfoType>::Index(), CustomSpace::kSpaceIndex);
|
84
|
+
}
|
85
|
+
};
|
86
|
+
|
87
|
+
// Fast path for regular allocations for the default space with
|
88
|
+
// `kDefaultAlignment` byte alignment.
|
89
|
+
template <typename GCInfoType>
|
90
|
+
struct AllocationDispatcher<GCInfoType, void,
|
91
|
+
api_constants::kDefaultAlignment>
|
92
|
+
final {
|
93
|
+
static void* Invoke(AllocationHandle& handle, size_t size) {
|
94
|
+
return MakeGarbageCollectedTraitInternal::Allocate(
|
95
|
+
handle, size, internal::GCInfoTrait<GCInfoType>::Index());
|
96
|
+
}
|
97
|
+
};
|
98
|
+
|
99
|
+
// Default space with >`kDefaultAlignment` byte alignment.
|
100
|
+
template <typename GCInfoType, size_t alignment>
|
101
|
+
struct AllocationDispatcher<GCInfoType, void, alignment> final {
|
102
|
+
static void* Invoke(AllocationHandle& handle, size_t size) {
|
103
|
+
return MakeGarbageCollectedTraitInternal::Allocate(
|
104
|
+
handle, size, static_cast<AlignVal>(alignment),
|
105
|
+
internal::GCInfoTrait<GCInfoType>::Index());
|
106
|
+
}
|
107
|
+
};
|
108
|
+
|
109
|
+
// Custom space with `kDefaultAlignment` byte alignment.
|
110
|
+
template <typename GCInfoType, typename CustomSpace>
|
111
|
+
struct AllocationDispatcher<GCInfoType, CustomSpace,
|
112
|
+
api_constants::kDefaultAlignment>
|
113
|
+
final {
|
114
|
+
static void* Invoke(AllocationHandle& handle, size_t size) {
|
115
|
+
static_assert(std::is_base_of<CustomSpaceBase, CustomSpace>::value,
|
116
|
+
"Custom space must inherit from CustomSpaceBase.");
|
117
|
+
return MakeGarbageCollectedTraitInternal::Allocate(
|
118
|
+
handle, size, internal::GCInfoTrait<GCInfoType>::Index(),
|
119
|
+
CustomSpace::kSpaceIndex);
|
120
|
+
}
|
121
|
+
};
|
122
|
+
|
123
|
+
private:
|
124
|
+
static void* CPPGC_DEFAULT_ALIGNED Allocate(cppgc::AllocationHandle&, size_t,
|
125
|
+
GCInfoIndex);
|
126
|
+
static void* CPPGC_DOUBLE_WORD_ALIGNED Allocate(cppgc::AllocationHandle&,
|
127
|
+
size_t, AlignVal,
|
128
|
+
GCInfoIndex);
|
129
|
+
static void* CPPGC_DEFAULT_ALIGNED Allocate(cppgc::AllocationHandle&, size_t,
|
130
|
+
GCInfoIndex, CustomSpaceIndex);
|
131
|
+
static void* CPPGC_DOUBLE_WORD_ALIGNED Allocate(cppgc::AllocationHandle&,
|
132
|
+
size_t, AlignVal, GCInfoIndex,
|
133
|
+
CustomSpaceIndex);
|
51
134
|
|
52
135
|
friend class HeapObjectHeader;
|
53
136
|
};
|
@@ -65,26 +148,12 @@ template <typename T>
|
|
65
148
|
class MakeGarbageCollectedTraitBase
|
66
149
|
: private internal::MakeGarbageCollectedTraitInternal {
|
67
150
|
private:
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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
|
-
};
|
151
|
+
static_assert(internal::IsGarbageCollectedType<T>::value,
|
152
|
+
"T needs to be a garbage collected object");
|
153
|
+
static_assert(!IsGarbageCollectedWithMixinTypeV<T> ||
|
154
|
+
sizeof(T) <=
|
155
|
+
internal::api_constants::kLargeObjectSizeThreshold,
|
156
|
+
"GarbageCollectedMixin may not be a large object");
|
88
157
|
|
89
158
|
protected:
|
90
159
|
/**
|
@@ -95,9 +164,23 @@ class MakeGarbageCollectedTraitBase
|
|
95
164
|
* \param size The size that should be reserved for the object.
|
96
165
|
* \returns the memory to construct an object of type T on.
|
97
166
|
*/
|
98
|
-
static void* Allocate(AllocationHandle& handle, size_t size) {
|
99
|
-
|
100
|
-
|
167
|
+
V8_INLINE static void* Allocate(AllocationHandle& handle, size_t size) {
|
168
|
+
static_assert(
|
169
|
+
std::is_base_of<typename T::ParentMostGarbageCollectedType, T>::value,
|
170
|
+
"U of GarbageCollected<U> must be a base of T. Check "
|
171
|
+
"GarbageCollected<T> base class inheritance.");
|
172
|
+
static constexpr size_t kWantedAlignment =
|
173
|
+
alignof(T) < internal::api_constants::kDefaultAlignment
|
174
|
+
? internal::api_constants::kDefaultAlignment
|
175
|
+
: alignof(T);
|
176
|
+
static_assert(
|
177
|
+
kWantedAlignment <= internal::api_constants::kMaxSupportedAlignment,
|
178
|
+
"Requested alignment larger than alignof(std::max_align_t) bytes. "
|
179
|
+
"Please file a bug to possibly get this restriction lifted.");
|
180
|
+
return AllocationDispatcher<
|
181
|
+
typename internal::GCInfoFolding<
|
182
|
+
T, typename T::ParentMostGarbageCollectedType>::ResultType,
|
183
|
+
typename SpaceTrait<T>::Space, kWantedAlignment>::Invoke(handle, size);
|
101
184
|
}
|
102
185
|
|
103
186
|
/**
|
@@ -106,39 +189,70 @@ class MakeGarbageCollectedTraitBase
|
|
106
189
|
*
|
107
190
|
* \param payload The base pointer the object is allocated at.
|
108
191
|
*/
|
109
|
-
static void MarkObjectAsFullyConstructed(const void* payload) {
|
192
|
+
V8_INLINE static void MarkObjectAsFullyConstructed(const void* payload) {
|
110
193
|
internal::MakeGarbageCollectedTraitInternal::MarkObjectAsFullyConstructed(
|
111
194
|
payload);
|
112
195
|
}
|
113
196
|
};
|
114
197
|
|
198
|
+
/**
|
199
|
+
* Passed to MakeGarbageCollected to specify how many bytes should be appended
|
200
|
+
* to the allocated object.
|
201
|
+
*
|
202
|
+
* Example:
|
203
|
+
* \code
|
204
|
+
* class InlinedArray final : public GarbageCollected<InlinedArray> {
|
205
|
+
* public:
|
206
|
+
* explicit InlinedArray(size_t bytes) : size(bytes), byte_array(this + 1) {}
|
207
|
+
* void Trace(Visitor*) const {}
|
208
|
+
|
209
|
+
* size_t size;
|
210
|
+
* char* byte_array;
|
211
|
+
* };
|
212
|
+
*
|
213
|
+
* auto* inlined_array = MakeGarbageCollected<InlinedArray(
|
214
|
+
* GetAllocationHandle(), AdditionalBytes(4), 4);
|
215
|
+
* for (size_t i = 0; i < 4; i++) {
|
216
|
+
* Process(inlined_array->byte_array[i]);
|
217
|
+
* }
|
218
|
+
* \endcode
|
219
|
+
*/
|
220
|
+
struct AdditionalBytes {
|
221
|
+
constexpr explicit AdditionalBytes(size_t bytes) : value(bytes) {}
|
222
|
+
const size_t value;
|
223
|
+
};
|
224
|
+
|
115
225
|
/**
|
116
226
|
* Default trait class that specifies how to construct an object of type T.
|
117
227
|
* Advanced users may override how an object is constructed using the utilities
|
118
228
|
* that are provided through MakeGarbageCollectedTraitBase.
|
119
229
|
*
|
120
230
|
* Any trait overriding construction must
|
121
|
-
* - allocate through MakeGarbageCollectedTraitBase<T>::Allocate
|
231
|
+
* - allocate through `MakeGarbageCollectedTraitBase<T>::Allocate`;
|
122
232
|
* - mark the object as fully constructed using
|
123
|
-
* MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed
|
233
|
+
* `MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed`;
|
124
234
|
*/
|
125
235
|
template <typename T>
|
126
236
|
class MakeGarbageCollectedTrait : public MakeGarbageCollectedTraitBase<T> {
|
127
237
|
public:
|
128
238
|
template <typename... Args>
|
129
239
|
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
240
|
void* memory =
|
137
241
|
MakeGarbageCollectedTraitBase<T>::Allocate(handle, sizeof(T));
|
138
242
|
T* object = ::new (memory) T(std::forward<Args>(args)...);
|
139
243
|
MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed(object);
|
140
244
|
return object;
|
141
245
|
}
|
246
|
+
|
247
|
+
template <typename... Args>
|
248
|
+
static T* Call(AllocationHandle& handle, AdditionalBytes additional_bytes,
|
249
|
+
Args&&... args) {
|
250
|
+
void* memory = MakeGarbageCollectedTraitBase<T>::Allocate(
|
251
|
+
handle, sizeof(T) + additional_bytes.value);
|
252
|
+
T* object = ::new (memory) T(std::forward<Args>(args)...);
|
253
|
+
MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed(object);
|
254
|
+
return object;
|
255
|
+
}
|
142
256
|
};
|
143
257
|
|
144
258
|
/**
|
@@ -161,13 +275,36 @@ struct PostConstructionCallbackTrait {
|
|
161
275
|
* \returns an instance of type T.
|
162
276
|
*/
|
163
277
|
template <typename T, typename... Args>
|
164
|
-
T* MakeGarbageCollected(AllocationHandle& handle, Args&&... args) {
|
278
|
+
V8_INLINE T* MakeGarbageCollected(AllocationHandle& handle, Args&&... args) {
|
165
279
|
T* object =
|
166
280
|
MakeGarbageCollectedTrait<T>::Call(handle, std::forward<Args>(args)...);
|
167
281
|
PostConstructionCallbackTrait<T>::Call(object);
|
168
282
|
return object;
|
169
283
|
}
|
170
284
|
|
285
|
+
/**
|
286
|
+
* Constructs a managed object of type T where T transitively inherits from
|
287
|
+
* GarbageCollected. Created objects will have additional bytes appended to
|
288
|
+
* it. Allocated memory would suffice for `sizeof(T) + additional_bytes`.
|
289
|
+
*
|
290
|
+
* \param additional_bytes Denotes how many bytes to append to T.
|
291
|
+
* \param args List of arguments with which an instance of T will be
|
292
|
+
* constructed.
|
293
|
+
* \returns an instance of type T.
|
294
|
+
*/
|
295
|
+
template <typename T, typename... Args>
|
296
|
+
V8_INLINE T* MakeGarbageCollected(AllocationHandle& handle,
|
297
|
+
AdditionalBytes additional_bytes,
|
298
|
+
Args&&... args) {
|
299
|
+
T* object = MakeGarbageCollectedTrait<T>::Call(handle, additional_bytes,
|
300
|
+
std::forward<Args>(args)...);
|
301
|
+
PostConstructionCallbackTrait<T>::Call(object);
|
302
|
+
return object;
|
303
|
+
}
|
304
|
+
|
171
305
|
} // namespace cppgc
|
172
306
|
|
307
|
+
#undef CPPGC_DEFAULT_ALIGNED
|
308
|
+
#undef CPPGC_DOUBLE_WORD_ALIGNED
|
309
|
+
|
173
310
|
#endif // INCLUDE_CPPGC_ALLOCATION_H_
|
@@ -10,15 +10,18 @@
|
|
10
10
|
|
11
11
|
namespace cppgc {
|
12
12
|
|
13
|
-
|
13
|
+
/**
|
14
|
+
* Indicator for the stack state of the embedder.
|
15
|
+
*/
|
14
16
|
enum class EmbedderStackState {
|
17
|
+
/**
|
18
|
+
* Stack may contain interesting heap pointers.
|
19
|
+
*/
|
15
20
|
kMayContainHeapPointers,
|
21
|
+
/**
|
22
|
+
* Stack does not contain any interesting heap pointers.
|
23
|
+
*/
|
16
24
|
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
25
|
};
|
23
26
|
|
24
27
|
} // namespace cppgc
|