libv8-node 15.14.0.1-aarch64-linux-musl → 18.8.0.0-aarch64-linux-musl
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -5,6 +5,9 @@
|
|
5
5
|
#ifndef INCLUDE_CPPGC_PLATFORM_H_
|
6
6
|
#define INCLUDE_CPPGC_PLATFORM_H_
|
7
7
|
|
8
|
+
#include <memory>
|
9
|
+
|
10
|
+
#include "cppgc/source-location.h"
|
8
11
|
#include "v8-platform.h" // NOLINT(build/include_directory)
|
9
12
|
#include "v8config.h" // NOLINT(build/include_directory)
|
10
13
|
|
@@ -20,6 +23,7 @@ using PageAllocator = v8::PageAllocator;
|
|
20
23
|
using Task = v8::Task;
|
21
24
|
using TaskPriority = v8::TaskPriority;
|
22
25
|
using TaskRunner = v8::TaskRunner;
|
26
|
+
using TracingController = v8::TracingController;
|
23
27
|
|
24
28
|
/**
|
25
29
|
* Platform interface used by Heap. Contains allocators and executors.
|
@@ -51,22 +55,23 @@ class V8_EXPORT Platform {
|
|
51
55
|
}
|
52
56
|
|
53
57
|
/**
|
54
|
-
* Posts
|
55
|
-
* the Job
|
58
|
+
* Posts `job_task` to run in parallel. Returns a `JobHandle` associated with
|
59
|
+
* the `Job`, which can be joined or canceled.
|
56
60
|
* This avoids degenerate cases:
|
57
|
-
* - Calling CallOnWorkerThread() for each work item, causing significant
|
61
|
+
* - Calling `CallOnWorkerThread()` for each work item, causing significant
|
58
62
|
* overhead.
|
59
|
-
* - Fixed number of CallOnWorkerThread() calls that split the work and
|
60
|
-
* run for a long time. This is problematic when many components post
|
63
|
+
* - Fixed number of `CallOnWorkerThread()` calls that split the work and
|
64
|
+
* might run for a long time. This is problematic when many components post
|
61
65
|
* "num cores" tasks and all expect to use all the cores. In these cases,
|
62
66
|
* the scheduler lacks context to be fair to multiple same-priority requests
|
63
67
|
* and/or ability to request lower priority work to yield when high priority
|
64
68
|
* work comes in.
|
65
|
-
* A canonical implementation of
|
69
|
+
* A canonical implementation of `job_task` looks like:
|
70
|
+
* \code
|
66
71
|
* class MyJobTask : public JobTask {
|
67
72
|
* public:
|
68
73
|
* MyJobTask(...) : worker_queue_(...) {}
|
69
|
-
* // JobTask
|
74
|
+
* // JobTask implementation.
|
70
75
|
* void Run(JobDelegate* delegate) override {
|
71
76
|
* while (!delegate->ShouldYield()) {
|
72
77
|
* // Smallest unit of work.
|
@@ -80,51 +85,72 @@ class V8_EXPORT Platform {
|
|
80
85
|
* return worker_queue_.GetSize(); // Thread safe.
|
81
86
|
* }
|
82
87
|
* };
|
88
|
+
*
|
89
|
+
* // ...
|
83
90
|
* auto handle = PostJob(TaskPriority::kUserVisible,
|
84
91
|
* std::make_unique<MyJobTask>(...));
|
85
92
|
* handle->Join();
|
93
|
+
* \endcode
|
86
94
|
*
|
87
|
-
* PostJob() and methods of the returned JobHandle/JobDelegate, must never
|
88
|
-
* called while holding a lock that could be acquired by JobTask::Run
|
89
|
-
* JobTask::GetMaxConcurrency -- that could result in a deadlock. This
|
90
|
-
* because
|
91
|
-
* internal lock (A), hence JobTask::GetMaxConcurrency can only use a lock
|
92
|
-
* if that lock is *never* held while calling back into JobHandle from
|
93
|
-
* thread (A=>B/B=>A deadlock) and
|
94
|
-
* JobTask::GetMaxConcurrency may be invoked synchronously from
|
95
|
-
* (B=>JobHandle::foo=>B deadlock).
|
95
|
+
* `PostJob()` and methods of the returned JobHandle/JobDelegate, must never
|
96
|
+
* be called while holding a lock that could be acquired by `JobTask::Run()`
|
97
|
+
* or `JobTask::GetMaxConcurrency()` -- that could result in a deadlock. This
|
98
|
+
* is because (1) `JobTask::GetMaxConcurrency()` may be invoked while holding
|
99
|
+
* internal lock (A), hence `JobTask::GetMaxConcurrency()` can only use a lock
|
100
|
+
* (B) if that lock is *never* held while calling back into `JobHandle` from
|
101
|
+
* any thread (A=>B/B=>A deadlock) and (2) `JobTask::Run()` or
|
102
|
+
* `JobTask::GetMaxConcurrency()` may be invoked synchronously from
|
103
|
+
* `JobHandle` (B=>JobHandle::foo=>B deadlock).
|
96
104
|
*
|
97
|
-
* A sufficient PostJob() implementation that uses the default Job provided
|
98
|
-
* libplatform looks like:
|
99
|
-
*
|
100
|
-
*
|
101
|
-
*
|
102
|
-
*
|
103
|
-
*
|
105
|
+
* A sufficient `PostJob()` implementation that uses the default Job provided
|
106
|
+
* in libplatform looks like:
|
107
|
+
* \code
|
108
|
+
* std::unique_ptr<JobHandle> PostJob(
|
109
|
+
* TaskPriority priority, std::unique_ptr<JobTask> job_task) override {
|
110
|
+
* return std::make_unique<DefaultJobHandle>(
|
111
|
+
* std::make_shared<DefaultJobState>(
|
112
|
+
* this, std::move(job_task), kNumThreads));
|
104
113
|
* }
|
114
|
+
* \endcode
|
105
115
|
*/
|
106
116
|
virtual std::unique_ptr<JobHandle> PostJob(
|
107
117
|
TaskPriority priority, std::unique_ptr<JobTask> job_task) {
|
108
118
|
return nullptr;
|
109
119
|
}
|
120
|
+
|
121
|
+
/**
|
122
|
+
* Returns an instance of a `TracingController`. This must be non-nullptr. The
|
123
|
+
* default implementation returns an empty `TracingController` that consumes
|
124
|
+
* trace data without effect.
|
125
|
+
*/
|
126
|
+
virtual TracingController* GetTracingController();
|
110
127
|
};
|
111
128
|
|
112
129
|
/**
|
113
130
|
* Process-global initialization of the garbage collector. Must be called before
|
114
131
|
* creating a Heap.
|
132
|
+
*
|
133
|
+
* Can be called multiple times when paired with `ShutdownProcess()`.
|
134
|
+
*
|
135
|
+
* \param page_allocator The allocator used for maintaining meta data. Must not
|
136
|
+
* change between multiple calls to InitializeProcess.
|
115
137
|
*/
|
116
|
-
V8_EXPORT void InitializeProcess(PageAllocator*);
|
138
|
+
V8_EXPORT void InitializeProcess(PageAllocator* page_allocator);
|
117
139
|
|
118
140
|
/**
|
119
|
-
* Must be called after destroying the last used heap.
|
141
|
+
* Must be called after destroying the last used heap. Some process-global
|
142
|
+
* metadata may not be returned and reused upon a subsequent
|
143
|
+
* `InitializeProcess()` call.
|
120
144
|
*/
|
121
145
|
V8_EXPORT void ShutdownProcess();
|
122
146
|
|
123
147
|
namespace internal {
|
124
148
|
|
125
|
-
V8_EXPORT void
|
149
|
+
V8_EXPORT void Fatal(const std::string& reason = std::string(),
|
150
|
+
const SourceLocation& = SourceLocation::Current());
|
126
151
|
|
127
152
|
} // namespace internal
|
153
|
+
|
128
154
|
} // namespace cppgc
|
129
155
|
|
130
156
|
#endif // INCLUDE_CPPGC_PLATFORM_H_
|
@@ -6,23 +6,17 @@
|
|
6
6
|
#define INCLUDE_CPPGC_PREFINALIZER_H_
|
7
7
|
|
8
8
|
#include "cppgc/internal/compiler-specific.h"
|
9
|
-
#include "cppgc/internal/prefinalizer-handler.h"
|
10
9
|
#include "cppgc/liveness-broker.h"
|
11
10
|
|
12
11
|
namespace cppgc {
|
13
12
|
|
14
13
|
namespace internal {
|
15
14
|
|
16
|
-
|
17
|
-
class PrefinalizerRegistration final {
|
15
|
+
class V8_EXPORT PrefinalizerRegistration final {
|
18
16
|
public:
|
19
|
-
|
20
|
-
static_assert(sizeof(&T::InvokePreFinalizer) > 0,
|
21
|
-
"USING_PRE_FINALIZER(T) must be defined.");
|
17
|
+
using Callback = bool (*)(const cppgc::LivenessBroker&, void*);
|
22
18
|
|
23
|
-
|
24
|
-
{self, T::InvokePreFinalizer});
|
25
|
-
}
|
19
|
+
PrefinalizerRegistration(void*, Callback);
|
26
20
|
|
27
21
|
void* operator new(size_t, void* location) = delete;
|
28
22
|
void* operator new(size_t) = delete;
|
@@ -30,21 +24,50 @@ class PrefinalizerRegistration final {
|
|
30
24
|
|
31
25
|
} // namespace internal
|
32
26
|
|
27
|
+
/**
|
28
|
+
* Macro must be used in the private section of `Class` and registers a
|
29
|
+
* prefinalization callback `void Class::PreFinalizer()`. The callback is
|
30
|
+
* invoked on garbage collection after the collector has found an object to be
|
31
|
+
* dead.
|
32
|
+
*
|
33
|
+
* Callback properties:
|
34
|
+
* - The callback is invoked before a possible destructor for the corresponding
|
35
|
+
* object.
|
36
|
+
* - The callback may access the whole object graph, irrespective of whether
|
37
|
+
* objects are considered dead or alive.
|
38
|
+
* - The callback is invoked on the same thread as the object was created on.
|
39
|
+
*
|
40
|
+
* Example:
|
41
|
+
* \code
|
42
|
+
* class WithPrefinalizer : public GarbageCollected<WithPrefinalizer> {
|
43
|
+
* CPPGC_USING_PRE_FINALIZER(WithPrefinalizer, Dispose);
|
44
|
+
*
|
45
|
+
* public:
|
46
|
+
* void Trace(Visitor*) const {}
|
47
|
+
* void Dispose() { prefinalizer_called = true; }
|
48
|
+
* ~WithPrefinalizer() {
|
49
|
+
* // prefinalizer_called == true
|
50
|
+
* }
|
51
|
+
* private:
|
52
|
+
* bool prefinalizer_called = false;
|
53
|
+
* };
|
54
|
+
* \endcode
|
55
|
+
*/
|
33
56
|
#define CPPGC_USING_PRE_FINALIZER(Class, PreFinalizer) \
|
34
57
|
public: \
|
35
58
|
static bool InvokePreFinalizer(const cppgc::LivenessBroker& liveness_broker, \
|
36
59
|
void* object) { \
|
37
|
-
static_assert(cppgc::
|
60
|
+
static_assert(cppgc::IsGarbageCollectedOrMixinTypeV<Class>, \
|
38
61
|
"Only garbage collected objects can have prefinalizers"); \
|
39
62
|
Class* self = static_cast<Class*>(object); \
|
40
63
|
if (liveness_broker.IsHeapObjectAlive(self)) return false; \
|
41
|
-
self->
|
64
|
+
self->PreFinalizer(); \
|
42
65
|
return true; \
|
43
66
|
} \
|
44
67
|
\
|
45
68
|
private: \
|
46
|
-
CPPGC_NO_UNIQUE_ADDRESS cppgc::internal::PrefinalizerRegistration
|
47
|
-
prefinalizer_dummy_{this};
|
69
|
+
CPPGC_NO_UNIQUE_ADDRESS cppgc::internal::PrefinalizerRegistration \
|
70
|
+
prefinalizer_dummy_{this, Class::InvokePreFinalizer}; \
|
48
71
|
static_assert(true, "Force semicolon.")
|
49
72
|
|
50
73
|
} // namespace cppgc
|
@@ -0,0 +1,36 @@
|
|
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_PROCESS_HEAP_STATISTICS_H_
|
6
|
+
#define INCLUDE_CPPGC_PROCESS_HEAP_STATISTICS_H_
|
7
|
+
|
8
|
+
#include <atomic>
|
9
|
+
#include <cstddef>
|
10
|
+
|
11
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
12
|
+
|
13
|
+
namespace cppgc {
|
14
|
+
namespace internal {
|
15
|
+
class ProcessHeapStatisticsUpdater;
|
16
|
+
} // namespace internal
|
17
|
+
|
18
|
+
class V8_EXPORT ProcessHeapStatistics final {
|
19
|
+
public:
|
20
|
+
static size_t TotalAllocatedObjectSize() {
|
21
|
+
return total_allocated_object_size_.load(std::memory_order_relaxed);
|
22
|
+
}
|
23
|
+
static size_t TotalAllocatedSpace() {
|
24
|
+
return total_allocated_space_.load(std::memory_order_relaxed);
|
25
|
+
}
|
26
|
+
|
27
|
+
private:
|
28
|
+
static std::atomic_size_t total_allocated_space_;
|
29
|
+
static std::atomic_size_t total_allocated_object_size_;
|
30
|
+
|
31
|
+
friend class internal::ProcessHeapStatisticsUpdater;
|
32
|
+
};
|
33
|
+
|
34
|
+
} // namespace cppgc
|
35
|
+
|
36
|
+
#endif // INCLUDE_CPPGC_PROCESS_HEAP_STATISTICS_H_
|
@@ -0,0 +1,32 @@
|
|
1
|
+
// Copyright 2021 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_SENTINEL_POINTER_H_
|
6
|
+
#define INCLUDE_CPPGC_SENTINEL_POINTER_H_
|
7
|
+
|
8
|
+
#include <cstdint>
|
9
|
+
|
10
|
+
namespace cppgc {
|
11
|
+
namespace internal {
|
12
|
+
|
13
|
+
// Special tag type used to denote some sentinel member. The semantics of the
|
14
|
+
// sentinel is defined by the embedder.
|
15
|
+
struct SentinelPointer {
|
16
|
+
template <typename T>
|
17
|
+
operator T*() const {
|
18
|
+
static constexpr intptr_t kSentinelValue = 1;
|
19
|
+
return reinterpret_cast<T*>(kSentinelValue);
|
20
|
+
}
|
21
|
+
// Hidden friends.
|
22
|
+
friend bool operator==(SentinelPointer, SentinelPointer) { return true; }
|
23
|
+
friend bool operator!=(SentinelPointer, SentinelPointer) { return false; }
|
24
|
+
};
|
25
|
+
|
26
|
+
} // namespace internal
|
27
|
+
|
28
|
+
constexpr internal::SentinelPointer kSentinelPointer;
|
29
|
+
|
30
|
+
} // namespace cppgc
|
31
|
+
|
32
|
+
#endif // INCLUDE_CPPGC_SENTINEL_POINTER_H_
|
@@ -5,6 +5,7 @@
|
|
5
5
|
#ifndef INCLUDE_CPPGC_SOURCE_LOCATION_H_
|
6
6
|
#define INCLUDE_CPPGC_SOURCE_LOCATION_H_
|
7
7
|
|
8
|
+
#include <cstddef>
|
8
9
|
#include <string>
|
9
10
|
|
10
11
|
#include "v8config.h" // NOLINT(build/include_directory)
|
@@ -25,7 +26,7 @@ namespace cppgc {
|
|
25
26
|
|
26
27
|
/**
|
27
28
|
* Encapsulates source location information. Mimics C++20's
|
28
|
-
* std::source_location
|
29
|
+
* `std::source_location`.
|
29
30
|
*/
|
30
31
|
class V8_EXPORT SourceLocation final {
|
31
32
|
public:
|
@@ -0,0 +1,106 @@
|
|
1
|
+
// Copyright 2021 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_TESTING_H_
|
6
|
+
#define INCLUDE_CPPGC_TESTING_H_
|
7
|
+
|
8
|
+
#include "cppgc/common.h"
|
9
|
+
#include "cppgc/macros.h"
|
10
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
11
|
+
|
12
|
+
namespace cppgc {
|
13
|
+
|
14
|
+
class HeapHandle;
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Namespace contains testing helpers.
|
18
|
+
*/
|
19
|
+
namespace testing {
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Overrides the state of the stack with the provided value. Parameters passed
|
23
|
+
* to explicit garbage collection calls still take precedence. Must not be
|
24
|
+
* nested.
|
25
|
+
*
|
26
|
+
* This scope is useful to make the garbage collector consider the stack when
|
27
|
+
* tasks that invoke garbage collection (through the provided platform) contain
|
28
|
+
* interesting pointers on its stack.
|
29
|
+
*/
|
30
|
+
class V8_EXPORT V8_NODISCARD OverrideEmbedderStackStateScope final {
|
31
|
+
CPPGC_STACK_ALLOCATED();
|
32
|
+
|
33
|
+
public:
|
34
|
+
/**
|
35
|
+
* Constructs a scoped object that automatically enters and leaves the scope.
|
36
|
+
*
|
37
|
+
* \param heap_handle The corresponding heap.
|
38
|
+
*/
|
39
|
+
explicit OverrideEmbedderStackStateScope(HeapHandle& heap_handle,
|
40
|
+
EmbedderStackState state);
|
41
|
+
~OverrideEmbedderStackStateScope();
|
42
|
+
|
43
|
+
OverrideEmbedderStackStateScope(const OverrideEmbedderStackStateScope&) =
|
44
|
+
delete;
|
45
|
+
OverrideEmbedderStackStateScope& operator=(
|
46
|
+
const OverrideEmbedderStackStateScope&) = delete;
|
47
|
+
|
48
|
+
private:
|
49
|
+
HeapHandle& heap_handle_;
|
50
|
+
};
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Testing interface for managed heaps that allows for controlling garbage
|
54
|
+
* collection timings. Embedders should use this class when testing the
|
55
|
+
* interaction of their code with incremental/concurrent garbage collection.
|
56
|
+
*/
|
57
|
+
class V8_EXPORT StandaloneTestingHeap final {
|
58
|
+
public:
|
59
|
+
explicit StandaloneTestingHeap(HeapHandle&);
|
60
|
+
|
61
|
+
/**
|
62
|
+
* Start an incremental garbage collection.
|
63
|
+
*/
|
64
|
+
void StartGarbageCollection();
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Perform an incremental step. This will also schedule concurrent steps if
|
68
|
+
* needed.
|
69
|
+
*
|
70
|
+
* \param stack_state The state of the stack during the step.
|
71
|
+
*/
|
72
|
+
bool PerformMarkingStep(EmbedderStackState stack_state);
|
73
|
+
|
74
|
+
/**
|
75
|
+
* Finalize the current garbage collection cycle atomically.
|
76
|
+
* Assumes that garbage collection is in progress.
|
77
|
+
*
|
78
|
+
* \param stack_state The state of the stack for finalizing the garbage
|
79
|
+
* collection cycle.
|
80
|
+
*/
|
81
|
+
void FinalizeGarbageCollection(EmbedderStackState stack_state);
|
82
|
+
|
83
|
+
/**
|
84
|
+
* Toggle main thread marking on/off. Allows to stress concurrent marking
|
85
|
+
* (e.g. to better detect data races).
|
86
|
+
*
|
87
|
+
* \param should_mark Denotes whether the main thread should contribute to
|
88
|
+
* marking. Defaults to true.
|
89
|
+
*/
|
90
|
+
void ToggleMainThreadMarking(bool should_mark);
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Force enable compaction for the next garbage collection cycle.
|
94
|
+
*/
|
95
|
+
void ForceCompactionForNextGarbageCollection();
|
96
|
+
|
97
|
+
private:
|
98
|
+
HeapHandle& heap_handle_;
|
99
|
+
};
|
100
|
+
|
101
|
+
V8_EXPORT bool IsHeapObjectOld(void*);
|
102
|
+
|
103
|
+
} // namespace testing
|
104
|
+
} // namespace cppgc
|
105
|
+
|
106
|
+
#endif // INCLUDE_CPPGC_TESTING_H_
|
@@ -55,8 +55,6 @@ struct V8_EXPORT TraceTraitFromInnerAddressImpl {
|
|
55
55
|
static TraceDescriptor GetTraceDescriptor(const void* address);
|
56
56
|
};
|
57
57
|
|
58
|
-
} // namespace internal
|
59
|
-
|
60
58
|
/**
|
61
59
|
* Trait specifying how the garbage collector processes an object of type T.
|
62
60
|
*
|
@@ -64,7 +62,7 @@ struct V8_EXPORT TraceTraitFromInnerAddressImpl {
|
|
64
62
|
* type.
|
65
63
|
*/
|
66
64
|
template <typename T>
|
67
|
-
struct
|
65
|
+
struct TraceTraitBase {
|
68
66
|
static_assert(internal::IsTraceableV<T>, "T must have a Trace() method");
|
69
67
|
|
70
68
|
/**
|
@@ -89,10 +87,17 @@ struct TraceTrait {
|
|
89
87
|
}
|
90
88
|
};
|
91
89
|
|
90
|
+
} // namespace internal
|
91
|
+
|
92
|
+
template <typename T>
|
93
|
+
struct TraceTrait : public internal::TraceTraitBase<T> {};
|
94
|
+
|
92
95
|
namespace internal {
|
93
96
|
|
94
97
|
template <typename T>
|
95
98
|
struct TraceTraitImpl<T, false> {
|
99
|
+
static_assert(IsGarbageCollectedTypeV<T>,
|
100
|
+
"T must be of type GarbageCollected or GarbageCollectedMixin");
|
96
101
|
static TraceDescriptor GetTraceDescriptor(const void* self) {
|
97
102
|
return {self, TraceTrait<T>::Trace};
|
98
103
|
}
|