libv8-node 17.9.1.0-aarch64-linux → 18.13.0.0-aarch64-linux
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/paths.rb +1 -1
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/aarch64-linux/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/allocation.h +88 -17
- data/vendor/v8/include/cppgc/default-platform.h +2 -10
- data/vendor/v8/include/cppgc/explicit-management.h +22 -4
- data/vendor/v8/include/cppgc/garbage-collected.h +15 -26
- data/vendor/v8/include/cppgc/heap-consistency.h +13 -0
- data/vendor/v8/include/cppgc/heap-state.h +12 -0
- data/vendor/v8/include/cppgc/heap.h +7 -2
- data/vendor/v8/include/cppgc/internal/api-constants.h +8 -0
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +23 -12
- data/vendor/v8/include/cppgc/internal/finalizer-trait.h +2 -1
- data/vendor/v8/include/cppgc/internal/logging.h +3 -3
- data/vendor/v8/include/cppgc/internal/persistent-node.h +39 -27
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +4 -4
- data/vendor/v8/include/cppgc/internal/write-barrier.h +26 -32
- data/vendor/v8/include/cppgc/member.h +5 -2
- data/vendor/v8/include/cppgc/persistent.h +30 -31
- data/vendor/v8/include/cppgc/platform.h +3 -1
- data/vendor/v8/include/cppgc/prefinalizer.h +34 -11
- data/vendor/v8/include/cppgc/testing.h +9 -2
- data/vendor/v8/include/cppgc/type-traits.h +6 -13
- data/vendor/v8/include/libplatform/libplatform.h +0 -11
- data/vendor/v8/include/libplatform/v8-tracing.h +0 -1
- data/vendor/v8/include/v8-array-buffer.h +22 -2
- data/vendor/v8/include/v8-callbacks.h +26 -6
- data/vendor/v8/include/v8-context.h +3 -14
- data/vendor/v8/include/v8-cppgc.h +16 -126
- data/vendor/v8/include/v8-data.h +15 -0
- data/vendor/v8/include/v8-debug.h +21 -4
- data/vendor/v8/include/v8-embedder-heap.h +10 -30
- data/vendor/v8/include/v8-embedder-state-scope.h +51 -0
- data/vendor/v8/include/v8-exception.h +0 -7
- data/vendor/v8/include/v8-fast-api-calls.h +82 -31
- data/vendor/v8/include/v8-function.h +3 -0
- data/vendor/v8/include/v8-initialization.h +64 -31
- data/vendor/v8/include/v8-inspector.h +45 -4
- data/vendor/v8/include/v8-internal.h +189 -102
- data/vendor/v8/include/v8-isolate.h +49 -2
- data/vendor/v8/include/v8-local-handle.h +0 -4
- data/vendor/v8/include/v8-locker.h +2 -1
- data/vendor/v8/include/v8-message.h +19 -44
- data/vendor/v8/include/v8-metrics.h +32 -15
- data/vendor/v8/include/v8-object.h +11 -6
- data/vendor/v8/include/v8-platform.h +365 -6
- data/vendor/v8/include/v8-primitive.h +14 -6
- data/vendor/v8/include/v8-profiler.h +78 -2
- data/vendor/v8/include/v8-script.h +27 -51
- data/vendor/v8/include/v8-snapshot.h +0 -2
- data/vendor/v8/include/v8-statistics.h +2 -0
- data/vendor/v8/include/v8-template.h +31 -4
- data/vendor/v8/include/v8-traced-handle.h +39 -224
- data/vendor/v8/include/v8-unwinder.h +10 -7
- data/vendor/v8/include/v8-value-serializer-version.h +1 -1
- data/vendor/v8/include/v8-value-serializer.h +32 -2
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8-wasm.h +13 -1
- data/vendor/v8/include/v8-weak-callback-info.h +20 -6
- data/vendor/v8/include/v8.h +0 -1
- data/vendor/v8/include/v8config.h +56 -11
- metadata +3 -3
- data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +0 -30
@@ -47,7 +47,9 @@ class V8_EXPORT ScriptOrModule {
|
|
47
47
|
* The options that were passed by the embedder as HostDefinedOptions to
|
48
48
|
* the ScriptOrigin.
|
49
49
|
*/
|
50
|
+
V8_DEPRECATED("Use HostDefinedOptions")
|
50
51
|
Local<PrimitiveArray> GetHostDefinedOptions();
|
52
|
+
Local<Data> HostDefinedOptions();
|
51
53
|
};
|
52
54
|
|
53
55
|
/**
|
@@ -170,29 +172,6 @@ class V8_EXPORT Module : public Data {
|
|
170
172
|
*/
|
171
173
|
Local<Value> GetException() const;
|
172
174
|
|
173
|
-
/**
|
174
|
-
* Returns the number of modules requested by this module.
|
175
|
-
*/
|
176
|
-
V8_DEPRECATE_SOON("Use Module::GetModuleRequests() and FixedArray::Length().")
|
177
|
-
int GetModuleRequestsLength() const;
|
178
|
-
|
179
|
-
/**
|
180
|
-
* Returns the ith module specifier in this module.
|
181
|
-
* i must be < GetModuleRequestsLength() and >= 0.
|
182
|
-
*/
|
183
|
-
V8_DEPRECATE_SOON(
|
184
|
-
"Use Module::GetModuleRequests() and ModuleRequest::GetSpecifier().")
|
185
|
-
Local<String> GetModuleRequest(int i) const;
|
186
|
-
|
187
|
-
/**
|
188
|
-
* Returns the source location (line number and column number) of the ith
|
189
|
-
* module specifier's first occurrence in this module.
|
190
|
-
*/
|
191
|
-
V8_DEPRECATE_SOON(
|
192
|
-
"Use Module::GetModuleRequests(), ModuleRequest::GetSourceOffset(), and "
|
193
|
-
"Module::SourceOffsetToLocation().")
|
194
|
-
Location GetModuleRequestLocation(int i) const;
|
195
|
-
|
196
175
|
/**
|
197
176
|
* Returns the ModuleRequests for this module.
|
198
177
|
*/
|
@@ -209,9 +188,6 @@ class V8_EXPORT Module : public Data {
|
|
209
188
|
*/
|
210
189
|
int GetIdentityHash() const;
|
211
190
|
|
212
|
-
using ResolveCallback =
|
213
|
-
MaybeLocal<Module> (*)(Local<Context> context, Local<String> specifier,
|
214
|
-
Local<Module> referrer);
|
215
191
|
using ResolveModuleCallback = MaybeLocal<Module> (*)(
|
216
192
|
Local<Context> context, Local<String> specifier,
|
217
193
|
Local<FixedArray> import_assertions, Local<Module> referrer);
|
@@ -223,11 +199,6 @@ class V8_EXPORT Module : public Data {
|
|
223
199
|
* instantiation. (In the case where the callback throws an exception, that
|
224
200
|
* exception is propagated.)
|
225
201
|
*/
|
226
|
-
V8_DEPRECATE_SOON(
|
227
|
-
"Use the version of InstantiateModule that takes a ResolveModuleCallback "
|
228
|
-
"parameter")
|
229
|
-
V8_WARN_UNUSED_RESULT Maybe<bool> InstantiateModule(Local<Context> context,
|
230
|
-
ResolveCallback callback);
|
231
202
|
V8_WARN_UNUSED_RESULT Maybe<bool> InstantiateModule(
|
232
203
|
Local<Context> context, ResolveModuleCallback callback);
|
233
204
|
|
@@ -340,11 +311,19 @@ class V8_EXPORT Script {
|
|
340
311
|
* UnboundScript::BindToCurrentContext()).
|
341
312
|
*/
|
342
313
|
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Run(Local<Context> context);
|
314
|
+
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Run(Local<Context> context,
|
315
|
+
Local<Data> host_defined_options);
|
343
316
|
|
344
317
|
/**
|
345
318
|
* Returns the corresponding context-unbound script.
|
346
319
|
*/
|
347
320
|
Local<UnboundScript> GetUnboundScript();
|
321
|
+
|
322
|
+
/**
|
323
|
+
* The name that was passed by the embedder as ResourceName to the
|
324
|
+
* ScriptOrigin. This can be either a v8::String or v8::Undefined.
|
325
|
+
*/
|
326
|
+
Local<Value> GetResourceName();
|
348
327
|
};
|
349
328
|
|
350
329
|
enum class ScriptType { kClassic, kModule };
|
@@ -397,6 +376,7 @@ class V8_EXPORT ScriptCompiler {
|
|
397
376
|
class Source {
|
398
377
|
public:
|
399
378
|
// Source takes ownership of both CachedData and CodeCacheConsumeTask.
|
379
|
+
// The caller *must* ensure that the cached data is from a trusted source.
|
400
380
|
V8_INLINE Source(Local<String> source_string, const ScriptOrigin& origin,
|
401
381
|
CachedData* cached_data = nullptr,
|
402
382
|
ConsumeCodeCacheTask* consume_cache_task = nullptr);
|
@@ -424,7 +404,7 @@ class V8_EXPORT ScriptCompiler {
|
|
424
404
|
int resource_column_offset;
|
425
405
|
ScriptOriginOptions resource_options;
|
426
406
|
Local<Value> source_map_url;
|
427
|
-
Local<
|
407
|
+
Local<Data> host_defined_options;
|
428
408
|
|
429
409
|
// Cached data from previous compilation (if a kConsume*Cache flag is
|
430
410
|
// set), or hold newly generated cache data (kProduce*Cache flags) are
|
@@ -463,23 +443,6 @@ class V8_EXPORT ScriptCompiler {
|
|
463
443
|
* V8 has parsed the data it received so far.
|
464
444
|
*/
|
465
445
|
virtual size_t GetMoreData(const uint8_t** src) = 0;
|
466
|
-
|
467
|
-
/**
|
468
|
-
* V8 calls this method to set a 'bookmark' at the current position in
|
469
|
-
* the source stream, for the purpose of (maybe) later calling
|
470
|
-
* ResetToBookmark. If ResetToBookmark is called later, then subsequent
|
471
|
-
* calls to GetMoreData should return the same data as they did when
|
472
|
-
* SetBookmark was called earlier.
|
473
|
-
*
|
474
|
-
* The embedder may return 'false' to indicate it cannot provide this
|
475
|
-
* functionality.
|
476
|
-
*/
|
477
|
-
virtual bool SetBookmark();
|
478
|
-
|
479
|
-
/**
|
480
|
-
* V8 calls this to return to a previously set bookmark.
|
481
|
-
*/
|
482
|
-
virtual void ResetToBookmark();
|
483
446
|
};
|
484
447
|
|
485
448
|
/**
|
@@ -694,6 +657,12 @@ class V8_EXPORT ScriptCompiler {
|
|
694
657
|
CompileOptions options = kNoCompileOptions,
|
695
658
|
NoCacheReason no_cache_reason = kNoCacheNoReason,
|
696
659
|
Local<ScriptOrModule>* script_or_module_out = nullptr);
|
660
|
+
static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunction(
|
661
|
+
Local<Context> context, Source* source, size_t arguments_count = 0,
|
662
|
+
Local<String> arguments[] = nullptr, size_t context_extension_count = 0,
|
663
|
+
Local<Object> context_extensions[] = nullptr,
|
664
|
+
CompileOptions options = kNoCompileOptions,
|
665
|
+
NoCacheReason no_cache_reason = kNoCacheNoReason);
|
697
666
|
|
698
667
|
/**
|
699
668
|
* Creates and returns code cache for the specified unbound_script.
|
@@ -712,7 +681,7 @@ class V8_EXPORT ScriptCompiler {
|
|
712
681
|
|
713
682
|
/**
|
714
683
|
* Creates and returns code cache for the specified function that was
|
715
|
-
* previously produced by
|
684
|
+
* previously produced by CompileFunction.
|
716
685
|
* This will return nullptr if the script cannot be serialized. The
|
717
686
|
* CachedData returned by this function should be owned by the caller.
|
718
687
|
*/
|
@@ -722,6 +691,13 @@ class V8_EXPORT ScriptCompiler {
|
|
722
691
|
static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundInternal(
|
723
692
|
Isolate* isolate, Source* source, CompileOptions options,
|
724
693
|
NoCacheReason no_cache_reason);
|
694
|
+
|
695
|
+
static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunctionInternal(
|
696
|
+
Local<Context> context, Source* source, size_t arguments_count,
|
697
|
+
Local<String> arguments[], size_t context_extension_count,
|
698
|
+
Local<Object> context_extensions[], CompileOptions options,
|
699
|
+
NoCacheReason no_cache_reason,
|
700
|
+
Local<ScriptOrModule>* script_or_module_out);
|
725
701
|
};
|
726
702
|
|
727
703
|
ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin,
|
@@ -733,7 +709,7 @@ ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin,
|
|
733
709
|
resource_column_offset(origin.ColumnOffset()),
|
734
710
|
resource_options(origin.Options()),
|
735
711
|
source_map_url(origin.SourceMapUrl()),
|
736
|
-
host_defined_options(origin.
|
712
|
+
host_defined_options(origin.GetHostDefinedOptions()),
|
737
713
|
cached_data(data),
|
738
714
|
consume_cache_task(consume_cache_task) {}
|
739
715
|
|
@@ -5,8 +5,6 @@
|
|
5
5
|
#ifndef INCLUDE_V8_SNAPSHOT_H_
|
6
6
|
#define INCLUDE_V8_SNAPSHOT_H_
|
7
7
|
|
8
|
-
#include <vector>
|
9
|
-
|
10
8
|
#include "v8-internal.h" // NOLINT(build/include_directory)
|
11
9
|
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
12
10
|
#include "v8config.h" // NOLINT(build/include_directory)
|
@@ -201,11 +201,13 @@ class V8_EXPORT HeapCodeStatistics {
|
|
201
201
|
size_t code_and_metadata_size() { return code_and_metadata_size_; }
|
202
202
|
size_t bytecode_and_metadata_size() { return bytecode_and_metadata_size_; }
|
203
203
|
size_t external_script_source_size() { return external_script_source_size_; }
|
204
|
+
size_t cpu_profiler_metadata_size() { return cpu_profiler_metadata_size_; }
|
204
205
|
|
205
206
|
private:
|
206
207
|
size_t code_and_metadata_size_;
|
207
208
|
size_t bytecode_and_metadata_size_;
|
208
209
|
size_t external_script_source_size_;
|
210
|
+
size_t cpu_profiler_metadata_size_;
|
209
211
|
|
210
212
|
friend class Isolate;
|
211
213
|
};
|
@@ -89,11 +89,26 @@ class V8_EXPORT Template : public Data {
|
|
89
89
|
* defined by FunctionTemplate::HasInstance()), an implicit TypeError is
|
90
90
|
* thrown and no callback is invoked.
|
91
91
|
*/
|
92
|
+
V8_DEPRECATED("Do signature check in accessor")
|
93
|
+
void SetNativeDataProperty(
|
94
|
+
Local<String> name, AccessorGetterCallback getter,
|
95
|
+
AccessorSetterCallback setter, Local<Value> data,
|
96
|
+
PropertyAttribute attribute, Local<AccessorSignature> signature,
|
97
|
+
AccessControl settings = DEFAULT,
|
98
|
+
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
99
|
+
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
100
|
+
V8_DEPRECATED("Do signature check in accessor")
|
101
|
+
void SetNativeDataProperty(
|
102
|
+
Local<Name> name, AccessorNameGetterCallback getter,
|
103
|
+
AccessorNameSetterCallback setter, Local<Value> data,
|
104
|
+
PropertyAttribute attribute, Local<AccessorSignature> signature,
|
105
|
+
AccessControl settings = DEFAULT,
|
106
|
+
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
107
|
+
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
92
108
|
void SetNativeDataProperty(
|
93
109
|
Local<String> name, AccessorGetterCallback getter,
|
94
110
|
AccessorSetterCallback setter = nullptr,
|
95
111
|
Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
|
96
|
-
Local<AccessorSignature> signature = Local<AccessorSignature>(),
|
97
112
|
AccessControl settings = DEFAULT,
|
98
113
|
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
99
114
|
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
@@ -101,7 +116,6 @@ class V8_EXPORT Template : public Data {
|
|
101
116
|
Local<Name> name, AccessorNameGetterCallback getter,
|
102
117
|
AccessorNameSetterCallback setter = nullptr,
|
103
118
|
Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
|
104
|
-
Local<AccessorSignature> signature = Local<AccessorSignature>(),
|
105
119
|
AccessControl settings = DEFAULT,
|
106
120
|
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
107
121
|
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
@@ -813,12 +827,26 @@ class V8_EXPORT ObjectTemplate : public Template {
|
|
813
827
|
* defined by FunctionTemplate::HasInstance()), an implicit TypeError is
|
814
828
|
* thrown and no callback is invoked.
|
815
829
|
*/
|
830
|
+
V8_DEPRECATED("Do signature check in accessor")
|
831
|
+
void SetAccessor(
|
832
|
+
Local<String> name, AccessorGetterCallback getter,
|
833
|
+
AccessorSetterCallback setter, Local<Value> data, AccessControl settings,
|
834
|
+
PropertyAttribute attribute, Local<AccessorSignature> signature,
|
835
|
+
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
836
|
+
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
837
|
+
V8_DEPRECATED("Do signature check in accessor")
|
838
|
+
void SetAccessor(
|
839
|
+
Local<Name> name, AccessorNameGetterCallback getter,
|
840
|
+
AccessorNameSetterCallback setter, Local<Value> data,
|
841
|
+
AccessControl settings, PropertyAttribute attribute,
|
842
|
+
Local<AccessorSignature> signature,
|
843
|
+
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
844
|
+
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
816
845
|
void SetAccessor(
|
817
846
|
Local<String> name, AccessorGetterCallback getter,
|
818
847
|
AccessorSetterCallback setter = nullptr,
|
819
848
|
Local<Value> data = Local<Value>(), AccessControl settings = DEFAULT,
|
820
849
|
PropertyAttribute attribute = None,
|
821
|
-
Local<AccessorSignature> signature = Local<AccessorSignature>(),
|
822
850
|
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
823
851
|
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
824
852
|
void SetAccessor(
|
@@ -826,7 +854,6 @@ class V8_EXPORT ObjectTemplate : public Template {
|
|
826
854
|
AccessorNameSetterCallback setter = nullptr,
|
827
855
|
Local<Value> data = Local<Value>(), AccessControl settings = DEFAULT,
|
828
856
|
PropertyAttribute attribute = None,
|
829
|
-
Local<AccessorSignature> signature = Local<AccessorSignature>(),
|
830
857
|
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
|
831
858
|
SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
|
832
859
|
|
@@ -11,10 +11,8 @@
|
|
11
11
|
|
12
12
|
#include <atomic>
|
13
13
|
#include <memory>
|
14
|
-
#include <string>
|
15
14
|
#include <type_traits>
|
16
15
|
#include <utility>
|
17
|
-
#include <vector>
|
18
16
|
|
19
17
|
#include "v8-internal.h" // NOLINT(build/include_directory)
|
20
18
|
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
@@ -26,28 +24,24 @@ namespace v8 {
|
|
26
24
|
class Value;
|
27
25
|
|
28
26
|
namespace internal {
|
27
|
+
|
29
28
|
class BasicTracedReferenceExtractor;
|
30
|
-
} // namespace internal
|
31
29
|
|
32
|
-
|
30
|
+
enum class GlobalHandleStoreMode {
|
31
|
+
kInitializingStore,
|
32
|
+
kAssigningStore,
|
33
|
+
};
|
34
|
+
|
33
35
|
V8_EXPORT internal::Address* GlobalizeTracedReference(
|
34
36
|
internal::Isolate* isolate, internal::Address* handle,
|
35
|
-
internal::Address* slot,
|
36
|
-
V8_EXPORT void
|
37
|
-
|
38
|
-
V8_EXPORT void
|
39
|
-
|
40
|
-
V8_EXPORT void
|
41
|
-
V8_EXPORT void SetFinalizationCallbackTraced(
|
42
|
-
internal::Address* location, void* parameter,
|
43
|
-
WeakCallbackInfo<void>::Callback callback);
|
44
|
-
} // namespace api_internal
|
37
|
+
internal::Address* slot, GlobalHandleStoreMode store_mode);
|
38
|
+
V8_EXPORT void MoveTracedReference(internal::Address** from,
|
39
|
+
internal::Address** to);
|
40
|
+
V8_EXPORT void CopyTracedReference(const internal::Address* const* from,
|
41
|
+
internal::Address** to);
|
42
|
+
V8_EXPORT void DisposeTracedReference(internal::Address* global_handle);
|
45
43
|
|
46
|
-
|
47
|
-
* Deprecated. Use |TracedReference<T>| instead.
|
48
|
-
*/
|
49
|
-
template <typename T>
|
50
|
-
struct TracedGlobalTrait {};
|
44
|
+
} // namespace internal
|
51
45
|
|
52
46
|
class TracedReferenceBase {
|
53
47
|
public:
|
@@ -132,9 +126,8 @@ class TracedReferenceBase {
|
|
132
126
|
* |v8::EmbedderRootsHandler::IsRoot()| whether the handle should
|
133
127
|
* be treated as root or not.
|
134
128
|
*
|
135
|
-
* Note that the base class cannot be instantiated itself
|
136
|
-
*
|
137
|
-
* - TracedReference
|
129
|
+
* Note that the base class cannot be instantiated itself, use |TracedReference|
|
130
|
+
* instead.
|
138
131
|
*/
|
139
132
|
template <typename T>
|
140
133
|
class BasicTracedReference : public TracedReferenceBase {
|
@@ -164,23 +157,20 @@ class BasicTracedReference : public TracedReferenceBase {
|
|
164
157
|
}
|
165
158
|
|
166
159
|
private:
|
167
|
-
enum DestructionMode { kWithDestructor, kWithoutDestructor };
|
168
|
-
|
169
160
|
/**
|
170
161
|
* An empty BasicTracedReference without storage cell.
|
171
162
|
*/
|
172
163
|
BasicTracedReference() = default;
|
173
164
|
|
174
|
-
V8_INLINE static internal::Address* New(
|
175
|
-
|
165
|
+
V8_INLINE static internal::Address* New(
|
166
|
+
Isolate* isolate, T* that, void* slot,
|
167
|
+
internal::GlobalHandleStoreMode store_mode);
|
176
168
|
|
177
169
|
friend class EmbedderHeapTracer;
|
178
170
|
template <typename F>
|
179
171
|
friend class Local;
|
180
172
|
friend class Object;
|
181
173
|
template <typename F>
|
182
|
-
friend class TracedGlobal;
|
183
|
-
template <typename F>
|
184
174
|
friend class TracedReference;
|
185
175
|
template <typename F>
|
186
176
|
friend class BasicTracedReference;
|
@@ -188,127 +178,6 @@ class BasicTracedReference : public TracedReferenceBase {
|
|
188
178
|
friend class ReturnValue;
|
189
179
|
};
|
190
180
|
|
191
|
-
/**
|
192
|
-
* A traced handle with destructor that clears the handle. For more details see
|
193
|
-
* BasicTracedReference.
|
194
|
-
*/
|
195
|
-
template <typename T>
|
196
|
-
class TracedGlobal : public BasicTracedReference<T> {
|
197
|
-
public:
|
198
|
-
using BasicTracedReference<T>::Reset;
|
199
|
-
|
200
|
-
/**
|
201
|
-
* Destructor resetting the handle.Is
|
202
|
-
*/
|
203
|
-
~TracedGlobal() { this->Reset(); }
|
204
|
-
|
205
|
-
/**
|
206
|
-
* An empty TracedGlobal without storage cell.
|
207
|
-
*/
|
208
|
-
TracedGlobal() : BasicTracedReference<T>() {}
|
209
|
-
|
210
|
-
/**
|
211
|
-
* Construct a TracedGlobal from a Local.
|
212
|
-
*
|
213
|
-
* When the Local is non-empty, a new storage cell is created
|
214
|
-
* pointing to the same object.
|
215
|
-
*/
|
216
|
-
template <class S>
|
217
|
-
TracedGlobal(Isolate* isolate, Local<S> that) : BasicTracedReference<T>() {
|
218
|
-
this->val_ = this->New(isolate, that.val_, &this->val_,
|
219
|
-
BasicTracedReference<T>::kWithDestructor);
|
220
|
-
static_assert(std::is_base_of<T, S>::value, "type check");
|
221
|
-
}
|
222
|
-
|
223
|
-
/**
|
224
|
-
* Move constructor initializing TracedGlobal from an existing one.
|
225
|
-
*/
|
226
|
-
V8_INLINE TracedGlobal(TracedGlobal&& other) {
|
227
|
-
// Forward to operator=.
|
228
|
-
*this = std::move(other);
|
229
|
-
}
|
230
|
-
|
231
|
-
/**
|
232
|
-
* Move constructor initializing TracedGlobal from an existing one.
|
233
|
-
*/
|
234
|
-
template <typename S>
|
235
|
-
V8_INLINE TracedGlobal(TracedGlobal<S>&& other) {
|
236
|
-
// Forward to operator=.
|
237
|
-
*this = std::move(other);
|
238
|
-
}
|
239
|
-
|
240
|
-
/**
|
241
|
-
* Copy constructor initializing TracedGlobal from an existing one.
|
242
|
-
*/
|
243
|
-
V8_INLINE TracedGlobal(const TracedGlobal& other) {
|
244
|
-
// Forward to operator=;
|
245
|
-
*this = other;
|
246
|
-
}
|
247
|
-
|
248
|
-
/**
|
249
|
-
* Copy constructor initializing TracedGlobal from an existing one.
|
250
|
-
*/
|
251
|
-
template <typename S>
|
252
|
-
V8_INLINE TracedGlobal(const TracedGlobal<S>& other) {
|
253
|
-
// Forward to operator=;
|
254
|
-
*this = other;
|
255
|
-
}
|
256
|
-
|
257
|
-
/**
|
258
|
-
* Move assignment operator initializing TracedGlobal from an existing one.
|
259
|
-
*/
|
260
|
-
V8_INLINE TracedGlobal& operator=(TracedGlobal&& rhs);
|
261
|
-
|
262
|
-
/**
|
263
|
-
* Move assignment operator initializing TracedGlobal from an existing one.
|
264
|
-
*/
|
265
|
-
template <class S>
|
266
|
-
V8_INLINE TracedGlobal& operator=(TracedGlobal<S>&& rhs);
|
267
|
-
|
268
|
-
/**
|
269
|
-
* Copy assignment operator initializing TracedGlobal from an existing one.
|
270
|
-
*
|
271
|
-
* Note: Prohibited when |other| has a finalization callback set through
|
272
|
-
* |SetFinalizationCallback|.
|
273
|
-
*/
|
274
|
-
V8_INLINE TracedGlobal& operator=(const TracedGlobal& rhs);
|
275
|
-
|
276
|
-
/**
|
277
|
-
* Copy assignment operator initializing TracedGlobal from an existing one.
|
278
|
-
*
|
279
|
-
* Note: Prohibited when |other| has a finalization callback set through
|
280
|
-
* |SetFinalizationCallback|.
|
281
|
-
*/
|
282
|
-
template <class S>
|
283
|
-
V8_INLINE TracedGlobal& operator=(const TracedGlobal<S>& rhs);
|
284
|
-
|
285
|
-
/**
|
286
|
-
* If non-empty, destroy the underlying storage cell and create a new one with
|
287
|
-
* the contents of other if other is non empty
|
288
|
-
*/
|
289
|
-
template <class S>
|
290
|
-
V8_INLINE void Reset(Isolate* isolate, const Local<S>& other);
|
291
|
-
|
292
|
-
template <class S>
|
293
|
-
V8_INLINE TracedGlobal<S>& As() const {
|
294
|
-
return reinterpret_cast<TracedGlobal<S>&>(
|
295
|
-
const_cast<TracedGlobal<T>&>(*this));
|
296
|
-
}
|
297
|
-
|
298
|
-
/**
|
299
|
-
* Adds a finalization callback to the handle. The type of this callback is
|
300
|
-
* similar to WeakCallbackType::kInternalFields, i.e., it will pass the
|
301
|
-
* parameter and the first two internal fields of the object.
|
302
|
-
*
|
303
|
-
* The callback is then supposed to reset the handle in the callback. No
|
304
|
-
* further V8 API may be called in this callback. In case additional work
|
305
|
-
* involving V8 needs to be done, a second callback can be scheduled using
|
306
|
-
* WeakCallbackInfo<void>::SetSecondPassCallback.
|
307
|
-
*/
|
308
|
-
V8_INLINE void SetFinalizationCallback(
|
309
|
-
void* parameter, WeakCallbackInfo<void>::Callback callback);
|
310
|
-
};
|
311
|
-
|
312
181
|
/**
|
313
182
|
* A traced handle without destructor that clears the handle. The embedder needs
|
314
183
|
* to ensure that the handle is not accessed once the V8 object has been
|
@@ -339,7 +208,7 @@ class TracedReference : public BasicTracedReference<T> {
|
|
339
208
|
template <class S>
|
340
209
|
TracedReference(Isolate* isolate, Local<S> that) : BasicTracedReference<T>() {
|
341
210
|
this->val_ = this->New(isolate, that.val_, &this->val_,
|
342
|
-
|
211
|
+
internal::GlobalHandleStoreMode::kInitializingStore);
|
343
212
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
344
213
|
}
|
345
214
|
|
@@ -347,7 +216,7 @@ class TracedReference : public BasicTracedReference<T> {
|
|
347
216
|
* Move constructor initializing TracedReference from an
|
348
217
|
* existing one.
|
349
218
|
*/
|
350
|
-
V8_INLINE TracedReference(TracedReference&& other) {
|
219
|
+
V8_INLINE TracedReference(TracedReference&& other) noexcept {
|
351
220
|
// Forward to operator=.
|
352
221
|
*this = std::move(other);
|
353
222
|
}
|
@@ -357,7 +226,7 @@ class TracedReference : public BasicTracedReference<T> {
|
|
357
226
|
* existing one.
|
358
227
|
*/
|
359
228
|
template <typename S>
|
360
|
-
V8_INLINE TracedReference(TracedReference<S>&& other) {
|
229
|
+
V8_INLINE TracedReference(TracedReference<S>&& other) noexcept {
|
361
230
|
// Forward to operator=.
|
362
231
|
*this = std::move(other);
|
363
232
|
}
|
@@ -382,23 +251,23 @@ class TracedReference : public BasicTracedReference<T> {
|
|
382
251
|
}
|
383
252
|
|
384
253
|
/**
|
385
|
-
* Move assignment operator initializing
|
254
|
+
* Move assignment operator initializing TracedReference from an existing one.
|
386
255
|
*/
|
387
|
-
V8_INLINE TracedReference& operator=(TracedReference&& rhs);
|
256
|
+
V8_INLINE TracedReference& operator=(TracedReference&& rhs) noexcept;
|
388
257
|
|
389
258
|
/**
|
390
|
-
* Move assignment operator initializing
|
259
|
+
* Move assignment operator initializing TracedReference from an existing one.
|
391
260
|
*/
|
392
261
|
template <class S>
|
393
|
-
V8_INLINE TracedReference& operator=(TracedReference<S>&& rhs);
|
262
|
+
V8_INLINE TracedReference& operator=(TracedReference<S>&& rhs) noexcept;
|
394
263
|
|
395
264
|
/**
|
396
|
-
* Copy assignment operator initializing
|
265
|
+
* Copy assignment operator initializing TracedReference from an existing one.
|
397
266
|
*/
|
398
267
|
V8_INLINE TracedReference& operator=(const TracedReference& rhs);
|
399
268
|
|
400
269
|
/**
|
401
|
-
* Copy assignment operator initializing
|
270
|
+
* Copy assignment operator initializing TracedReference from an existing one.
|
402
271
|
*/
|
403
272
|
template <class S>
|
404
273
|
V8_INLINE TracedReference& operator=(const TracedReference<S>& rhs);
|
@@ -420,18 +289,18 @@ class TracedReference : public BasicTracedReference<T> {
|
|
420
289
|
// --- Implementation ---
|
421
290
|
template <class T>
|
422
291
|
internal::Address* BasicTracedReference<T>::New(
|
423
|
-
Isolate* isolate, T* that, void* slot,
|
292
|
+
Isolate* isolate, T* that, void* slot,
|
293
|
+
internal::GlobalHandleStoreMode store_mode) {
|
424
294
|
if (that == nullptr) return nullptr;
|
425
295
|
internal::Address* p = reinterpret_cast<internal::Address*>(that);
|
426
|
-
return
|
296
|
+
return internal::GlobalizeTracedReference(
|
427
297
|
reinterpret_cast<internal::Isolate*>(isolate), p,
|
428
|
-
reinterpret_cast<internal::Address*>(slot),
|
429
|
-
destruction_mode == kWithDestructor);
|
298
|
+
reinterpret_cast<internal::Address*>(slot), store_mode);
|
430
299
|
}
|
431
300
|
|
432
301
|
void TracedReferenceBase::Reset() {
|
433
302
|
if (IsEmpty()) return;
|
434
|
-
|
303
|
+
internal::DisposeTracedReference(reinterpret_cast<internal::Address*>(val_));
|
435
304
|
SetSlotThreadSafe(nullptr);
|
436
305
|
}
|
437
306
|
|
@@ -477,55 +346,6 @@ V8_INLINE bool operator!=(const v8::Local<U>& lhs,
|
|
477
346
|
return !(rhs == lhs);
|
478
347
|
}
|
479
348
|
|
480
|
-
template <class T>
|
481
|
-
template <class S>
|
482
|
-
void TracedGlobal<T>::Reset(Isolate* isolate, const Local<S>& other) {
|
483
|
-
static_assert(std::is_base_of<T, S>::value, "type check");
|
484
|
-
Reset();
|
485
|
-
if (other.IsEmpty()) return;
|
486
|
-
this->val_ = this->New(isolate, other.val_, &this->val_,
|
487
|
-
BasicTracedReference<T>::kWithDestructor);
|
488
|
-
}
|
489
|
-
|
490
|
-
template <class T>
|
491
|
-
template <class S>
|
492
|
-
TracedGlobal<T>& TracedGlobal<T>::operator=(TracedGlobal<S>&& rhs) {
|
493
|
-
static_assert(std::is_base_of<T, S>::value, "type check");
|
494
|
-
*this = std::move(rhs.template As<T>());
|
495
|
-
return *this;
|
496
|
-
}
|
497
|
-
|
498
|
-
template <class T>
|
499
|
-
template <class S>
|
500
|
-
TracedGlobal<T>& TracedGlobal<T>::operator=(const TracedGlobal<S>& rhs) {
|
501
|
-
static_assert(std::is_base_of<T, S>::value, "type check");
|
502
|
-
*this = rhs.template As<T>();
|
503
|
-
return *this;
|
504
|
-
}
|
505
|
-
|
506
|
-
template <class T>
|
507
|
-
TracedGlobal<T>& TracedGlobal<T>::operator=(TracedGlobal&& rhs) {
|
508
|
-
if (this != &rhs) {
|
509
|
-
api_internal::MoveTracedGlobalReference(
|
510
|
-
reinterpret_cast<internal::Address**>(&rhs.val_),
|
511
|
-
reinterpret_cast<internal::Address**>(&this->val_));
|
512
|
-
}
|
513
|
-
return *this;
|
514
|
-
}
|
515
|
-
|
516
|
-
template <class T>
|
517
|
-
TracedGlobal<T>& TracedGlobal<T>::operator=(const TracedGlobal& rhs) {
|
518
|
-
if (this != &rhs) {
|
519
|
-
this->Reset();
|
520
|
-
if (rhs.val_ != nullptr) {
|
521
|
-
api_internal::CopyTracedGlobalReference(
|
522
|
-
reinterpret_cast<const internal::Address* const*>(&rhs.val_),
|
523
|
-
reinterpret_cast<internal::Address**>(&this->val_));
|
524
|
-
}
|
525
|
-
}
|
526
|
-
return *this;
|
527
|
-
}
|
528
|
-
|
529
349
|
template <class T>
|
530
350
|
template <class S>
|
531
351
|
void TracedReference<T>::Reset(Isolate* isolate, const Local<S>& other) {
|
@@ -534,12 +354,13 @@ void TracedReference<T>::Reset(Isolate* isolate, const Local<S>& other) {
|
|
534
354
|
if (other.IsEmpty()) return;
|
535
355
|
this->SetSlotThreadSafe(
|
536
356
|
this->New(isolate, other.val_, &this->val_,
|
537
|
-
|
357
|
+
internal::GlobalHandleStoreMode::kAssigningStore));
|
538
358
|
}
|
539
359
|
|
540
360
|
template <class T>
|
541
361
|
template <class S>
|
542
|
-
TracedReference<T>& TracedReference<T>::operator=(
|
362
|
+
TracedReference<T>& TracedReference<T>::operator=(
|
363
|
+
TracedReference<S>&& rhs) noexcept {
|
543
364
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
544
365
|
*this = std::move(rhs.template As<T>());
|
545
366
|
return *this;
|
@@ -555,9 +376,10 @@ TracedReference<T>& TracedReference<T>::operator=(
|
|
555
376
|
}
|
556
377
|
|
557
378
|
template <class T>
|
558
|
-
TracedReference<T>& TracedReference<T>::operator=(
|
379
|
+
TracedReference<T>& TracedReference<T>::operator=(
|
380
|
+
TracedReference&& rhs) noexcept {
|
559
381
|
if (this != &rhs) {
|
560
|
-
|
382
|
+
internal::MoveTracedReference(
|
561
383
|
reinterpret_cast<internal::Address**>(&rhs.val_),
|
562
384
|
reinterpret_cast<internal::Address**>(&this->val_));
|
563
385
|
}
|
@@ -569,7 +391,7 @@ TracedReference<T>& TracedReference<T>::operator=(const TracedReference& rhs) {
|
|
569
391
|
if (this != &rhs) {
|
570
392
|
this->Reset();
|
571
393
|
if (rhs.val_ != nullptr) {
|
572
|
-
|
394
|
+
internal::CopyTracedReference(
|
573
395
|
reinterpret_cast<const internal::Address* const*>(&rhs.val_),
|
574
396
|
reinterpret_cast<internal::Address**>(&this->val_));
|
575
397
|
}
|
@@ -593,13 +415,6 @@ uint16_t TracedReferenceBase::WrapperClassId() const {
|
|
593
415
|
return *reinterpret_cast<uint16_t*>(addr);
|
594
416
|
}
|
595
417
|
|
596
|
-
template <class T>
|
597
|
-
void TracedGlobal<T>::SetFinalizationCallback(
|
598
|
-
void* parameter, typename WeakCallbackInfo<void>::Callback callback) {
|
599
|
-
api_internal::SetFinalizationCallbackTraced(
|
600
|
-
reinterpret_cast<internal::Address*>(this->val_), parameter, callback);
|
601
|
-
}
|
602
|
-
|
603
418
|
} // namespace v8
|
604
419
|
|
605
420
|
#endif // INCLUDE_V8_TRACED_HANDLE_H_
|