libv8-node 20.12.1.0-arm64-darwin → 21.7.2.0-arm64-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/arm64-darwin/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +23 -4
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +16 -6
- data/vendor/v8/include/cppgc/internal/caged-heap.h +12 -5
- data/vendor/v8/include/cppgc/internal/gc-info.h +82 -91
- data/vendor/v8/include/cppgc/internal/member-storage.h +16 -8
- data/vendor/v8/include/cppgc/member.h +25 -0
- data/vendor/v8/include/cppgc/persistent.h +4 -0
- data/vendor/v8/include/cppgc/platform.h +6 -1
- data/vendor/v8/include/cppgc/sentinel-pointer.h +7 -0
- data/vendor/v8/include/cppgc/source-location.h +2 -78
- data/vendor/v8/include/cppgc/trace-trait.h +8 -0
- data/vendor/v8/include/cppgc/visitor.h +82 -4
- data/vendor/v8/include/libplatform/libplatform.h +7 -1
- data/vendor/v8/include/v8-callbacks.h +52 -8
- data/vendor/v8/include/v8-context.h +10 -13
- data/vendor/v8/include/v8-embedder-heap.h +12 -0
- data/vendor/v8/include/v8-fast-api-calls.h +23 -5
- data/vendor/v8/include/v8-function-callback.h +11 -15
- data/vendor/v8/include/v8-function.h +6 -0
- data/vendor/v8/include/v8-handle-base.h +185 -0
- data/vendor/v8/include/v8-inspector.h +31 -1
- data/vendor/v8/include/v8-internal.h +109 -77
- data/vendor/v8/include/v8-isolate.h +130 -89
- data/vendor/v8/include/v8-local-handle.h +134 -89
- data/vendor/v8/include/v8-object.h +71 -69
- data/vendor/v8/include/v8-persistent-handle.h +65 -89
- data/vendor/v8/include/v8-platform.h +140 -9
- data/vendor/v8/include/v8-primitive.h +12 -8
- data/vendor/v8/include/v8-profiler.h +16 -2
- data/vendor/v8/include/v8-script.h +27 -3
- data/vendor/v8/include/v8-snapshot.h +4 -1
- data/vendor/v8/include/v8-source-location.h +92 -0
- data/vendor/v8/include/v8-statistics.h +36 -1
- data/vendor/v8/include/v8-traced-handle.h +37 -54
- data/vendor/v8/include/v8-unwinder.h +1 -1
- data/vendor/v8/include/v8-util.h +15 -13
- data/vendor/v8/include/v8-value-serializer.h +14 -0
- data/vendor/v8/include/v8-value.h +14 -0
- data/vendor/v8/include/v8-version.h +3 -3
- data/vendor/v8/include/v8config.h +19 -10
- metadata +4 -2
@@ -5,10 +5,13 @@
|
|
5
5
|
#ifndef INCLUDE_CPPGC_VISITOR_H_
|
6
6
|
#define INCLUDE_CPPGC_VISITOR_H_
|
7
7
|
|
8
|
+
#include <type_traits>
|
9
|
+
|
8
10
|
#include "cppgc/custom-space.h"
|
9
11
|
#include "cppgc/ephemeron-pair.h"
|
10
12
|
#include "cppgc/garbage-collected.h"
|
11
13
|
#include "cppgc/internal/logging.h"
|
14
|
+
#include "cppgc/internal/member-storage.h"
|
12
15
|
#include "cppgc/internal/pointer-policies.h"
|
13
16
|
#include "cppgc/liveness-broker.h"
|
14
17
|
#include "cppgc/member.h"
|
@@ -113,6 +116,30 @@ class V8_EXPORT Visitor {
|
|
113
116
|
}
|
114
117
|
#endif // defined(CPPGC_POINTER_COMPRESSION)
|
115
118
|
|
119
|
+
template <typename T>
|
120
|
+
void TraceMultiple(const subtle::UncompressedMember<T>* start, size_t len) {
|
121
|
+
static_assert(sizeof(T), "Pointee type must be fully defined.");
|
122
|
+
static_assert(internal::IsGarbageCollectedOrMixinType<T>::value,
|
123
|
+
"T must be GarbageCollected or GarbageCollectedMixin type");
|
124
|
+
VisitMultipleUncompressedMember(start, len,
|
125
|
+
&TraceTrait<T>::GetTraceDescriptor);
|
126
|
+
}
|
127
|
+
|
128
|
+
template <typename T,
|
129
|
+
std::enable_if_t<!std::is_same_v<
|
130
|
+
Member<T>, subtle::UncompressedMember<T>>>* = nullptr>
|
131
|
+
void TraceMultiple(const Member<T>* start, size_t len) {
|
132
|
+
static_assert(sizeof(T), "Pointee type must be fully defined.");
|
133
|
+
static_assert(internal::IsGarbageCollectedOrMixinType<T>::value,
|
134
|
+
"T must be GarbageCollected or GarbageCollectedMixin type");
|
135
|
+
#if defined(CPPGC_POINTER_COMPRESSION)
|
136
|
+
static_assert(std::is_same_v<Member<T>, subtle::CompressedMember<T>>,
|
137
|
+
"Member and CompressedMember must be the same.");
|
138
|
+
VisitMultipleCompressedMember(start, len,
|
139
|
+
&TraceTrait<T>::GetTraceDescriptor);
|
140
|
+
#endif // defined(CPPGC_POINTER_COMPRESSION)
|
141
|
+
}
|
142
|
+
|
116
143
|
/**
|
117
144
|
* Trace method for inlined objects that are not allocated themselves but
|
118
145
|
* otherwise follow managed heap layout and have a Trace() method.
|
@@ -131,6 +158,26 @@ class V8_EXPORT Visitor {
|
|
131
158
|
TraceTrait<T>::Trace(this, &object);
|
132
159
|
}
|
133
160
|
|
161
|
+
template <typename T>
|
162
|
+
void TraceMultiple(const T* start, size_t len) {
|
163
|
+
#if V8_ENABLE_CHECKS
|
164
|
+
// This object is embedded in potentially multiple nested objects. The
|
165
|
+
// outermost object must not be in construction as such objects are (a) not
|
166
|
+
// processed immediately, and (b) only processed conservatively if not
|
167
|
+
// otherwise possible.
|
168
|
+
CheckObjectNotInConstruction(start);
|
169
|
+
#endif // V8_ENABLE_CHECKS
|
170
|
+
for (size_t i = 0; i < len; ++i) {
|
171
|
+
const T* object = &start[i];
|
172
|
+
if constexpr (std::is_polymorphic_v<T>) {
|
173
|
+
// The object's vtable may be uninitialized in which case the object is
|
174
|
+
// not traced.
|
175
|
+
if (*reinterpret_cast<const uintptr_t*>(object) == 0) continue;
|
176
|
+
}
|
177
|
+
TraceTrait<T>::Trace(this, object);
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
134
181
|
/**
|
135
182
|
* Registers a weak callback method on the object of type T. See
|
136
183
|
* LivenessBroker for an usage example.
|
@@ -314,6 +361,39 @@ class V8_EXPORT Visitor {
|
|
314
361
|
WeakCallback callback, const void* data) {}
|
315
362
|
virtual void HandleMovableReference(const void**) {}
|
316
363
|
|
364
|
+
virtual void VisitMultipleUncompressedMember(
|
365
|
+
const void* start, size_t len,
|
366
|
+
TraceDescriptorCallback get_trace_descriptor) {
|
367
|
+
// Default implementation merely delegates to Visit().
|
368
|
+
const char* it = static_cast<const char*>(start);
|
369
|
+
const char* end = it + len * internal::kSizeOfUncompressedMember;
|
370
|
+
for (; it < end; it += internal::kSizeOfUncompressedMember) {
|
371
|
+
const auto* current = reinterpret_cast<const internal::RawPointer*>(it);
|
372
|
+
const void* object = current->LoadAtomic();
|
373
|
+
if (!object) continue;
|
374
|
+
|
375
|
+
Visit(object, get_trace_descriptor(object));
|
376
|
+
}
|
377
|
+
}
|
378
|
+
|
379
|
+
#if defined(CPPGC_POINTER_COMPRESSION)
|
380
|
+
virtual void VisitMultipleCompressedMember(
|
381
|
+
const void* start, size_t len,
|
382
|
+
TraceDescriptorCallback get_trace_descriptor) {
|
383
|
+
// Default implementation merely delegates to Visit().
|
384
|
+
const char* it = static_cast<const char*>(start);
|
385
|
+
const char* end = it + len * internal::kSizeofCompressedMember;
|
386
|
+
for (; it < end; it += internal::kSizeofCompressedMember) {
|
387
|
+
const auto* current =
|
388
|
+
reinterpret_cast<const internal::CompressedPointer*>(it);
|
389
|
+
const void* object = current->LoadAtomic();
|
390
|
+
if (!object) continue;
|
391
|
+
|
392
|
+
Visit(object, get_trace_descriptor(object));
|
393
|
+
}
|
394
|
+
}
|
395
|
+
#endif // defined(CPPGC_POINTER_COMPRESSION)
|
396
|
+
|
317
397
|
private:
|
318
398
|
template <typename T, void (T::*method)(const LivenessBroker&)>
|
319
399
|
static void WeakCallbackMethodDelegate(const LivenessBroker& info,
|
@@ -326,8 +406,7 @@ class V8_EXPORT Visitor {
|
|
326
406
|
template <typename PointerType>
|
327
407
|
static void HandleWeak(const LivenessBroker& info, const void* object) {
|
328
408
|
const PointerType* weak = static_cast<const PointerType*>(object);
|
329
|
-
|
330
|
-
if (!info.IsHeapObjectAlive(raw_ptr)) {
|
409
|
+
if (!info.IsHeapObjectAlive(weak->GetFromGC())) {
|
331
410
|
weak->ClearFromGC();
|
332
411
|
}
|
333
412
|
}
|
@@ -413,8 +492,7 @@ class V8_EXPORT RootVisitor {
|
|
413
492
|
template <typename PointerType>
|
414
493
|
static void HandleWeak(const LivenessBroker& info, const void* object) {
|
415
494
|
const PointerType* weak = static_cast<const PointerType*>(object);
|
416
|
-
|
417
|
-
if (!info.IsHeapObjectAlive(raw_ptr)) {
|
495
|
+
if (!info.IsHeapObjectAlive(weak->GetFromGC())) {
|
418
496
|
weak->ClearFromGC();
|
419
497
|
}
|
420
498
|
}
|
@@ -23,6 +23,8 @@ enum class MessageLoopBehavior : bool {
|
|
23
23
|
kWaitForWork = true
|
24
24
|
};
|
25
25
|
|
26
|
+
enum class PriorityMode : bool { kDontApply, kApply };
|
27
|
+
|
26
28
|
/**
|
27
29
|
* Returns a new instance of the default v8::Platform implementation.
|
28
30
|
*
|
@@ -35,13 +37,17 @@ enum class MessageLoopBehavior : bool {
|
|
35
37
|
* calling v8::platform::RunIdleTasks to process the idle tasks.
|
36
38
|
* If |tracing_controller| is nullptr, the default platform will create a
|
37
39
|
* v8::platform::TracingController instance and use it.
|
40
|
+
* If |priority_mode| is PriorityMode::kApply, the default platform will use
|
41
|
+
* multiple task queues executed by threads different system-level priorities
|
42
|
+
* (where available) to schedule tasks.
|
38
43
|
*/
|
39
44
|
V8_PLATFORM_EXPORT std::unique_ptr<v8::Platform> NewDefaultPlatform(
|
40
45
|
int thread_pool_size = 0,
|
41
46
|
IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled,
|
42
47
|
InProcessStackDumping in_process_stack_dumping =
|
43
48
|
InProcessStackDumping::kDisabled,
|
44
|
-
std::unique_ptr<v8::TracingController> tracing_controller = {}
|
49
|
+
std::unique_ptr<v8::TracingController> tracing_controller = {},
|
50
|
+
PriorityMode priority_mode = PriorityMode::kDontApply);
|
45
51
|
|
46
52
|
/**
|
47
53
|
* The same as NewDefaultPlatform but disables the worker thread pool.
|
@@ -147,14 +147,18 @@ using JitCodeEventHandler = void (*)(const JitCodeEvent* event);
|
|
147
147
|
* the callback functions, you therefore cannot manipulate objects (set or
|
148
148
|
* delete properties for example) since it is possible such operations will
|
149
149
|
* result in the allocation of objects.
|
150
|
+
* TODO(v8:12612): Deprecate kGCTypeMinorMarkSweep after updating blink.
|
150
151
|
*/
|
151
152
|
enum GCType {
|
152
153
|
kGCTypeScavenge = 1 << 0,
|
153
|
-
|
154
|
+
kGCTypeMinorMarkSweep = 1 << 1,
|
155
|
+
kGCTypeMinorMarkCompact V8_DEPRECATE_SOON(
|
156
|
+
"Use kGCTypeMinorMarkSweep instead of kGCTypeMinorMarkCompact.") =
|
157
|
+
kGCTypeMinorMarkSweep,
|
154
158
|
kGCTypeMarkSweepCompact = 1 << 2,
|
155
159
|
kGCTypeIncrementalMarking = 1 << 3,
|
156
160
|
kGCTypeProcessWeakCallbacks = 1 << 4,
|
157
|
-
kGCTypeAll = kGCTypeScavenge |
|
161
|
+
kGCTypeAll = kGCTypeScavenge | kGCTypeMinorMarkSweep |
|
158
162
|
kGCTypeMarkSweepCompact | kGCTypeIncrementalMarking |
|
159
163
|
kGCTypeProcessWeakCallbacks
|
160
164
|
};
|
@@ -323,20 +327,21 @@ using WasmAsyncResolvePromiseCallback = void (*)(
|
|
323
327
|
using WasmLoadSourceMapCallback = Local<String> (*)(Isolate* isolate,
|
324
328
|
const char* name);
|
325
329
|
|
326
|
-
// --- Callback for checking if WebAssembly Simd is enabled ---
|
327
|
-
using WasmSimdEnabledCallback = bool (*)(Local<Context> context);
|
328
|
-
|
329
|
-
// --- Callback for checking if WebAssembly exceptions are enabled ---
|
330
|
-
using WasmExceptionsEnabledCallback = bool (*)(Local<Context> context);
|
331
|
-
|
332
330
|
// --- Callback for checking if WebAssembly GC is enabled ---
|
333
331
|
// If the callback returns true, it will also enable Wasm stringrefs.
|
334
332
|
using WasmGCEnabledCallback = bool (*)(Local<Context> context);
|
335
333
|
|
334
|
+
// --- Callback for checking if WebAssembly imported strings are enabled ---
|
335
|
+
using WasmImportedStringsEnabledCallback = bool (*)(Local<Context> context);
|
336
|
+
|
336
337
|
// --- Callback for checking if the SharedArrayBuffer constructor is enabled ---
|
337
338
|
using SharedArrayBufferConstructorEnabledCallback =
|
338
339
|
bool (*)(Local<Context> context);
|
339
340
|
|
341
|
+
// --- Callback for checking if the compile hints magic comments are enabled ---
|
342
|
+
using JavaScriptCompileHintsMagicEnabledCallback =
|
343
|
+
bool (*)(Local<Context> context);
|
344
|
+
|
340
345
|
/**
|
341
346
|
* HostImportModuleDynamicallyCallback is called when we
|
342
347
|
* require the embedder to load a module. This is used as part of the dynamic
|
@@ -419,6 +424,45 @@ using PrepareStackTraceCallback = MaybeLocal<Value> (*)(Local<Context> context,
|
|
419
424
|
Local<Value> error,
|
420
425
|
Local<Array> sites);
|
421
426
|
|
427
|
+
#if defined(V8_OS_WIN)
|
428
|
+
/**
|
429
|
+
* Callback to selectively enable ETW tracing based on the document URL.
|
430
|
+
* Implemented by the embedder, it should never call back into V8.
|
431
|
+
*
|
432
|
+
* Windows allows passing additional data to the ETW EnableCallback:
|
433
|
+
* https://learn.microsoft.com/en-us/windows/win32/api/evntprov/nc-evntprov-penablecallback
|
434
|
+
*
|
435
|
+
* This data can be configured in a WPR (Windows Performance Recorder)
|
436
|
+
* profile, adding a CustomFilter to an EventProvider like the following:
|
437
|
+
*
|
438
|
+
* <EventProvider Id=".." Name="57277741-3638-4A4B-BDBA-0AC6E45DA56C" Level="5">
|
439
|
+
* <CustomFilter Type="0x80000000" Value="AQABAAAAAAA..." />
|
440
|
+
* </EventProvider>
|
441
|
+
*
|
442
|
+
* Where:
|
443
|
+
* - Name="57277741-3638-4A4B-BDBA-0AC6E45DA56C" is the GUID of the V8
|
444
|
+
* ETW provider, (see src/libplatform/etw/etw-provider-win.h),
|
445
|
+
* - Type="0x80000000" is EVENT_FILTER_TYPE_SCHEMATIZED,
|
446
|
+
* - Value="AQABAAAAAA..." is a base64-encoded byte array that is
|
447
|
+
* base64-decoded by Windows and passed to the ETW enable callback in
|
448
|
+
* the 'PEVENT_FILTER_DESCRIPTOR FilterData' argument; see:
|
449
|
+
* https://learn.microsoft.com/en-us/windows/win32/api/evntprov/ns-evntprov-event_filter_descriptor.
|
450
|
+
*
|
451
|
+
* This array contains a struct EVENT_FILTER_HEADER followed by a
|
452
|
+
* variable length payload, and as payload we pass a string in JSON format,
|
453
|
+
* with a list of regular expressions that should match the document URL
|
454
|
+
* in order to enable ETW tracing:
|
455
|
+
* {
|
456
|
+
* "version": "1.0",
|
457
|
+
* "filtered_urls": [
|
458
|
+
* "https:\/\/.*\.chromium\.org\/.*", "https://v8.dev/";, "..."
|
459
|
+
* ]
|
460
|
+
* }
|
461
|
+
*/
|
462
|
+
using FilterETWSessionByURLCallback =
|
463
|
+
bool (*)(Local<Context> context, const std::string& etw_filter_payload);
|
464
|
+
#endif // V8_OS_WIN
|
465
|
+
|
422
466
|
} // namespace v8
|
423
467
|
|
424
468
|
#endif // INCLUDE_V8_ISOLATE_CALLBACKS_H_
|
@@ -395,7 +395,7 @@ Local<Value> Context::GetEmbedderData(int index) {
|
|
395
395
|
#ifndef V8_ENABLE_CHECKS
|
396
396
|
using A = internal::Address;
|
397
397
|
using I = internal::Internals;
|
398
|
-
A ctx =
|
398
|
+
A ctx = internal::ValueHelper::ValueAsAddress(this);
|
399
399
|
A embedder_data =
|
400
400
|
I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
|
401
401
|
int value_offset =
|
@@ -407,15 +407,9 @@ Local<Value> Context::GetEmbedderData(int index) {
|
|
407
407
|
value = I::DecompressTaggedField(embedder_data, static_cast<uint32_t>(value));
|
408
408
|
#endif
|
409
409
|
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
internal::Isolate* isolate = internal::IsolateFromNeverReadOnlySpaceObject(
|
414
|
-
*reinterpret_cast<A*>(this));
|
415
|
-
A* result = HandleScope::CreateHandle(isolate, value);
|
416
|
-
return Local<Value>(reinterpret_cast<Value*>(result));
|
417
|
-
#endif
|
418
|
-
|
410
|
+
auto isolate = reinterpret_cast<v8::Isolate*>(
|
411
|
+
internal::IsolateFromNeverReadOnlySpaceObject(ctx));
|
412
|
+
return Local<Value>::New(isolate, value);
|
419
413
|
#else
|
420
414
|
return SlowGetEmbedderData(index);
|
421
415
|
#endif
|
@@ -442,9 +436,12 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) {
|
|
442
436
|
|
443
437
|
template <class T>
|
444
438
|
MaybeLocal<T> Context::GetDataFromSnapshotOnce(size_t index) {
|
445
|
-
|
446
|
-
if (
|
447
|
-
|
439
|
+
auto slot = GetDataFromSnapshotOnce(index);
|
440
|
+
if (slot) {
|
441
|
+
internal::PerformCastCheck(
|
442
|
+
internal::ValueHelper::SlotAsValue<T, false>(slot));
|
443
|
+
}
|
444
|
+
return Local<T>::FromSlot(slot);
|
448
445
|
}
|
449
446
|
|
450
447
|
Context* Context::Cast(v8::Data* data) {
|
@@ -34,6 +34,8 @@ class V8_EXPORT EmbedderRootsHandler {
|
|
34
34
|
* for retaining the object. The embedder may use |WrapperClassId()| to
|
35
35
|
* distinguish cases where it wants handles to be treated as roots from not
|
36
36
|
* being treated as roots.
|
37
|
+
*
|
38
|
+
* The concrete implementations must be thread-safe.
|
37
39
|
*/
|
38
40
|
virtual bool IsRoot(const v8::TracedReference<v8::Value>& handle) = 0;
|
39
41
|
|
@@ -47,6 +49,16 @@ class V8_EXPORT EmbedderRootsHandler {
|
|
47
49
|
* handle via the object or class id.
|
48
50
|
*/
|
49
51
|
virtual void ResetRoot(const v8::TracedReference<v8::Value>& handle) = 0;
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Similar to |ResetRoot()|, but opportunistic. The function is called in
|
55
|
+
* parallel for different handles and as such must be thread-safe. In case,
|
56
|
+
* |false| is returned, |ResetRoot()| will be recalled for the same handle.
|
57
|
+
*/
|
58
|
+
virtual bool TryResetRoot(const v8::TracedReference<v8::Value>& handle) {
|
59
|
+
ResetRoot(handle);
|
60
|
+
return true;
|
61
|
+
}
|
50
62
|
};
|
51
63
|
|
52
64
|
} // namespace v8
|
@@ -388,13 +388,19 @@ struct FastOneByteString {
|
|
388
388
|
|
389
389
|
class V8_EXPORT CFunctionInfo {
|
390
390
|
public:
|
391
|
+
enum class Int64Representation : uint8_t {
|
392
|
+
kNumber = 0, // Use numbers to represent 64 bit integers.
|
393
|
+
kBigInt = 1, // Use BigInts to represent 64 bit integers.
|
394
|
+
};
|
395
|
+
|
391
396
|
// Construct a struct to hold a CFunction's type information.
|
392
397
|
// |return_info| describes the function's return type.
|
393
398
|
// |arg_info| is an array of |arg_count| CTypeInfos describing the
|
394
399
|
// arguments. Only the last argument may be of the special type
|
395
400
|
// CTypeInfo::kCallbackOptionsType.
|
396
401
|
CFunctionInfo(const CTypeInfo& return_info, unsigned int arg_count,
|
397
|
-
const CTypeInfo* arg_info
|
402
|
+
const CTypeInfo* arg_info,
|
403
|
+
Int64Representation repr = Int64Representation::kNumber);
|
398
404
|
|
399
405
|
const CTypeInfo& ReturnInfo() const { return return_info_; }
|
400
406
|
|
@@ -404,6 +410,8 @@ class V8_EXPORT CFunctionInfo {
|
|
404
410
|
return HasOptions() ? arg_count_ - 1 : arg_count_;
|
405
411
|
}
|
406
412
|
|
413
|
+
Int64Representation GetInt64Representation() const { return repr_; }
|
414
|
+
|
407
415
|
// |index| must be less than ArgumentCount().
|
408
416
|
// Note: if the last argument passed on construction of CFunctionInfo
|
409
417
|
// has type CTypeInfo::kCallbackOptionsType, it is not included in
|
@@ -418,6 +426,7 @@ class V8_EXPORT CFunctionInfo {
|
|
418
426
|
|
419
427
|
private:
|
420
428
|
const CTypeInfo return_info_;
|
429
|
+
const Int64Representation repr_;
|
421
430
|
const unsigned int arg_count_;
|
422
431
|
const CTypeInfo* arg_info_;
|
423
432
|
};
|
@@ -469,6 +478,9 @@ class V8_EXPORT CFunction {
|
|
469
478
|
unsigned int ArgumentCount() const { return type_info_->ArgumentCount(); }
|
470
479
|
|
471
480
|
const void* GetAddress() const { return address_; }
|
481
|
+
CFunctionInfo::Int64Representation GetInt64Representation() const {
|
482
|
+
return type_info_->GetInt64Representation();
|
483
|
+
}
|
472
484
|
const CFunctionInfo* GetTypeInfo() const { return type_info_; }
|
473
485
|
|
474
486
|
enum class OverloadResolution { kImpossible, kAtRuntime, kAtCompileTime };
|
@@ -598,7 +610,8 @@ struct count<T, T, Args...>
|
|
598
610
|
template <typename T, typename U, typename... Args>
|
599
611
|
struct count<T, U, Args...> : count<T, Args...> {};
|
600
612
|
|
601
|
-
template <
|
613
|
+
template <CFunctionInfo::Int64Representation Representation,
|
614
|
+
typename RetBuilder, typename... ArgBuilders>
|
602
615
|
class CFunctionInfoImpl : public CFunctionInfo {
|
603
616
|
static constexpr int kOptionsArgCount =
|
604
617
|
count<FastApiCallbackOptions&, ArgBuilders...>();
|
@@ -613,18 +626,20 @@ class CFunctionInfoImpl : public CFunctionInfo {
|
|
613
626
|
public:
|
614
627
|
constexpr CFunctionInfoImpl()
|
615
628
|
: CFunctionInfo(RetBuilder::Build(), sizeof...(ArgBuilders),
|
616
|
-
arg_info_storage_),
|
629
|
+
arg_info_storage_, Representation),
|
617
630
|
arg_info_storage_{ArgBuilders::Build()...} {
|
618
631
|
constexpr CTypeInfo::Type kReturnType = RetBuilder::Build().GetType();
|
619
632
|
static_assert(kReturnType == CTypeInfo::Type::kVoid ||
|
620
633
|
kReturnType == CTypeInfo::Type::kBool ||
|
621
634
|
kReturnType == CTypeInfo::Type::kInt32 ||
|
622
635
|
kReturnType == CTypeInfo::Type::kUint32 ||
|
636
|
+
kReturnType == CTypeInfo::Type::kInt64 ||
|
637
|
+
kReturnType == CTypeInfo::Type::kUint64 ||
|
623
638
|
kReturnType == CTypeInfo::Type::kFloat32 ||
|
624
639
|
kReturnType == CTypeInfo::Type::kFloat64 ||
|
625
640
|
kReturnType == CTypeInfo::Type::kPointer ||
|
626
641
|
kReturnType == CTypeInfo::Type::kAny,
|
627
|
-
"
|
642
|
+
"String and api object values are not currently "
|
628
643
|
"supported return types.");
|
629
644
|
}
|
630
645
|
|
@@ -845,8 +860,11 @@ class CFunctionBuilderWithFunction {
|
|
845
860
|
return *this;
|
846
861
|
}
|
847
862
|
|
863
|
+
template <CFunctionInfo::Int64Representation Representation =
|
864
|
+
CFunctionInfo::Int64Representation::kNumber>
|
848
865
|
auto Build() {
|
849
|
-
static CFunctionInfoImpl<RetBuilder, ArgBuilders...>
|
866
|
+
static CFunctionInfoImpl<Representation, RetBuilder, ArgBuilders...>
|
867
|
+
instance;
|
850
868
|
return CFunction(fn_, &instance);
|
851
869
|
}
|
852
870
|
|
@@ -78,7 +78,6 @@ class ReturnValue {
|
|
78
78
|
|
79
79
|
// See FunctionCallbackInfo.
|
80
80
|
static constexpr int kIsolateValueIndex = -2;
|
81
|
-
static constexpr int kDefaultValueValueIndex = -1;
|
82
81
|
|
83
82
|
internal::Address* value_;
|
84
83
|
};
|
@@ -127,16 +126,16 @@ class FunctionCallbackInfo {
|
|
127
126
|
friend class internal::FunctionCallbackArguments;
|
128
127
|
friend class internal::CustomArguments<FunctionCallbackInfo>;
|
129
128
|
friend class debug::ConsoleCallArguments;
|
130
|
-
|
129
|
+
|
131
130
|
static constexpr int kHolderIndex = 0;
|
132
131
|
static constexpr int kIsolateIndex = 1;
|
133
|
-
static constexpr int
|
132
|
+
static constexpr int kUnusedIndex = 2;
|
134
133
|
static constexpr int kReturnValueIndex = 3;
|
135
134
|
static constexpr int kDataIndex = 4;
|
136
135
|
static constexpr int kNewTargetIndex = 5;
|
137
|
-
|
138
136
|
static constexpr int kArgsLength = 6;
|
139
|
-
|
137
|
+
|
138
|
+
static constexpr int kArgsLengthWithReceiver = kArgsLength + 1;
|
140
139
|
|
141
140
|
// Codegen constants:
|
142
141
|
static constexpr int kSize = 3 * internal::kApiSystemPointerSize;
|
@@ -147,8 +146,6 @@ class FunctionCallbackInfo {
|
|
147
146
|
kValuesOffset + internal::kApiSystemPointerSize;
|
148
147
|
|
149
148
|
static constexpr int kThisValuesIndex = -1;
|
150
|
-
static_assert(ReturnValue<Value>::kDefaultValueValueIndex ==
|
151
|
-
kReturnValueDefaultValueIndex - kReturnValueIndex);
|
152
149
|
static_assert(ReturnValue<Value>::kIsolateValueIndex ==
|
153
150
|
kIsolateIndex - kReturnValueIndex);
|
154
151
|
|
@@ -258,17 +255,17 @@ class PropertyCallbackInfo {
|
|
258
255
|
static constexpr int kShouldThrowOnErrorIndex = 0;
|
259
256
|
static constexpr int kHolderIndex = 1;
|
260
257
|
static constexpr int kIsolateIndex = 2;
|
261
|
-
static constexpr int
|
258
|
+
static constexpr int kUnusedIndex = 3;
|
262
259
|
static constexpr int kReturnValueIndex = 4;
|
263
260
|
static constexpr int kDataIndex = 5;
|
264
261
|
static constexpr int kThisIndex = 6;
|
265
|
-
|
266
262
|
static constexpr int kArgsLength = 7;
|
267
263
|
|
268
264
|
static constexpr int kSize = 1 * internal::kApiSystemPointerSize;
|
269
265
|
|
270
266
|
V8_INLINE explicit PropertyCallbackInfo(internal::Address* args)
|
271
267
|
: args_(args) {}
|
268
|
+
|
272
269
|
internal::Address* args_;
|
273
270
|
};
|
274
271
|
|
@@ -286,7 +283,7 @@ void ReturnValue<T>::Set(const Global<S>& handle) {
|
|
286
283
|
if (V8_UNLIKELY(handle.IsEmpty())) {
|
287
284
|
*value_ = GetDefaultValue();
|
288
285
|
} else {
|
289
|
-
*value_ =
|
286
|
+
*value_ = handle.ptr();
|
290
287
|
}
|
291
288
|
}
|
292
289
|
|
@@ -297,7 +294,7 @@ void ReturnValue<T>::Set(const BasicTracedReference<S>& handle) {
|
|
297
294
|
if (V8_UNLIKELY(handle.IsEmpty())) {
|
298
295
|
*value_ = GetDefaultValue();
|
299
296
|
} else {
|
300
|
-
*value_ =
|
297
|
+
*value_ = handle.ptr();
|
301
298
|
}
|
302
299
|
}
|
303
300
|
|
@@ -309,7 +306,7 @@ void ReturnValue<T>::Set(const Local<S> handle) {
|
|
309
306
|
if (V8_UNLIKELY(handle.IsEmpty())) {
|
310
307
|
*value_ = GetDefaultValue();
|
311
308
|
} else {
|
312
|
-
*value_ =
|
309
|
+
*value_ = handle.ptr();
|
313
310
|
}
|
314
311
|
}
|
315
312
|
|
@@ -378,7 +375,6 @@ void ReturnValue<T>::SetEmptyString() {
|
|
378
375
|
|
379
376
|
template <typename T>
|
380
377
|
Isolate* ReturnValue<T>::GetIsolate() const {
|
381
|
-
// Isolate is always the pointer below the default value on the stack.
|
382
378
|
return *reinterpret_cast<Isolate**>(&value_[kIsolateValueIndex]);
|
383
379
|
}
|
384
380
|
|
@@ -403,8 +399,8 @@ void ReturnValue<T>::Set(S* whatever) {
|
|
403
399
|
|
404
400
|
template <typename T>
|
405
401
|
internal::Address ReturnValue<T>::GetDefaultValue() {
|
406
|
-
|
407
|
-
return
|
402
|
+
using I = internal::Internals;
|
403
|
+
return I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex);
|
408
404
|
}
|
409
405
|
|
410
406
|
template <typename T>
|
@@ -87,6 +87,12 @@ class V8_EXPORT Function : public Object {
|
|
87
87
|
*/
|
88
88
|
int GetScriptColumnNumber() const;
|
89
89
|
|
90
|
+
/**
|
91
|
+
* Returns zero based start position (character offset) of function body and
|
92
|
+
* kLineOffsetNotFound if no information available.
|
93
|
+
*/
|
94
|
+
int GetScriptStartPosition() const;
|
95
|
+
|
90
96
|
/**
|
91
97
|
* Returns scriptId.
|
92
98
|
*/
|