@downdraft/native-mobile-android-arm64 0.0.0 → 0.1.1
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.
- package/README.md +7 -0
- package/include/node/cppgc/allocation.h +308 -0
- package/include/node/cppgc/common.h +28 -0
- package/include/node/cppgc/cross-thread-persistent.h +462 -0
- package/include/node/cppgc/custom-space.h +97 -0
- package/include/node/cppgc/default-platform.h +68 -0
- package/include/node/cppgc/explicit-management.h +100 -0
- package/include/node/cppgc/garbage-collected.h +114 -0
- package/include/node/cppgc/heap-consistency.h +309 -0
- package/include/node/cppgc/heap-handle.h +48 -0
- package/include/node/cppgc/heap-state.h +82 -0
- package/include/node/cppgc/heap-statistics.h +126 -0
- package/include/node/cppgc/heap.h +202 -0
- package/include/node/cppgc/internal/api-constants.h +75 -0
- package/include/node/cppgc/internal/atomic-entry-flag.h +48 -0
- package/include/node/cppgc/internal/base-page-handle.h +43 -0
- package/include/node/cppgc/internal/caged-heap-local-data.h +117 -0
- package/include/node/cppgc/internal/caged-heap.h +64 -0
- package/include/node/cppgc/internal/compiler-specific.h +46 -0
- package/include/node/cppgc/internal/conditional-stack-allocated.h +41 -0
- package/include/node/cppgc/internal/finalizer-trait.h +93 -0
- package/include/node/cppgc/internal/gc-info.h +150 -0
- package/include/node/cppgc/internal/logging.h +50 -0
- package/include/node/cppgc/internal/member-storage.h +305 -0
- package/include/node/cppgc/internal/name-trait.h +141 -0
- package/include/node/cppgc/internal/persistent-node.h +219 -0
- package/include/node/cppgc/internal/pointer-policies.h +280 -0
- package/include/node/cppgc/internal/write-barrier.h +487 -0
- package/include/node/cppgc/liveness-broker.h +78 -0
- package/include/node/cppgc/macros.h +56 -0
- package/include/node/cppgc/member.h +669 -0
- package/include/node/cppgc/name-provider.h +75 -0
- package/include/node/cppgc/object-size-trait.h +58 -0
- package/include/node/cppgc/persistent.h +376 -0
- package/include/node/cppgc/platform.h +174 -0
- package/include/node/cppgc/prefinalizer.h +75 -0
- package/include/node/cppgc/process-heap-statistics.h +36 -0
- package/include/node/cppgc/sentinel-pointer.h +39 -0
- package/include/node/cppgc/source-location.h +16 -0
- package/include/node/cppgc/tagged-member.h +114 -0
- package/include/node/cppgc/testing.h +106 -0
- package/include/node/cppgc/trace-trait.h +127 -0
- package/include/node/cppgc/type-traits.h +272 -0
- package/include/node/cppgc/visitor.h +534 -0
- package/include/node/js_native_api.h +634 -0
- package/include/node/js_native_api_types.h +244 -0
- package/include/node/libplatform/libplatform-export.h +29 -0
- package/include/node/libplatform/libplatform.h +112 -0
- package/include/node/libplatform/v8-tracing.h +343 -0
- package/include/node/node.h +1744 -0
- package/include/node/node_api.h +265 -0
- package/include/node/node_api_types.h +58 -0
- package/include/node/node_buffer.h +94 -0
- package/include/node/node_object_wrap.h +145 -0
- package/include/node/node_version.h +116 -0
- package/include/node/uv/aix.h +32 -0
- package/include/node/uv/bsd.h +34 -0
- package/include/node/uv/darwin.h +61 -0
- package/include/node/uv/errno.h +483 -0
- package/include/node/uv/linux.h +34 -0
- package/include/node/uv/os390.h +33 -0
- package/include/node/uv/posix.h +31 -0
- package/include/node/uv/sunos.h +44 -0
- package/include/node/uv/threadpool.h +37 -0
- package/include/node/uv/tree.h +521 -0
- package/include/node/uv/unix.h +509 -0
- package/include/node/uv/version.h +43 -0
- package/include/node/uv/win.h +698 -0
- package/include/node/uv.h +1994 -0
- package/include/node/v8-array-buffer.h +646 -0
- package/include/node/v8-callbacks.h +533 -0
- package/include/node/v8-container.h +183 -0
- package/include/node/v8-context.h +580 -0
- package/include/node/v8-cpp-heap-external.h +56 -0
- package/include/node/v8-cppgc.h +194 -0
- package/include/node/v8-data.h +96 -0
- package/include/node/v8-date.h +57 -0
- package/include/node/v8-debug.h +210 -0
- package/include/node/v8-embedder-heap.h +54 -0
- package/include/node/v8-embedder-state-scope.h +52 -0
- package/include/node/v8-exception.h +298 -0
- package/include/node/v8-extension.h +60 -0
- package/include/node/v8-external-memory-accounter.h +60 -0
- package/include/node/v8-external.h +73 -0
- package/include/node/v8-fast-api-calls.h +784 -0
- package/include/node/v8-forward.h +82 -0
- package/include/node/v8-function-callback.h +708 -0
- package/include/node/v8-function.h +148 -0
- package/include/node/v8-handle-base.h +155 -0
- package/include/node/v8-initialization.h +343 -0
- package/include/node/v8-inspector-protocol.h +13 -0
- package/include/node/v8-inspector.h +458 -0
- package/include/node/v8-internal.h +1827 -0
- package/include/node/v8-isolate.h +1925 -0
- package/include/node/v8-json.h +54 -0
- package/include/node/v8-local-handle.h +884 -0
- package/include/node/v8-locker.h +138 -0
- package/include/node/v8-maybe.h +185 -0
- package/include/node/v8-memory-span.h +273 -0
- package/include/node/v8-message.h +215 -0
- package/include/node/v8-metrics.h +273 -0
- package/include/node/v8-microtask-queue.h +152 -0
- package/include/node/v8-microtask.h +28 -0
- package/include/node/v8-object.h +1134 -0
- package/include/node/v8-persistent-handle.h +556 -0
- package/include/node/v8-platform.h +1552 -0
- package/include/node/v8-primitive-object.h +118 -0
- package/include/node/v8-primitive.h +1056 -0
- package/include/node/v8-profiler.h +1401 -0
- package/include/node/v8-promise.h +185 -0
- package/include/node/v8-proxy.h +49 -0
- package/include/node/v8-regexp.h +105 -0
- package/include/node/v8-sandbox.h +170 -0
- package/include/node/v8-script.h +996 -0
- package/include/node/v8-snapshot.h +302 -0
- package/include/node/v8-source-location.h +91 -0
- package/include/node/v8-statistics.h +246 -0
- package/include/node/v8-template.h +1096 -0
- package/include/node/v8-trace-categories.h +28 -0
- package/include/node/v8-traced-handle.h +420 -0
- package/include/node/v8-typed-array.h +386 -0
- package/include/node/v8-unwinder-state.h +30 -0
- package/include/node/v8-unwinder.h +146 -0
- package/include/node/v8-util.h +549 -0
- package/include/node/v8-value-serializer-version.h +24 -0
- package/include/node/v8-value-serializer.h +316 -0
- package/include/node/v8-value.h +674 -0
- package/include/node/v8-version-string.h +38 -0
- package/include/node/v8-version.h +20 -0
- package/include/node/v8-wasm-trap-handler-posix.h +31 -0
- package/include/node/v8-wasm-trap-handler-win.h +28 -0
- package/include/node/v8-wasm.h +325 -0
- package/include/node/v8-weak-callback-info.h +88 -0
- package/include/node/v8.h +88 -0
- package/include/node/v8config.h +1077 -0
- package/lib/libc++_shared.so +0 -0
- package/lib/libnode.so +4 -0
- package/package.json +23 -3
|
@@ -0,0 +1,194 @@
|
|
|
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_V8_CPPGC_H_
|
|
6
|
+
#define INCLUDE_V8_CPPGC_H_
|
|
7
|
+
|
|
8
|
+
#include <cstdint>
|
|
9
|
+
#include <memory>
|
|
10
|
+
#include <vector>
|
|
11
|
+
|
|
12
|
+
#include "cppgc/common.h"
|
|
13
|
+
#include "cppgc/custom-space.h"
|
|
14
|
+
#include "cppgc/heap-statistics.h"
|
|
15
|
+
#include "cppgc/visitor.h"
|
|
16
|
+
#include "v8-internal.h" // NOLINT(build/include_directory)
|
|
17
|
+
#include "v8-platform.h" // NOLINT(build/include_directory)
|
|
18
|
+
#include "v8-traced-handle.h" // NOLINT(build/include_directory)
|
|
19
|
+
|
|
20
|
+
namespace cppgc {
|
|
21
|
+
class AllocationHandle;
|
|
22
|
+
class HeapHandle;
|
|
23
|
+
} // namespace cppgc
|
|
24
|
+
|
|
25
|
+
namespace v8 {
|
|
26
|
+
|
|
27
|
+
class Object;
|
|
28
|
+
|
|
29
|
+
namespace internal {
|
|
30
|
+
class CppHeap;
|
|
31
|
+
} // namespace internal
|
|
32
|
+
|
|
33
|
+
class CustomSpaceStatisticsReceiver;
|
|
34
|
+
|
|
35
|
+
struct V8_EXPORT CppHeapCreateParams {
|
|
36
|
+
explicit CppHeapCreateParams(
|
|
37
|
+
std::vector<std::unique_ptr<cppgc::CustomSpaceBase>> custom_spaces)
|
|
38
|
+
: custom_spaces(std::move(custom_spaces)) {}
|
|
39
|
+
|
|
40
|
+
CppHeapCreateParams(const CppHeapCreateParams&) = delete;
|
|
41
|
+
CppHeapCreateParams& operator=(const CppHeapCreateParams&) = delete;
|
|
42
|
+
|
|
43
|
+
std::vector<std::unique_ptr<cppgc::CustomSpaceBase>> custom_spaces;
|
|
44
|
+
/**
|
|
45
|
+
* Specifies which kind of marking are supported by the heap. The type may be
|
|
46
|
+
* further reduced via runtime flags when attaching the heap to an Isolate.
|
|
47
|
+
*/
|
|
48
|
+
cppgc::Heap::MarkingType marking_support =
|
|
49
|
+
cppgc::Heap::MarkingType::kIncrementalAndConcurrent;
|
|
50
|
+
/**
|
|
51
|
+
* Specifies which kind of sweeping is supported by the heap. The type may be
|
|
52
|
+
* further reduced via runtime flags when attaching the heap to an Isolate.
|
|
53
|
+
*/
|
|
54
|
+
cppgc::Heap::SweepingType sweeping_support =
|
|
55
|
+
cppgc::Heap::SweepingType::kIncrementalAndConcurrent;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A heap for allocating managed C++ objects.
|
|
60
|
+
*
|
|
61
|
+
* Similar to v8::Isolate, the heap may only be accessed from one thread at a
|
|
62
|
+
* time. The heap may be used from different threads using the
|
|
63
|
+
* v8::Locker/v8::Unlocker APIs which is different from generic Oilpan.
|
|
64
|
+
*/
|
|
65
|
+
class V8_EXPORT CppHeap {
|
|
66
|
+
public:
|
|
67
|
+
static std::unique_ptr<CppHeap> Create(v8::Platform* platform,
|
|
68
|
+
const CppHeapCreateParams& params);
|
|
69
|
+
|
|
70
|
+
virtual ~CppHeap() = default;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* \returns the opaque handle for allocating objects using
|
|
74
|
+
* `MakeGarbageCollected()`.
|
|
75
|
+
*/
|
|
76
|
+
cppgc::AllocationHandle& GetAllocationHandle();
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* \returns the opaque heap handle which may be used to refer to this heap in
|
|
80
|
+
* other APIs. Valid as long as the underlying `CppHeap` is alive.
|
|
81
|
+
*/
|
|
82
|
+
cppgc::HeapHandle& GetHeapHandle();
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Terminate clears all roots and performs multiple garbage collections to
|
|
86
|
+
* reclaim potentially newly created objects in destructors.
|
|
87
|
+
*
|
|
88
|
+
* After this call, object allocation is prohibited.
|
|
89
|
+
*/
|
|
90
|
+
V8_DEPRECATED("Terminate gets automatically called in the CppHeap destructor")
|
|
91
|
+
void Terminate();
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* \param detail_level specifies whether should return detailed
|
|
95
|
+
* statistics or only brief summary statistics.
|
|
96
|
+
* \returns current CppHeap statistics regarding memory consumption
|
|
97
|
+
* and utilization.
|
|
98
|
+
*/
|
|
99
|
+
cppgc::HeapStatistics CollectStatistics(
|
|
100
|
+
cppgc::HeapStatistics::DetailLevel detail_level);
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Collects statistics for the given spaces and reports them to the receiver.
|
|
104
|
+
*
|
|
105
|
+
* \param custom_spaces a collection of custom space indices.
|
|
106
|
+
* \param receiver an object that gets the results.
|
|
107
|
+
*/
|
|
108
|
+
void CollectCustomSpaceStatisticsAtLastGC(
|
|
109
|
+
std::vector<cppgc::CustomSpaceIndex> custom_spaces,
|
|
110
|
+
std::unique_ptr<CustomSpaceStatisticsReceiver> receiver);
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Enables a detached mode that allows testing garbage collection using
|
|
114
|
+
* `cppgc::testing` APIs. Once used, the heap cannot be attached to an
|
|
115
|
+
* `Isolate` anymore.
|
|
116
|
+
*/
|
|
117
|
+
void EnableDetachedGarbageCollectionsForTesting();
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Performs a stop-the-world garbage collection for testing purposes.
|
|
121
|
+
*
|
|
122
|
+
* \param stack_state The stack state to assume for the garbage collection.
|
|
123
|
+
*/
|
|
124
|
+
void CollectGarbageForTesting(cppgc::EmbedderStackState stack_state);
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Performs a stop-the-world minor garbage collection for testing purposes.
|
|
128
|
+
*
|
|
129
|
+
* \param stack_state The stack state to assume for the garbage collection.
|
|
130
|
+
*/
|
|
131
|
+
void CollectGarbageInYoungGenerationForTesting(
|
|
132
|
+
cppgc::EmbedderStackState stack_state);
|
|
133
|
+
|
|
134
|
+
private:
|
|
135
|
+
CppHeap() = default;
|
|
136
|
+
|
|
137
|
+
friend class internal::CppHeap;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
class JSVisitor : public cppgc::Visitor {
|
|
141
|
+
public:
|
|
142
|
+
explicit JSVisitor(cppgc::Visitor::Key key) : cppgc::Visitor(key) {}
|
|
143
|
+
~JSVisitor() override = default;
|
|
144
|
+
|
|
145
|
+
void Trace(const TracedReferenceBase& ref) {
|
|
146
|
+
if (ref.IsEmptyThreadSafe()) return;
|
|
147
|
+
Visit(ref);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
protected:
|
|
151
|
+
using cppgc::Visitor::Visit;
|
|
152
|
+
|
|
153
|
+
virtual void Visit(const TracedReferenceBase& ref) {}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Provided as input to `CppHeap::CollectCustomSpaceStatisticsAtLastGC()`.
|
|
158
|
+
*
|
|
159
|
+
* Its method is invoked with the results of the statistic collection.
|
|
160
|
+
*/
|
|
161
|
+
class CustomSpaceStatisticsReceiver {
|
|
162
|
+
public:
|
|
163
|
+
virtual ~CustomSpaceStatisticsReceiver() = default;
|
|
164
|
+
/**
|
|
165
|
+
* Reports the size of a space at the last GC. It is called for each space
|
|
166
|
+
* that was requested in `CollectCustomSpaceStatisticsAtLastGC()`.
|
|
167
|
+
*
|
|
168
|
+
* \param space_index The index of the space.
|
|
169
|
+
* \param bytes The total size of live objects in the space at the last GC.
|
|
170
|
+
* It is zero if there was no GC yet.
|
|
171
|
+
*/
|
|
172
|
+
virtual void AllocatedBytes(cppgc::CustomSpaceIndex space_index,
|
|
173
|
+
size_t bytes) = 0;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
} // namespace v8
|
|
177
|
+
|
|
178
|
+
namespace cppgc {
|
|
179
|
+
|
|
180
|
+
template <typename T>
|
|
181
|
+
struct TraceTrait<v8::TracedReference<T>> {
|
|
182
|
+
static cppgc::TraceDescriptor GetTraceDescriptor(const void* self) {
|
|
183
|
+
return {nullptr, Trace};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
static void Trace(Visitor* visitor, const void* self) {
|
|
187
|
+
static_cast<v8::JSVisitor*>(visitor)->Trace(
|
|
188
|
+
*static_cast<const v8::TracedReference<T>*>(self));
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
} // namespace cppgc
|
|
193
|
+
|
|
194
|
+
#endif // INCLUDE_V8_CPPGC_H_
|
|
@@ -0,0 +1,96 @@
|
|
|
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_V8_DATA_H_
|
|
6
|
+
#define INCLUDE_V8_DATA_H_
|
|
7
|
+
|
|
8
|
+
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
|
9
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
|
10
|
+
|
|
11
|
+
namespace v8 {
|
|
12
|
+
|
|
13
|
+
class Context;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The superclass of objects that can reside on V8's heap.
|
|
17
|
+
*/
|
|
18
|
+
class V8_EXPORT Data {
|
|
19
|
+
public:
|
|
20
|
+
/**
|
|
21
|
+
* Returns true if this data is a |v8::Value|.
|
|
22
|
+
*/
|
|
23
|
+
bool IsValue() const;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Returns true if this data is a |v8::Module|.
|
|
27
|
+
*/
|
|
28
|
+
bool IsModule() const;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Returns true if this data is a |v8::ModuleRequest|.
|
|
32
|
+
*/
|
|
33
|
+
bool IsModuleRequest() const;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Returns tru if this data is a |v8::FixedArray|
|
|
37
|
+
*/
|
|
38
|
+
bool IsFixedArray() const;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Returns true if this data is a |v8::Private|.
|
|
42
|
+
*/
|
|
43
|
+
bool IsPrivate() const;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Returns true if this data is a |v8::ObjectTemplate|.
|
|
47
|
+
*/
|
|
48
|
+
bool IsObjectTemplate() const;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Returns true if this data is a |v8::FunctionTemplate|.
|
|
52
|
+
*/
|
|
53
|
+
bool IsFunctionTemplate() const;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Returns true if this data is a |v8::DictionaryTemplate|.
|
|
57
|
+
*/
|
|
58
|
+
bool IsDictionaryTemplate() const;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Returns true if this data is a |v8::Context|.
|
|
62
|
+
*/
|
|
63
|
+
bool IsContext() const;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Returns true if this value is a `CppHeapExternal` object.
|
|
67
|
+
*/
|
|
68
|
+
bool IsCppHeapExternal() const;
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
Data() = delete;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A fixed-sized array with elements of type Data.
|
|
76
|
+
*/
|
|
77
|
+
class V8_EXPORT FixedArray : public Data {
|
|
78
|
+
public:
|
|
79
|
+
int Length() const;
|
|
80
|
+
|
|
81
|
+
Local<Data> Get(int i) const;
|
|
82
|
+
|
|
83
|
+
V8_INLINE static FixedArray* Cast(Data* data) {
|
|
84
|
+
#ifdef V8_ENABLE_CHECKS
|
|
85
|
+
CheckCast(data);
|
|
86
|
+
#endif
|
|
87
|
+
return reinterpret_cast<FixedArray*>(data);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
private:
|
|
91
|
+
static void CheckCast(Data* obj);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
} // namespace v8
|
|
95
|
+
|
|
96
|
+
#endif // INCLUDE_V8_DATA_H_
|
|
@@ -0,0 +1,57 @@
|
|
|
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_V8_DATE_H_
|
|
6
|
+
#define INCLUDE_V8_DATE_H_
|
|
7
|
+
|
|
8
|
+
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
|
9
|
+
#include "v8-object.h" // NOLINT(build/include_directory)
|
|
10
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
|
11
|
+
|
|
12
|
+
namespace v8 {
|
|
13
|
+
|
|
14
|
+
class Context;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* An instance of the built-in Date constructor (ECMA-262, 15.9).
|
|
18
|
+
*/
|
|
19
|
+
class V8_EXPORT Date : public Object {
|
|
20
|
+
public:
|
|
21
|
+
static V8_WARN_UNUSED_RESULT MaybeLocal<Value> New(Local<Context> context,
|
|
22
|
+
double time);
|
|
23
|
+
|
|
24
|
+
static V8_WARN_UNUSED_RESULT MaybeLocal<Value> Parse(
|
|
25
|
+
Local<Context> context,
|
|
26
|
+
Local<String> date_string);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A specialization of Value::NumberValue that is more efficient
|
|
30
|
+
* because we know the structure of this object.
|
|
31
|
+
*/
|
|
32
|
+
double ValueOf() const;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Generates ISO string representation.
|
|
36
|
+
*/
|
|
37
|
+
v8::Local<v8::String> ToISOString() const;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Generates UTC string representation.
|
|
41
|
+
*/
|
|
42
|
+
v8::Local<v8::String> ToUTCString() const;
|
|
43
|
+
|
|
44
|
+
V8_INLINE static Date* Cast(Value* value) {
|
|
45
|
+
#ifdef V8_ENABLE_CHECKS
|
|
46
|
+
CheckCast(value);
|
|
47
|
+
#endif
|
|
48
|
+
return static_cast<Date*>(value);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private:
|
|
52
|
+
static void CheckCast(Value* obj);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
} // namespace v8
|
|
56
|
+
|
|
57
|
+
#endif // INCLUDE_V8_DATE_H_
|
|
@@ -0,0 +1,210 @@
|
|
|
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_V8_DEBUG_H_
|
|
6
|
+
#define INCLUDE_V8_DEBUG_H_
|
|
7
|
+
|
|
8
|
+
#include <stdint.h>
|
|
9
|
+
|
|
10
|
+
#include "v8-script.h" // NOLINT(build/include_directory)
|
|
11
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
|
12
|
+
|
|
13
|
+
namespace v8 {
|
|
14
|
+
|
|
15
|
+
class Isolate;
|
|
16
|
+
class String;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A single JavaScript stack frame.
|
|
20
|
+
*/
|
|
21
|
+
class V8_EXPORT StackFrame {
|
|
22
|
+
public:
|
|
23
|
+
/**
|
|
24
|
+
* Returns the source location, 0-based, for the associated function call.
|
|
25
|
+
*/
|
|
26
|
+
Location GetLocation() const;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Returns the number, 1-based, of the line for the associate function call.
|
|
30
|
+
* This method will return Message::kNoLineNumberInfo if it is unable to
|
|
31
|
+
* retrieve the line number, or if kLineNumber was not passed as an option
|
|
32
|
+
* when capturing the StackTrace.
|
|
33
|
+
*/
|
|
34
|
+
int GetLineNumber() const { return GetLocation().GetLineNumber() + 1; }
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Returns the 1-based column offset on the line for the associated function
|
|
38
|
+
* call.
|
|
39
|
+
* This method will return Message::kNoColumnInfo if it is unable to retrieve
|
|
40
|
+
* the column number, or if kColumnOffset was not passed as an option when
|
|
41
|
+
* capturing the StackTrace.
|
|
42
|
+
*/
|
|
43
|
+
int GetColumn() const { return GetLocation().GetColumnNumber() + 1; }
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Returns zero based source position (character offset) for the associated
|
|
47
|
+
* function.
|
|
48
|
+
*/
|
|
49
|
+
int GetSourcePosition() const;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Returns the id of the script for the function for this StackFrame.
|
|
53
|
+
* This method will return Message::kNoScriptIdInfo if it is unable to
|
|
54
|
+
* retrieve the script id, or if kScriptId was not passed as an option when
|
|
55
|
+
* capturing the StackTrace.
|
|
56
|
+
*/
|
|
57
|
+
int GetScriptId() const;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Returns the name of the resource that contains the script for the
|
|
61
|
+
* function for this StackFrame.
|
|
62
|
+
*/
|
|
63
|
+
Local<String> GetScriptName() const;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Returns the name of the resource that contains the script for the
|
|
67
|
+
* function for this StackFrame or sourceURL value if the script name
|
|
68
|
+
* is undefined and its source ends with //# sourceURL=... string or
|
|
69
|
+
* deprecated //@ sourceURL=... string.
|
|
70
|
+
*/
|
|
71
|
+
Local<String> GetScriptNameOrSourceURL() const;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Returns the source of the script for the function for this StackFrame.
|
|
75
|
+
*/
|
|
76
|
+
Local<String> GetScriptSource() const;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Returns the source mapping URL (if one is present) of the script for
|
|
80
|
+
* the function for this StackFrame.
|
|
81
|
+
*/
|
|
82
|
+
Local<String> GetScriptSourceMappingURL() const;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Returns the name of the function associated with this stack frame.
|
|
86
|
+
*/
|
|
87
|
+
Local<String> GetFunctionName() const;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Returns whether or not the associated function is compiled via a call to
|
|
91
|
+
* eval().
|
|
92
|
+
*/
|
|
93
|
+
bool IsEval() const;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Returns whether or not the associated function is called as a
|
|
97
|
+
* constructor via "new".
|
|
98
|
+
*/
|
|
99
|
+
bool IsConstructor() const;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Returns whether or not the associated functions is defined in wasm.
|
|
103
|
+
*/
|
|
104
|
+
bool IsWasm() const;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Returns whether or not the associated function is defined by the user.
|
|
108
|
+
*/
|
|
109
|
+
bool IsUserJavaScript() const;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Representation of a JavaScript stack trace. The information collected is a
|
|
114
|
+
* snapshot of the execution stack and the information remains valid after
|
|
115
|
+
* execution continues.
|
|
116
|
+
*/
|
|
117
|
+
class V8_EXPORT StackTrace {
|
|
118
|
+
public:
|
|
119
|
+
/**
|
|
120
|
+
* Flags that determine what information is placed captured for each
|
|
121
|
+
* StackFrame when grabbing the current stack trace.
|
|
122
|
+
* Note: these options are deprecated and we always collect all available
|
|
123
|
+
* information (kDetailed).
|
|
124
|
+
*/
|
|
125
|
+
enum StackTraceOptions {
|
|
126
|
+
kLineNumber = 1,
|
|
127
|
+
kColumnOffset = 1 << 1 | kLineNumber,
|
|
128
|
+
kScriptName = 1 << 2,
|
|
129
|
+
kFunctionName = 1 << 3,
|
|
130
|
+
kIsEval = 1 << 4,
|
|
131
|
+
kIsConstructor = 1 << 5,
|
|
132
|
+
kScriptNameOrSourceURL = 1 << 6,
|
|
133
|
+
kScriptId = 1 << 7,
|
|
134
|
+
kExposeFramesAcrossSecurityOrigins = 1 << 8,
|
|
135
|
+
kOverview = kLineNumber | kColumnOffset | kScriptName | kFunctionName,
|
|
136
|
+
kDetailed = kOverview | kIsEval | kIsConstructor | kScriptNameOrSourceURL
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
struct ScriptIdAndContext {
|
|
140
|
+
int id;
|
|
141
|
+
v8::Local<v8::Context> context;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Returns the (unique) ID of this stack trace.
|
|
146
|
+
*/
|
|
147
|
+
int GetID() const;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Returns a StackFrame at a particular index.
|
|
151
|
+
*/
|
|
152
|
+
Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Returns the number of StackFrames.
|
|
156
|
+
*/
|
|
157
|
+
int GetFrameCount() const;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Grab a snapshot of the current JavaScript execution stack.
|
|
161
|
+
*
|
|
162
|
+
* \param frame_limit The maximum number of stack frames we want to capture.
|
|
163
|
+
* \param options Enumerates the set of things we will capture for each
|
|
164
|
+
* StackFrame.
|
|
165
|
+
*/
|
|
166
|
+
static Local<StackTrace> CurrentStackTrace(
|
|
167
|
+
Isolate* isolate, int frame_limit, StackTraceOptions options = kDetailed);
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Returns the first valid script name or source URL starting at the top of
|
|
171
|
+
* the JS stack. The returned string is either an empty handle if no script
|
|
172
|
+
* name/url was found or a non-zero-length string.
|
|
173
|
+
*
|
|
174
|
+
* This method is equivalent to calling StackTrace::CurrentStackTrace and
|
|
175
|
+
* walking the resulting frames from the beginning until a non-empty script
|
|
176
|
+
* name/url is found. The difference is that this method won't allocate
|
|
177
|
+
* a stack trace.
|
|
178
|
+
*/
|
|
179
|
+
static Local<String> CurrentScriptNameOrSourceURL(Isolate* isolate);
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Returns the first valid script id at the top of the JS stack. The returned
|
|
183
|
+
* value is Message::kNoScriptIdInfo if no id was found.
|
|
184
|
+
*
|
|
185
|
+
* This method is equivalent to calling StackTrace::CurrentStackTrace and
|
|
186
|
+
* walking the resulting frames from the beginning until a non-empty id is
|
|
187
|
+
* found. The difference is that this method won't allocate a stack trace.
|
|
188
|
+
*/
|
|
189
|
+
static int CurrentScriptId(Isolate* isolate);
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Writes up to the first `frame_data.size()` valid script ids and function
|
|
193
|
+
* contexts at the top of the JS stack into the given span. Returns a span
|
|
194
|
+
* sized to the number of frames worth of data written. It's similar to the
|
|
195
|
+
* CurrentStackTrace method but doesn't allocate a stack trace. Further, it
|
|
196
|
+
* skips frames that don't have valid script ids or function contexts. The
|
|
197
|
+
* final difference is that the script id written for evals or regexp is that
|
|
198
|
+
* of the script that ran eval() or regexp, not the current context.
|
|
199
|
+
*
|
|
200
|
+
* WARNING: This is an unfinished experimental feature. Semantics and
|
|
201
|
+
* implementation may change frequently.
|
|
202
|
+
*/
|
|
203
|
+
static v8::MemorySpan<v8::StackTrace::ScriptIdAndContext>
|
|
204
|
+
CurrentScriptIdsAndContexts(Isolate* isolate,
|
|
205
|
+
v8::MemorySpan<ScriptIdAndContext> frame_data);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
} // namespace v8
|
|
209
|
+
|
|
210
|
+
#endif // INCLUDE_V8_DEBUG_H_
|
|
@@ -0,0 +1,54 @@
|
|
|
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_V8_EMBEDDER_HEAP_H_
|
|
6
|
+
#define INCLUDE_V8_EMBEDDER_HEAP_H_
|
|
7
|
+
|
|
8
|
+
#include "v8-traced-handle.h" // NOLINT(build/include_directory)
|
|
9
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
|
10
|
+
|
|
11
|
+
namespace v8 {
|
|
12
|
+
namespace internal {
|
|
13
|
+
class TracedHandles;
|
|
14
|
+
} // namespace internal
|
|
15
|
+
|
|
16
|
+
class Isolate;
|
|
17
|
+
class Value;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Handler for embedder roots on non-unified heap garbage collections.
|
|
21
|
+
*/
|
|
22
|
+
class V8_EXPORT EmbedderRootsHandler {
|
|
23
|
+
public:
|
|
24
|
+
virtual ~EmbedderRootsHandler() = default;
|
|
25
|
+
|
|
26
|
+
EmbedderRootsHandler() = default;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Used in combination with |IsRoot|. Called by V8 when an
|
|
30
|
+
* object that is backed by a handle is reclaimed by a non-tracing garbage
|
|
31
|
+
* collection. It is up to the embedder to reset the original handle.
|
|
32
|
+
*
|
|
33
|
+
* Note that the |handle| is different from the handle that the embedder holds
|
|
34
|
+
* for retaining the object. It is up to the embedder to find the original
|
|
35
|
+
* handle via the object or class id.
|
|
36
|
+
*/
|
|
37
|
+
virtual void ResetRoot(const v8::TracedReference<v8::Value>& handle) = 0;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Similar to |ResetRoot()|, but opportunistic. The function is called in
|
|
41
|
+
* parallel for different handles and as such must be thread-safe. In case,
|
|
42
|
+
* |false| is returned, |ResetRoot()| will be recalled for the same handle.
|
|
43
|
+
*/
|
|
44
|
+
virtual bool TryResetRoot(const v8::TracedReference<v8::Value>& handle) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private:
|
|
49
|
+
friend class internal::TracedHandles;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
} // namespace v8
|
|
53
|
+
|
|
54
|
+
#endif // INCLUDE_V8_EMBEDDER_HEAP_H_
|
|
@@ -0,0 +1,52 @@
|
|
|
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_V8_EMBEDDER_STATE_SCOPE_H_
|
|
6
|
+
#define INCLUDE_V8_EMBEDDER_STATE_SCOPE_H_
|
|
7
|
+
|
|
8
|
+
#include <memory>
|
|
9
|
+
|
|
10
|
+
#include "v8-internal.h" // NOLINT(build/include_directory)
|
|
11
|
+
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
|
12
|
+
|
|
13
|
+
namespace v8 {
|
|
14
|
+
|
|
15
|
+
class Context;
|
|
16
|
+
|
|
17
|
+
namespace internal {
|
|
18
|
+
class EmbedderState;
|
|
19
|
+
} // namespace internal
|
|
20
|
+
|
|
21
|
+
// A StateTag represents a possible state of the embedder.
|
|
22
|
+
enum class EmbedderStateTag : uint8_t {
|
|
23
|
+
// reserved
|
|
24
|
+
EMPTY = 0,
|
|
25
|
+
OTHER = 1,
|
|
26
|
+
// embedder can define any state after
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// A stack-allocated class that manages an embedder state on the isolate.
|
|
30
|
+
// After an EmbedderState scope has been created, a new embedder state will be
|
|
31
|
+
// pushed on the isolate stack.
|
|
32
|
+
class V8_EXPORT EmbedderStateScope {
|
|
33
|
+
public:
|
|
34
|
+
EmbedderStateScope(Isolate* isolate, Local<v8::Context> context,
|
|
35
|
+
EmbedderStateTag tag);
|
|
36
|
+
|
|
37
|
+
~EmbedderStateScope();
|
|
38
|
+
|
|
39
|
+
private:
|
|
40
|
+
// Declaring operator new and delete as deleted is not spec compliant.
|
|
41
|
+
// Therefore declare them private instead to disable dynamic alloc
|
|
42
|
+
void* operator new(size_t size);
|
|
43
|
+
void* operator new[](size_t size);
|
|
44
|
+
void operator delete(void*, size_t);
|
|
45
|
+
void operator delete[](void*, size_t);
|
|
46
|
+
|
|
47
|
+
std::unique_ptr<internal::EmbedderState> embedder_state_;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
} // namespace v8
|
|
51
|
+
|
|
52
|
+
#endif // INCLUDE_V8_EMBEDDER_STATE_SCOPE_H_
|