libv8-node 18.13.0.1-x86_64-darwin → 20.2.0.0-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/include/cppgc/common.h +0 -1
- data/vendor/v8/include/cppgc/cross-thread-persistent.h +11 -10
- data/vendor/v8/include/cppgc/heap-consistency.h +46 -3
- data/vendor/v8/include/cppgc/heap-handle.h +48 -0
- data/vendor/v8/include/cppgc/heap-statistics.h +2 -2
- data/vendor/v8/include/cppgc/heap.h +3 -7
- data/vendor/v8/include/cppgc/internal/api-constants.h +14 -1
- data/vendor/v8/include/cppgc/internal/base-page-handle.h +45 -0
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +40 -8
- data/vendor/v8/include/cppgc/internal/caged-heap.h +61 -0
- data/vendor/v8/include/cppgc/internal/gc-info.h +35 -34
- data/vendor/v8/include/cppgc/internal/member-storage.h +248 -0
- data/vendor/v8/include/cppgc/internal/name-trait.h +21 -6
- data/vendor/v8/include/cppgc/internal/persistent-node.h +11 -13
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +65 -8
- data/vendor/v8/include/cppgc/internal/write-barrier.h +153 -101
- data/vendor/v8/include/cppgc/liveness-broker.h +8 -7
- data/vendor/v8/include/cppgc/macros.h +10 -1
- data/vendor/v8/include/cppgc/member.h +424 -111
- data/vendor/v8/include/cppgc/name-provider.h +4 -4
- data/vendor/v8/include/cppgc/persistent.h +27 -24
- data/vendor/v8/include/cppgc/platform.h +7 -5
- data/vendor/v8/include/cppgc/sentinel-pointer.h +1 -1
- data/vendor/v8/include/cppgc/trace-trait.h +4 -0
- data/vendor/v8/include/cppgc/type-traits.h +13 -3
- data/vendor/v8/include/cppgc/visitor.h +104 -57
- data/vendor/v8/include/libplatform/v8-tracing.h +2 -2
- data/vendor/v8/include/v8-array-buffer.h +59 -0
- data/vendor/v8/include/v8-callbacks.h +32 -5
- data/vendor/v8/include/v8-context.h +63 -11
- data/vendor/v8/include/v8-cppgc.h +22 -0
- data/vendor/v8/include/v8-data.h +1 -1
- data/vendor/v8/include/v8-date.h +5 -0
- data/vendor/v8/include/v8-embedder-heap.h +0 -164
- data/vendor/v8/include/v8-exception.h +1 -1
- data/vendor/v8/include/v8-fast-api-calls.h +49 -31
- data/vendor/v8/include/v8-function-callback.h +69 -42
- data/vendor/v8/include/v8-function.h +9 -0
- data/vendor/v8/include/v8-initialization.h +23 -49
- data/vendor/v8/include/v8-inspector.h +32 -11
- data/vendor/v8/include/v8-internal.h +480 -183
- data/vendor/v8/include/v8-isolate.h +52 -77
- data/vendor/v8/include/v8-local-handle.h +86 -53
- data/vendor/v8/include/v8-locker.h +0 -11
- data/vendor/v8/include/v8-maybe.h +24 -1
- data/vendor/v8/include/v8-message.h +2 -4
- data/vendor/v8/include/v8-metrics.h +48 -40
- data/vendor/v8/include/v8-microtask-queue.h +6 -1
- data/vendor/v8/include/v8-object.h +29 -18
- data/vendor/v8/include/v8-persistent-handle.h +25 -18
- data/vendor/v8/include/v8-platform.h +133 -35
- data/vendor/v8/include/v8-primitive.h +27 -20
- data/vendor/v8/include/v8-profiler.h +133 -53
- data/vendor/v8/include/v8-regexp.h +2 -1
- data/vendor/v8/include/v8-script.h +91 -7
- data/vendor/v8/include/v8-snapshot.h +4 -8
- data/vendor/v8/include/v8-template.h +16 -77
- data/vendor/v8/include/v8-traced-handle.h +22 -28
- data/vendor/v8/include/v8-unwinder-state.h +4 -4
- data/vendor/v8/include/v8-util.h +11 -7
- data/vendor/v8/include/v8-value-serializer.h +46 -23
- data/vendor/v8/include/v8-value.h +31 -4
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8-wasm.h +7 -63
- data/vendor/v8/include/v8-weak-callback-info.h +0 -7
- data/vendor/v8/include/v8config.h +353 -15
- data/vendor/v8/x86_64-darwin/libv8/obj/libv8_monolith.a +0 -0
- metadata +5 -1
@@ -11,6 +11,7 @@
|
|
11
11
|
#include <memory>
|
12
12
|
#include <vector>
|
13
13
|
|
14
|
+
#include "v8-callbacks.h" // NOLINT(build/include_directory)
|
14
15
|
#include "v8-data.h" // NOLINT(build/include_directory)
|
15
16
|
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
16
17
|
#include "v8-maybe.h" // NOLINT(build/include_directory)
|
@@ -20,6 +21,7 @@
|
|
20
21
|
namespace v8 {
|
21
22
|
|
22
23
|
class Function;
|
24
|
+
class Message;
|
23
25
|
class Object;
|
24
26
|
class PrimitiveArray;
|
25
27
|
class Script;
|
@@ -47,8 +49,6 @@ class V8_EXPORT ScriptOrModule {
|
|
47
49
|
* The options that were passed by the embedder as HostDefinedOptions to
|
48
50
|
* the ScriptOrigin.
|
49
51
|
*/
|
50
|
-
V8_DEPRECATED("Use HostDefinedOptions")
|
51
|
-
Local<PrimitiveArray> GetHostDefinedOptions();
|
52
52
|
Local<Data> HostDefinedOptions();
|
53
53
|
};
|
54
54
|
|
@@ -78,7 +78,13 @@ class V8_EXPORT UnboundScript {
|
|
78
78
|
* Returns zero based line number of the code_pos location in the script.
|
79
79
|
* -1 will be returned if no information available.
|
80
80
|
*/
|
81
|
-
int GetLineNumber(int code_pos);
|
81
|
+
int GetLineNumber(int code_pos = 0);
|
82
|
+
|
83
|
+
/**
|
84
|
+
* Returns zero based column number of the code_pos location in the script.
|
85
|
+
* -1 will be returned if no information available.
|
86
|
+
*/
|
87
|
+
int GetColumnNumber(int code_pos = 0);
|
82
88
|
|
83
89
|
static const int kNoScriptId = 0;
|
84
90
|
};
|
@@ -87,7 +93,15 @@ class V8_EXPORT UnboundScript {
|
|
87
93
|
* A compiled JavaScript module, not yet tied to a Context.
|
88
94
|
*/
|
89
95
|
class V8_EXPORT UnboundModuleScript : public Data {
|
90
|
-
|
96
|
+
public:
|
97
|
+
/**
|
98
|
+
* Data read from magic sourceURL comments.
|
99
|
+
*/
|
100
|
+
Local<Value> GetSourceURL();
|
101
|
+
/**
|
102
|
+
* Data read from magic sourceMappingURL comments.
|
103
|
+
*/
|
104
|
+
Local<Value> GetSourceMappingURL();
|
91
105
|
};
|
92
106
|
|
93
107
|
/**
|
@@ -286,6 +300,16 @@ class V8_EXPORT Module : public Data {
|
|
286
300
|
V8_WARN_UNUSED_RESULT Maybe<bool> SetSyntheticModuleExport(
|
287
301
|
Isolate* isolate, Local<String> export_name, Local<Value> export_value);
|
288
302
|
|
303
|
+
/**
|
304
|
+
* Search the modules requested directly or indirectly by the module for
|
305
|
+
* any top-level await that has not yet resolved. If there is any, the
|
306
|
+
* returned vector contains a tuple of the unresolved module and a message
|
307
|
+
* with the pending top-level await.
|
308
|
+
* An embedder may call this before exiting to improve error messages.
|
309
|
+
*/
|
310
|
+
std::vector<std::tuple<Local<Module>, Local<Message>>>
|
311
|
+
GetStalledTopLevelAwaitMessage(Isolate* isolate);
|
312
|
+
|
289
313
|
V8_INLINE static Module* Cast(Data* data);
|
290
314
|
|
291
315
|
private:
|
@@ -324,6 +348,12 @@ class V8_EXPORT Script {
|
|
324
348
|
* ScriptOrigin. This can be either a v8::String or v8::Undefined.
|
325
349
|
*/
|
326
350
|
Local<Value> GetResourceName();
|
351
|
+
|
352
|
+
/**
|
353
|
+
* If the script was compiled, returns the positions of lazy functions which
|
354
|
+
* were eventually compiled and executed.
|
355
|
+
*/
|
356
|
+
std::vector<int> GetProducedCompileHints() const;
|
327
357
|
};
|
328
358
|
|
329
359
|
enum class ScriptType { kClassic, kModule };
|
@@ -384,6 +414,8 @@ class V8_EXPORT ScriptCompiler {
|
|
384
414
|
V8_INLINE explicit Source(
|
385
415
|
Local<String> source_string, CachedData* cached_data = nullptr,
|
386
416
|
ConsumeCodeCacheTask* consume_cache_task = nullptr);
|
417
|
+
V8_INLINE Source(Local<String> source_string, const ScriptOrigin& origin,
|
418
|
+
CompileHintCallback callback, void* callback_data);
|
387
419
|
V8_INLINE ~Source() = default;
|
388
420
|
|
389
421
|
// Ownership of the CachedData or its buffers is *not* transferred to the
|
@@ -411,6 +443,10 @@ class V8_EXPORT ScriptCompiler {
|
|
411
443
|
// set when calling a compile method.
|
412
444
|
std::unique_ptr<CachedData> cached_data;
|
413
445
|
std::unique_ptr<ConsumeCodeCacheTask> consume_cache_task;
|
446
|
+
|
447
|
+
// For requesting compile hints from the embedder.
|
448
|
+
CompileHintCallback compile_hint_callback = nullptr;
|
449
|
+
void* compile_hint_callback_data = nullptr;
|
414
450
|
};
|
415
451
|
|
416
452
|
/**
|
@@ -489,7 +525,7 @@ class V8_EXPORT ScriptCompiler {
|
|
489
525
|
/**
|
490
526
|
* A task which the embedder must run on a background thread to
|
491
527
|
* consume a V8 code cache. Returned by
|
492
|
-
* ScriptCompiler::
|
528
|
+
* ScriptCompiler::StartConsumingCodeCache.
|
493
529
|
*/
|
494
530
|
class V8_EXPORT ConsumeCodeCacheTask final {
|
495
531
|
public:
|
@@ -497,6 +533,36 @@ class V8_EXPORT ScriptCompiler {
|
|
497
533
|
|
498
534
|
void Run();
|
499
535
|
|
536
|
+
/**
|
537
|
+
* Provides the source text string and origin information to the consumption
|
538
|
+
* task. May be called before, during, or after Run(). This step checks
|
539
|
+
* whether the script matches an existing script in the Isolate's
|
540
|
+
* compilation cache. To check whether such a script was found, call
|
541
|
+
* ShouldMergeWithExistingScript.
|
542
|
+
*
|
543
|
+
* The Isolate provided must be the same one used during
|
544
|
+
* StartConsumingCodeCache and must be currently entered on the thread that
|
545
|
+
* calls this function. The source text and origin provided in this step
|
546
|
+
* must precisely match those used later in the ScriptCompiler::Source that
|
547
|
+
* will contain this ConsumeCodeCacheTask.
|
548
|
+
*/
|
549
|
+
void SourceTextAvailable(Isolate* isolate, Local<String> source_text,
|
550
|
+
const ScriptOrigin& origin);
|
551
|
+
|
552
|
+
/**
|
553
|
+
* Returns whether the embedder should call MergeWithExistingScript. This
|
554
|
+
* function may be called from any thread, any number of times, but its
|
555
|
+
* return value is only meaningful after SourceTextAvailable has completed.
|
556
|
+
*/
|
557
|
+
bool ShouldMergeWithExistingScript() const;
|
558
|
+
|
559
|
+
/**
|
560
|
+
* Merges newly deserialized data into an existing script which was found
|
561
|
+
* during SourceTextAvailable. May be called only after Run() has completed.
|
562
|
+
* Can execute on any thread, like Run().
|
563
|
+
*/
|
564
|
+
void MergeWithExistingScript();
|
565
|
+
|
500
566
|
private:
|
501
567
|
friend class ScriptCompiler;
|
502
568
|
|
@@ -509,7 +575,9 @@ class V8_EXPORT ScriptCompiler {
|
|
509
575
|
enum CompileOptions {
|
510
576
|
kNoCompileOptions = 0,
|
511
577
|
kConsumeCodeCache,
|
512
|
-
kEagerCompile
|
578
|
+
kEagerCompile,
|
579
|
+
kProduceCompileHints,
|
580
|
+
kConsumeCompileHints
|
513
581
|
};
|
514
582
|
|
515
583
|
/**
|
@@ -581,7 +649,8 @@ class V8_EXPORT ScriptCompiler {
|
|
581
649
|
*/
|
582
650
|
static ScriptStreamingTask* StartStreaming(
|
583
651
|
Isolate* isolate, StreamedSource* source,
|
584
|
-
ScriptType type = ScriptType::kClassic
|
652
|
+
ScriptType type = ScriptType::kClassic,
|
653
|
+
CompileOptions options = kNoCompileOptions);
|
585
654
|
|
586
655
|
static ConsumeCodeCacheTask* StartConsumingCodeCache(
|
587
656
|
Isolate* isolate, std::unique_ptr<CachedData> source);
|
@@ -650,6 +719,7 @@ class V8_EXPORT ScriptCompiler {
|
|
650
719
|
* It is possible to specify multiple context extensions (obj in the above
|
651
720
|
* example).
|
652
721
|
*/
|
722
|
+
V8_DEPRECATED("Use CompileFunction")
|
653
723
|
static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunctionInContext(
|
654
724
|
Local<Context> context, Source* source, size_t arguments_count,
|
655
725
|
Local<String> arguments[], size_t context_extension_count,
|
@@ -657,6 +727,7 @@ class V8_EXPORT ScriptCompiler {
|
|
657
727
|
CompileOptions options = kNoCompileOptions,
|
658
728
|
NoCacheReason no_cache_reason = kNoCacheNoReason,
|
659
729
|
Local<ScriptOrModule>* script_or_module_out = nullptr);
|
730
|
+
|
660
731
|
static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunction(
|
661
732
|
Local<Context> context, Source* source, size_t arguments_count = 0,
|
662
733
|
Local<String> arguments[] = nullptr, size_t context_extension_count = 0,
|
@@ -719,6 +790,19 @@ ScriptCompiler::Source::Source(Local<String> string, CachedData* data,
|
|
719
790
|
cached_data(data),
|
720
791
|
consume_cache_task(consume_cache_task) {}
|
721
792
|
|
793
|
+
ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin,
|
794
|
+
CompileHintCallback callback,
|
795
|
+
void* callback_data)
|
796
|
+
: source_string(string),
|
797
|
+
resource_name(origin.ResourceName()),
|
798
|
+
resource_line_offset(origin.LineOffset()),
|
799
|
+
resource_column_offset(origin.ColumnOffset()),
|
800
|
+
resource_options(origin.Options()),
|
801
|
+
source_map_url(origin.SourceMapUrl()),
|
802
|
+
host_defined_options(origin.GetHostDefinedOptions()),
|
803
|
+
compile_hint_callback(callback),
|
804
|
+
compile_hint_callback_data(callback_data) {}
|
805
|
+
|
722
806
|
const ScriptCompiler::CachedData* ScriptCompiler::Source::GetCachedData()
|
723
807
|
const {
|
724
808
|
return cached_data.get();
|
@@ -91,7 +91,7 @@ class V8_EXPORT SnapshotCreator {
|
|
91
91
|
*/
|
92
92
|
SnapshotCreator(Isolate* isolate,
|
93
93
|
const intptr_t* external_references = nullptr,
|
94
|
-
StartupData* existing_blob = nullptr);
|
94
|
+
const StartupData* existing_blob = nullptr);
|
95
95
|
|
96
96
|
/**
|
97
97
|
* Create and enter an isolate, and set it up for serialization.
|
@@ -102,7 +102,7 @@ class V8_EXPORT SnapshotCreator {
|
|
102
102
|
* that must be equivalent to CreateParams::external_references.
|
103
103
|
*/
|
104
104
|
SnapshotCreator(const intptr_t* external_references = nullptr,
|
105
|
-
StartupData* existing_blob = nullptr);
|
105
|
+
const StartupData* existing_blob = nullptr);
|
106
106
|
|
107
107
|
/**
|
108
108
|
* Destroy the snapshot creator, and exit and dispose of the Isolate
|
@@ -179,16 +179,12 @@ class V8_EXPORT SnapshotCreator {
|
|
179
179
|
|
180
180
|
template <class T>
|
181
181
|
size_t SnapshotCreator::AddData(Local<Context> context, Local<T> object) {
|
182
|
-
|
183
|
-
internal::Address* p = reinterpret_cast<internal::Address*>(object_ptr);
|
184
|
-
return AddData(context, *p);
|
182
|
+
return AddData(context, internal::ValueHelper::ValueAsAddress(*object));
|
185
183
|
}
|
186
184
|
|
187
185
|
template <class T>
|
188
186
|
size_t SnapshotCreator::AddData(Local<T> object) {
|
189
|
-
|
190
|
-
internal::Address* p = reinterpret_cast<internal::Address*>(object_ptr);
|
191
|
-
return AddData(*p);
|
187
|
+
return AddData(internal::ValueHelper::ValueAsAddress(*object));
|
192
188
|
}
|
193
189
|
|
194
190
|
} // namespace v8
|
@@ -14,7 +14,6 @@
|
|
14
14
|
|
15
15
|
namespace v8 {
|
16
16
|
|
17
|
-
class AccessorSignature;
|
18
17
|
class CFunction;
|
19
18
|
class FunctionTemplate;
|
20
19
|
class ObjectTemplate;
|
@@ -31,7 +30,9 @@ class Signature;
|
|
31
30
|
F(AsyncIteratorPrototype, initial_async_iterator_prototype) \
|
32
31
|
F(ErrorPrototype, initial_error_prototype) \
|
33
32
|
F(IteratorPrototype, initial_iterator_prototype) \
|
34
|
-
F(
|
33
|
+
F(MapIteratorPrototype, initial_map_iterator_prototype) \
|
34
|
+
F(ObjProto_valueOf, object_value_of_function) \
|
35
|
+
F(SetIteratorPrototype, initial_set_iterator_prototype)
|
35
36
|
|
36
37
|
enum Intrinsic {
|
37
38
|
#define V8_DECL_INTRINSIC(name, iname) k##name,
|
@@ -83,28 +84,7 @@ class V8_EXPORT Template : public Data {
|
|
83
84
|
* cross-context access.
|
84
85
|
* \param attribute The attributes of the property for which an accessor
|
85
86
|
* is added.
|
86
|
-
* \param signature The signature describes valid receivers for the accessor
|
87
|
-
* and is used to perform implicit instance checks against them. If the
|
88
|
-
* receiver is incompatible (i.e. is not an instance of the constructor as
|
89
|
-
* defined by FunctionTemplate::HasInstance()), an implicit TypeError is
|
90
|
-
* thrown and no callback is invoked.
|
91
87
|
*/
|
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);
|
108
88
|
void SetNativeDataProperty(
|
109
89
|
Local<String> name, AccessorGetterCallback getter,
|
110
90
|
AccessorSetterCallback setter = nullptr,
|
@@ -151,7 +131,8 @@ class V8_EXPORT Template : public Data {
|
|
151
131
|
* Interceptor for get requests on an object.
|
152
132
|
*
|
153
133
|
* Use `info.GetReturnValue().Set()` to set the return value of the
|
154
|
-
* intercepted get request.
|
134
|
+
* intercepted get request. If the property does not exist the callback should
|
135
|
+
* not set the result and must not produce side effects.
|
155
136
|
*
|
156
137
|
* \param property The name of the property for which the request was
|
157
138
|
* intercepted.
|
@@ -192,9 +173,9 @@ using GenericNamedPropertyGetterCallback =
|
|
192
173
|
* Use `info.GetReturnValue()` to indicate whether the request was intercepted
|
193
174
|
* or not. If the setter successfully intercepts the request, i.e., if the
|
194
175
|
* request should not be further executed, call
|
195
|
-
* `info.GetReturnValue().Set(value)`. If the setter
|
196
|
-
*
|
197
|
-
*
|
176
|
+
* `info.GetReturnValue().Set(value)`. If the setter did not intercept the
|
177
|
+
* request, i.e., if the request should be handled as if no interceptor is
|
178
|
+
* present, do not not call `Set()` and do not produce side effects.
|
198
179
|
*
|
199
180
|
* \param property The name of the property for which the request was
|
200
181
|
* intercepted.
|
@@ -217,7 +198,9 @@ using GenericNamedPropertySetterCallback =
|
|
217
198
|
* defineProperty().
|
218
199
|
*
|
219
200
|
* Use `info.GetReturnValue().Set(value)` to set the property attributes. The
|
220
|
-
* value is an integer encoding a `v8::PropertyAttribute`.
|
201
|
+
* value is an integer encoding a `v8::PropertyAttribute`. If the property does
|
202
|
+
* not exist the callback should not set the result and must not produce side
|
203
|
+
* effects.
|
221
204
|
*
|
222
205
|
* \param property The name of the property for which the request was
|
223
206
|
* intercepted.
|
@@ -242,7 +225,8 @@ using GenericNamedPropertyQueryCallback =
|
|
242
225
|
* or not. If the deleter successfully intercepts the request, i.e., if the
|
243
226
|
* request should not be further executed, call
|
244
227
|
* `info.GetReturnValue().Set(value)` with a boolean `value`. The `value` is
|
245
|
-
* used as the return value of `delete`.
|
228
|
+
* used as the return value of `delete`. If the deleter does not intercept the
|
229
|
+
* request then it should not set the result and must not produce side effects.
|
246
230
|
*
|
247
231
|
* \param property The name of the property for which the request was
|
248
232
|
* intercepted.
|
@@ -274,9 +258,9 @@ using GenericNamedPropertyEnumeratorCallback =
|
|
274
258
|
* Use `info.GetReturnValue()` to indicate whether the request was intercepted
|
275
259
|
* or not. If the definer successfully intercepts the request, i.e., if the
|
276
260
|
* request should not be further executed, call
|
277
|
-
* `info.GetReturnValue().Set(value)`. If the definer
|
278
|
-
*
|
279
|
-
*
|
261
|
+
* `info.GetReturnValue().Set(value)`. If the definer did not intercept the
|
262
|
+
* request, i.e., if the request should be handled as if no interceptor is
|
263
|
+
* present, do not not call `Set()` and do not produce side effects.
|
280
264
|
*
|
281
265
|
* \param property The name of the property for which the request was
|
282
266
|
* intercepted.
|
@@ -821,27 +805,7 @@ class V8_EXPORT ObjectTemplate : public Template {
|
|
821
805
|
* cross-context access.
|
822
806
|
* \param attribute The attributes of the property for which an accessor
|
823
807
|
* is added.
|
824
|
-
* \param signature The signature describes valid receivers for the accessor
|
825
|
-
* and is used to perform implicit instance checks against them. If the
|
826
|
-
* receiver is incompatible (i.e. is not an instance of the constructor as
|
827
|
-
* defined by FunctionTemplate::HasInstance()), an implicit TypeError is
|
828
|
-
* thrown and no callback is invoked.
|
829
808
|
*/
|
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);
|
845
809
|
void SetAccessor(
|
846
810
|
Local<String> name, AccessorGetterCallback getter,
|
847
811
|
AccessorSetterCallback setter = nullptr,
|
@@ -1019,24 +983,6 @@ class V8_EXPORT Signature : public Data {
|
|
1019
983
|
static void CheckCast(Data* that);
|
1020
984
|
};
|
1021
985
|
|
1022
|
-
/**
|
1023
|
-
* An AccessorSignature specifies which receivers are valid parameters
|
1024
|
-
* to an accessor callback.
|
1025
|
-
*/
|
1026
|
-
class V8_EXPORT AccessorSignature : public Data {
|
1027
|
-
public:
|
1028
|
-
static Local<AccessorSignature> New(
|
1029
|
-
Isolate* isolate,
|
1030
|
-
Local<FunctionTemplate> receiver = Local<FunctionTemplate>());
|
1031
|
-
|
1032
|
-
V8_INLINE static AccessorSignature* Cast(Data* data);
|
1033
|
-
|
1034
|
-
private:
|
1035
|
-
AccessorSignature();
|
1036
|
-
|
1037
|
-
static void CheckCast(Data* that);
|
1038
|
-
};
|
1039
|
-
|
1040
986
|
// --- Implementation ---
|
1041
987
|
|
1042
988
|
void Template::Set(Isolate* isolate, const char* name, Local<Data> value,
|
@@ -1067,13 +1013,6 @@ Signature* Signature::Cast(Data* data) {
|
|
1067
1013
|
return reinterpret_cast<Signature*>(data);
|
1068
1014
|
}
|
1069
1015
|
|
1070
|
-
AccessorSignature* AccessorSignature::Cast(Data* data) {
|
1071
|
-
#ifdef V8_ENABLE_CHECKS
|
1072
|
-
CheckCast(data);
|
1073
|
-
#endif
|
1074
|
-
return reinterpret_cast<AccessorSignature*>(data);
|
1075
|
-
}
|
1076
|
-
|
1077
1016
|
} // namespace v8
|
1078
1017
|
|
1079
1018
|
#endif // INCLUDE_V8_TEMPLATE_H_
|
@@ -62,7 +62,8 @@ class TracedReferenceBase {
|
|
62
62
|
*/
|
63
63
|
V8_INLINE v8::Local<v8::Value> Get(v8::Isolate* isolate) const {
|
64
64
|
if (IsEmpty()) return Local<Value>();
|
65
|
-
return Local<Value>::New(isolate,
|
65
|
+
return Local<Value>::New(isolate,
|
66
|
+
internal::ValueHelper::SlotAsValue<Value>(val_));
|
66
67
|
}
|
67
68
|
|
68
69
|
/**
|
@@ -103,10 +104,13 @@ class TracedReferenceBase {
|
|
103
104
|
|
104
105
|
V8_EXPORT void CheckValue() const;
|
105
106
|
|
107
|
+
V8_INLINE internal::Address address() const { return *val_; }
|
108
|
+
|
106
109
|
// val_ points to a GlobalHandles node.
|
107
110
|
internal::Address* val_ = nullptr;
|
108
111
|
|
109
112
|
friend class internal::BasicTracedReferenceExtractor;
|
113
|
+
friend class internal::HandleHelper;
|
110
114
|
template <typename F>
|
111
115
|
friend class Local;
|
112
116
|
template <typename U>
|
@@ -117,11 +121,11 @@ class TracedReferenceBase {
|
|
117
121
|
|
118
122
|
/**
|
119
123
|
* A traced handle with copy and move semantics. The handle is to be used
|
120
|
-
* together
|
121
|
-
*
|
124
|
+
* together as part of GarbageCollected objects (see v8-cppgc.h) or from stack
|
125
|
+
* and specifies edges from C++ objects to JavaScript.
|
122
126
|
*
|
123
127
|
* The exact semantics are:
|
124
|
-
* - Tracing garbage collections
|
128
|
+
* - Tracing garbage collections using CppHeap.
|
125
129
|
* - Non-tracing garbage collections refer to
|
126
130
|
* |v8::EmbedderRootsHandler::IsRoot()| whether the handle should
|
127
131
|
* be treated as root or not.
|
@@ -135,7 +139,12 @@ class BasicTracedReference : public TracedReferenceBase {
|
|
135
139
|
/**
|
136
140
|
* Construct a Local<T> from this handle.
|
137
141
|
*/
|
138
|
-
Local<T> Get(Isolate* isolate) const {
|
142
|
+
Local<T> Get(Isolate* isolate) const {
|
143
|
+
#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING
|
144
|
+
if (val_ == nullptr) return Local<T>();
|
145
|
+
#endif
|
146
|
+
return Local<T>::New(isolate, *this);
|
147
|
+
}
|
139
148
|
|
140
149
|
template <class S>
|
141
150
|
V8_INLINE BasicTracedReference<S>& As() const {
|
@@ -166,7 +175,6 @@ class BasicTracedReference : public TracedReferenceBase {
|
|
166
175
|
Isolate* isolate, T* that, void* slot,
|
167
176
|
internal::GlobalHandleStoreMode store_mode);
|
168
177
|
|
169
|
-
friend class EmbedderHeapTracer;
|
170
178
|
template <typename F>
|
171
179
|
friend class Local;
|
172
180
|
friend class Object;
|
@@ -181,13 +189,7 @@ class BasicTracedReference : public TracedReferenceBase {
|
|
181
189
|
/**
|
182
190
|
* A traced handle without destructor that clears the handle. The embedder needs
|
183
191
|
* to ensure that the handle is not accessed once the V8 object has been
|
184
|
-
* reclaimed.
|
185
|
-
* EmbedderHeapTracer. For more details see BasicTracedReference.
|
186
|
-
*
|
187
|
-
* The reference assumes the embedder has precise knowledge about references at
|
188
|
-
* all times. In case V8 needs to separately handle on-stack references, the
|
189
|
-
* embedder is required to set the stack start through
|
190
|
-
* |EmbedderHeapTracer::SetStackStart|.
|
192
|
+
* reclaimed. For more details see BasicTracedReference.
|
191
193
|
*/
|
192
194
|
template <typename T>
|
193
195
|
class TracedReference : public BasicTracedReference<T> {
|
@@ -207,7 +209,7 @@ class TracedReference : public BasicTracedReference<T> {
|
|
207
209
|
*/
|
208
210
|
template <class S>
|
209
211
|
TracedReference(Isolate* isolate, Local<S> that) : BasicTracedReference<T>() {
|
210
|
-
this->val_ = this->New(isolate, that
|
212
|
+
this->val_ = this->New(isolate, *that, &this->val_,
|
211
213
|
internal::GlobalHandleStoreMode::kInitializingStore);
|
212
214
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
213
215
|
}
|
@@ -291,7 +293,7 @@ template <class T>
|
|
291
293
|
internal::Address* BasicTracedReference<T>::New(
|
292
294
|
Isolate* isolate, T* that, void* slot,
|
293
295
|
internal::GlobalHandleStoreMode store_mode) {
|
294
|
-
if (that ==
|
296
|
+
if (that == internal::ValueHelper::EmptyValue<T>()) return nullptr;
|
295
297
|
internal::Address* p = reinterpret_cast<internal::Address*>(that);
|
296
298
|
return internal::GlobalizeTracedReference(
|
297
299
|
reinterpret_cast<internal::Isolate*>(isolate), p,
|
@@ -306,21 +308,13 @@ void TracedReferenceBase::Reset() {
|
|
306
308
|
|
307
309
|
V8_INLINE bool operator==(const TracedReferenceBase& lhs,
|
308
310
|
const TracedReferenceBase& rhs) {
|
309
|
-
|
310
|
-
v8::internal::Address* b = reinterpret_cast<v8::internal::Address*>(rhs.val_);
|
311
|
-
if (a == nullptr) return b == nullptr;
|
312
|
-
if (b == nullptr) return false;
|
313
|
-
return *a == *b;
|
311
|
+
return internal::HandleHelper::EqualHandles(lhs, rhs);
|
314
312
|
}
|
315
313
|
|
316
314
|
template <typename U>
|
317
315
|
V8_INLINE bool operator==(const TracedReferenceBase& lhs,
|
318
316
|
const v8::Local<U>& rhs) {
|
319
|
-
|
320
|
-
v8::internal::Address* b = reinterpret_cast<v8::internal::Address*>(*rhs);
|
321
|
-
if (a == nullptr) return b == nullptr;
|
322
|
-
if (b == nullptr) return false;
|
323
|
-
return *a == *b;
|
317
|
+
return internal::HandleHelper::EqualHandles(lhs, rhs);
|
324
318
|
}
|
325
319
|
|
326
320
|
template <typename U>
|
@@ -353,7 +347,7 @@ void TracedReference<T>::Reset(Isolate* isolate, const Local<S>& other) {
|
|
353
347
|
this->Reset();
|
354
348
|
if (other.IsEmpty()) return;
|
355
349
|
this->SetSlotThreadSafe(
|
356
|
-
this->New(isolate, other
|
350
|
+
this->New(isolate, *other, &this->val_,
|
357
351
|
internal::GlobalHandleStoreMode::kAssigningStore));
|
358
352
|
}
|
359
353
|
|
@@ -403,7 +397,7 @@ void TracedReferenceBase::SetWrapperClassId(uint16_t class_id) {
|
|
403
397
|
using I = internal::Internals;
|
404
398
|
if (IsEmpty()) return;
|
405
399
|
internal::Address* obj = reinterpret_cast<internal::Address*>(val_);
|
406
|
-
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::
|
400
|
+
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kTracedNodeClassIdOffset;
|
407
401
|
*reinterpret_cast<uint16_t*>(addr) = class_id;
|
408
402
|
}
|
409
403
|
|
@@ -411,7 +405,7 @@ uint16_t TracedReferenceBase::WrapperClassId() const {
|
|
411
405
|
using I = internal::Internals;
|
412
406
|
if (IsEmpty()) return 0;
|
413
407
|
internal::Address* obj = reinterpret_cast<internal::Address*>(val_);
|
414
|
-
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::
|
408
|
+
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kTracedNodeClassIdOffset;
|
415
409
|
return *reinterpret_cast<uint16_t*>(addr);
|
416
410
|
}
|
417
411
|
|
@@ -17,10 +17,10 @@ struct CalleeSavedRegisters {
|
|
17
17
|
void* arm_r9;
|
18
18
|
void* arm_r10;
|
19
19
|
};
|
20
|
-
#elif V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM64 ||
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
#elif V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM64 || \
|
21
|
+
V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_PPC || V8_TARGET_ARCH_PPC64 || \
|
22
|
+
V8_TARGET_ARCH_RISCV64 || V8_TARGET_ARCH_S390 || V8_TARGET_ARCH_LOONG64 || \
|
23
|
+
V8_TARGET_ARCH_RISCV32
|
24
24
|
struct CalleeSavedRegisters {};
|
25
25
|
#else
|
26
26
|
#error Target architecture was not detected as supported by v8
|
data/vendor/v8/include/v8-util.h
CHANGED
@@ -181,7 +181,11 @@ class PersistentValueMapBase {
|
|
181
181
|
* Get value stored in map.
|
182
182
|
*/
|
183
183
|
Local<V> Get(const K& key) {
|
184
|
-
|
184
|
+
V* p = FromVal(Traits::Get(&impl_, key));
|
185
|
+
#ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING
|
186
|
+
if (p == nullptr) return Local<V>();
|
187
|
+
#endif
|
188
|
+
return Local<V>::New(isolate_, p);
|
185
189
|
}
|
186
190
|
|
187
191
|
/**
|
@@ -236,7 +240,8 @@ class PersistentValueMapBase {
|
|
236
240
|
: value_(other.value_) { }
|
237
241
|
|
238
242
|
Local<V> NewLocal(Isolate* isolate) const {
|
239
|
-
return Local<V>::New(
|
243
|
+
return Local<V>::New(
|
244
|
+
isolate, internal::ValueHelper::SlotAsValue<V>(FromVal(value_)));
|
240
245
|
}
|
241
246
|
bool IsEmpty() const {
|
242
247
|
return value_ == kPersistentContainerNotFound;
|
@@ -537,7 +542,6 @@ class StdGlobalValueMap : public GlobalValueMap<K, V, Traits> {
|
|
537
542
|
: GlobalValueMap<K, V, Traits>(isolate) {}
|
538
543
|
};
|
539
544
|
|
540
|
-
|
541
545
|
class DefaultPersistentValueVectorTraits {
|
542
546
|
public:
|
543
547
|
typedef std::vector<PersistentContainerValue> Impl;
|
@@ -562,7 +566,6 @@ class DefaultPersistentValueVectorTraits {
|
|
562
566
|
}
|
563
567
|
};
|
564
568
|
|
565
|
-
|
566
569
|
/**
|
567
570
|
* A vector wrapper that safely stores Global values.
|
568
571
|
* C++11 embedders don't need this class, as they can use Global
|
@@ -573,8 +576,8 @@ class DefaultPersistentValueVectorTraits {
|
|
573
576
|
* PersistentContainerValue, with all conversion into and out of V8
|
574
577
|
* handles being transparently handled by this class.
|
575
578
|
*/
|
576
|
-
template<typename V, typename Traits = DefaultPersistentValueVectorTraits>
|
577
|
-
class PersistentValueVector {
|
579
|
+
template <typename V, typename Traits = DefaultPersistentValueVectorTraits>
|
580
|
+
class V8_DEPRECATE_SOON("Use std::vector<Global<V>>.") PersistentValueVector {
|
578
581
|
public:
|
579
582
|
explicit PersistentValueVector(Isolate* isolate) : isolate_(isolate) { }
|
580
583
|
|
@@ -615,7 +618,8 @@ class PersistentValueVector {
|
|
615
618
|
* Retrieve the i-th value in the vector.
|
616
619
|
*/
|
617
620
|
Local<V> Get(size_t index) const {
|
618
|
-
return Local<V>::New(isolate_,
|
621
|
+
return Local<V>::New(isolate_, internal::ValueHelper::SlotAsValue<V>(
|
622
|
+
FromVal(Traits::Get(&impl_, index))));
|
619
623
|
}
|
620
624
|
|
621
625
|
/**
|