libv8-node 21.7.2.0-aarch64-linux-musl → 24.12.0.0-aarch64-linux-musl
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/ext/libv8-node/location.rb +3 -5
- data/ext/libv8-node/paths.rb +2 -0
- data/lib/libv8/node/version.rb +7 -4
- data/lib/libv8/node.rb +2 -0
- data/lib/libv8-node.rb +2 -0
- data/vendor/v8/aarch64-linux-musl/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/allocation.h +11 -13
- data/vendor/v8/include/cppgc/default-platform.h +3 -2
- data/vendor/v8/include/cppgc/garbage-collected.h +8 -0
- data/vendor/v8/include/cppgc/heap-consistency.h +1 -1
- data/vendor/v8/include/cppgc/heap-statistics.h +2 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +2 -14
- data/vendor/v8/include/cppgc/internal/base-page-handle.h +2 -4
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +0 -4
- data/vendor/v8/include/cppgc/internal/caged-heap.h +0 -4
- data/vendor/v8/include/cppgc/internal/compiler-specific.h +9 -1
- data/vendor/v8/include/cppgc/internal/conditional-stack-allocated.h +41 -0
- data/vendor/v8/include/cppgc/internal/gc-info.h +12 -10
- data/vendor/v8/include/cppgc/internal/logging.h +3 -3
- data/vendor/v8/include/cppgc/internal/member-storage.h +69 -20
- data/vendor/v8/include/cppgc/internal/name-trait.h +5 -1
- data/vendor/v8/include/cppgc/internal/persistent-node.h +8 -3
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +48 -11
- data/vendor/v8/include/cppgc/macros.h +21 -0
- data/vendor/v8/include/cppgc/member.h +70 -36
- data/vendor/v8/include/cppgc/name-provider.h +10 -0
- data/vendor/v8/include/cppgc/platform.h +11 -0
- data/vendor/v8/include/cppgc/type-traits.h +26 -4
- data/vendor/v8/include/cppgc/visitor.h +25 -1
- data/vendor/v8/include/libplatform/libplatform-export.h +2 -2
- data/vendor/v8/include/libplatform/v8-tracing.h +0 -1
- data/vendor/v8/include/v8-array-buffer.h +149 -46
- data/vendor/v8/include/v8-callbacks.h +100 -43
- data/vendor/v8/include/v8-container.h +54 -0
- data/vendor/v8/include/v8-context.h +92 -30
- data/vendor/v8/include/v8-cppgc.h +5 -56
- data/vendor/v8/include/v8-data.h +5 -0
- data/vendor/v8/include/v8-date.h +9 -0
- data/vendor/v8/include/v8-debug.h +11 -0
- data/vendor/v8/include/v8-embedder-heap.h +8 -20
- data/vendor/v8/include/v8-embedder-state-scope.h +2 -1
- data/vendor/v8/include/v8-exception.h +87 -9
- data/vendor/v8/include/v8-external-memory-accounter.h +60 -0
- data/vendor/v8/include/v8-fast-api-calls.h +67 -223
- data/vendor/v8/include/v8-forward.h +1 -0
- data/vendor/v8/include/v8-function-callback.h +296 -75
- data/vendor/v8/include/v8-function.h +11 -3
- data/vendor/v8/include/v8-handle-base.h +52 -82
- data/vendor/v8/include/v8-initialization.h +26 -1
- data/vendor/v8/include/v8-inspector.h +26 -27
- data/vendor/v8/include/v8-internal.h +960 -230
- data/vendor/v8/include/v8-isolate.h +347 -226
- data/vendor/v8/include/v8-local-handle.h +307 -55
- data/vendor/v8/include/v8-maybe.h +2 -1
- data/vendor/v8/include/v8-memory-span.h +284 -4
- data/vendor/v8/include/v8-message.h +11 -5
- data/vendor/v8/include/v8-metrics.h +15 -0
- data/vendor/v8/include/v8-microtask-queue.h +0 -5
- data/vendor/v8/include/v8-object.h +314 -41
- data/vendor/v8/include/v8-persistent-handle.h +29 -39
- data/vendor/v8/include/v8-platform.h +135 -77
- data/vendor/v8/include/v8-primitive.h +223 -5
- data/vendor/v8/include/v8-profiler.h +51 -2
- data/vendor/v8/include/v8-promise.h +2 -2
- data/vendor/v8/include/v8-proxy.h +0 -1
- data/vendor/v8/include/v8-regexp.h +0 -1
- data/vendor/v8/include/v8-sandbox.h +173 -0
- data/vendor/v8/include/v8-script.h +125 -27
- data/vendor/v8/include/v8-snapshot.h +130 -23
- data/vendor/v8/include/v8-source-location.h +6 -1
- data/vendor/v8/include/v8-statistics.h +10 -24
- data/vendor/v8/include/v8-template.h +320 -193
- data/vendor/v8/include/v8-trace-categories.h +23 -0
- data/vendor/v8/include/v8-traced-handle.h +99 -76
- data/vendor/v8/include/v8-typed-array.h +111 -7
- data/vendor/v8/include/v8-unwinder-state.h +2 -3
- data/vendor/v8/include/v8-unwinder.h +2 -1
- data/vendor/v8/include/v8-util.h +10 -125
- data/vendor/v8/include/v8-value-serializer-version.h +3 -3
- data/vendor/v8/include/v8-value.h +113 -6
- data/vendor/v8/include/v8-version.h +3 -3
- data/vendor/v8/include/v8-wasm.h +27 -0
- data/vendor/v8/include/v8-weak-callback-info.h +20 -12
- data/vendor/v8/include/v8.h +3 -3
- data/vendor/v8/include/v8config.h +116 -53
- metadata +55 -12
- data/vendor/v8/include/cppgc/ephemeron-pair.h +0 -30
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
+
#ifndef INCLUDE_V8_FAST_API_CALLS_H_
|
|
6
|
+
#define INCLUDE_V8_FAST_API_CALLS_H_
|
|
7
|
+
|
|
5
8
|
/**
|
|
6
9
|
* This file provides additional API on top of the default one for making
|
|
7
10
|
* API calls, which come from embedder C++ functions. The functions are being
|
|
@@ -216,9 +219,6 @@
|
|
|
216
219
|
* associated SlowCallback.
|
|
217
220
|
*/
|
|
218
221
|
|
|
219
|
-
#ifndef INCLUDE_V8_FAST_API_CALLS_H_
|
|
220
|
-
#define INCLUDE_V8_FAST_API_CALLS_H_
|
|
221
|
-
|
|
222
222
|
#include <stddef.h>
|
|
223
223
|
#include <stdint.h>
|
|
224
224
|
|
|
@@ -235,6 +235,7 @@ namespace v8 {
|
|
|
235
235
|
|
|
236
236
|
class Isolate;
|
|
237
237
|
|
|
238
|
+
START_ALLOW_USE_DEPRECATED()
|
|
238
239
|
class CTypeInfo {
|
|
239
240
|
public:
|
|
240
241
|
enum class Type : uint8_t {
|
|
@@ -254,8 +255,8 @@ class CTypeInfo {
|
|
|
254
255
|
// migrated from v8::ApiObject to v8::Local<v8::Value>.
|
|
255
256
|
kAny, // This is added to enable untyped representation of fast
|
|
256
257
|
// call arguments for test purposes. It can represent any of
|
|
257
|
-
// the other types stored in the same memory as a union
|
|
258
|
-
//
|
|
258
|
+
// the other types stored in the same memory as a union
|
|
259
|
+
// (see AnyCType declared below). This allows for
|
|
259
260
|
// uniform passing of arguments w.r.t. their location
|
|
260
261
|
// (in a register or on the stack), independent of their
|
|
261
262
|
// actual type. It's currently used by the arm64 simulator
|
|
@@ -268,11 +269,11 @@ class CTypeInfo {
|
|
|
268
269
|
// than any valid Type enum.
|
|
269
270
|
static constexpr Type kCallbackOptionsType = Type(255);
|
|
270
271
|
|
|
271
|
-
enum class
|
|
272
|
+
enum class V8_DEPRECATE_SOON(
|
|
273
|
+
"There is no special support in V8 anymore, there is no need to"
|
|
274
|
+
"use a SequenceType") SequenceType : uint8_t {
|
|
272
275
|
kScalar,
|
|
273
276
|
kIsSequence, // sequence<T>
|
|
274
|
-
kIsTypedArray, // TypedArray of T or any ArrayBufferView if T
|
|
275
|
-
// is void
|
|
276
277
|
kIsArrayBuffer // ArrayBuffer
|
|
277
278
|
};
|
|
278
279
|
|
|
@@ -284,9 +285,12 @@ class CTypeInfo {
|
|
|
284
285
|
kIsRestrictedBit = 1 << 3, // T must be float or double
|
|
285
286
|
};
|
|
286
287
|
|
|
287
|
-
explicit constexpr CTypeInfo(
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
explicit constexpr CTypeInfo(Type type, Flags flags = Flags::kNone)
|
|
289
|
+
: type_(type), sequence_type_(SequenceType::kScalar), flags_(flags) {}
|
|
290
|
+
|
|
291
|
+
V8_DEPRECATE_SOON("Use CTypeInfo(Type, Flags) instead")
|
|
292
|
+
constexpr CTypeInfo(Type type, SequenceType sequence_type,
|
|
293
|
+
Flags flags = Flags::kNone)
|
|
290
294
|
: type_(type), sequence_type_(sequence_type), flags_(flags) {}
|
|
291
295
|
|
|
292
296
|
typedef uint32_t Identifier;
|
|
@@ -301,6 +305,7 @@ class CTypeInfo {
|
|
|
301
305
|
}
|
|
302
306
|
|
|
303
307
|
constexpr Type GetType() const { return type_; }
|
|
308
|
+
V8_DEPRECATE_SOON("Use the constant SequenceType::kScalar instead")
|
|
304
309
|
constexpr SequenceType GetSequenceType() const { return sequence_type_; }
|
|
305
310
|
constexpr Flags GetFlags() const { return flags_; }
|
|
306
311
|
|
|
@@ -324,62 +329,7 @@ class CTypeInfo {
|
|
|
324
329
|
SequenceType sequence_type_;
|
|
325
330
|
Flags flags_;
|
|
326
331
|
};
|
|
327
|
-
|
|
328
|
-
struct FastApiTypedArrayBase {
|
|
329
|
-
public:
|
|
330
|
-
// Returns the length in number of elements.
|
|
331
|
-
size_t V8_EXPORT length() const { return length_; }
|
|
332
|
-
// Checks whether the given index is within the bounds of the collection.
|
|
333
|
-
void V8_EXPORT ValidateIndex(size_t index) const;
|
|
334
|
-
|
|
335
|
-
protected:
|
|
336
|
-
size_t length_ = 0;
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
template <typename T>
|
|
340
|
-
struct FastApiTypedArray : public FastApiTypedArrayBase {
|
|
341
|
-
public:
|
|
342
|
-
V8_INLINE T get(size_t index) const {
|
|
343
|
-
#ifdef DEBUG
|
|
344
|
-
ValidateIndex(index);
|
|
345
|
-
#endif // DEBUG
|
|
346
|
-
T tmp;
|
|
347
|
-
memcpy(&tmp, reinterpret_cast<T*>(data_) + index, sizeof(T));
|
|
348
|
-
return tmp;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
bool getStorageIfAligned(T** elements) const {
|
|
352
|
-
if (reinterpret_cast<uintptr_t>(data_) % alignof(T) != 0) {
|
|
353
|
-
return false;
|
|
354
|
-
}
|
|
355
|
-
*elements = reinterpret_cast<T*>(data_);
|
|
356
|
-
return true;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
private:
|
|
360
|
-
// This pointer should include the typed array offset applied.
|
|
361
|
-
// It's not guaranteed that it's aligned to sizeof(T), it's only
|
|
362
|
-
// guaranteed that it's 4-byte aligned, so for 8-byte types we need to
|
|
363
|
-
// provide a special implementation for reading from it, which hides
|
|
364
|
-
// the possibly unaligned read in the `get` method.
|
|
365
|
-
void* data_;
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
// Any TypedArray. It uses kTypedArrayBit with base type void
|
|
369
|
-
// Overloaded args of ArrayBufferView and TypedArray are not supported
|
|
370
|
-
// (for now) because the generic “any” ArrayBufferView doesn’t have its
|
|
371
|
-
// own instance type. It could be supported if we specify that
|
|
372
|
-
// TypedArray<T> always has precedence over the generic ArrayBufferView,
|
|
373
|
-
// but this complicates overload resolution.
|
|
374
|
-
struct FastApiArrayBufferView {
|
|
375
|
-
void* data;
|
|
376
|
-
size_t byte_length;
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
struct FastApiArrayBuffer {
|
|
380
|
-
void* data;
|
|
381
|
-
size_t byte_length;
|
|
382
|
-
};
|
|
332
|
+
END_ALLOW_USE_DEPRECATED()
|
|
383
333
|
|
|
384
334
|
struct FastOneByteString {
|
|
385
335
|
const char* data;
|
|
@@ -434,35 +384,36 @@ class V8_EXPORT CFunctionInfo {
|
|
|
434
384
|
struct FastApiCallbackOptions;
|
|
435
385
|
|
|
436
386
|
// Provided for testing.
|
|
437
|
-
|
|
387
|
+
union V8_TRIVIAL_ABI AnyCType {
|
|
438
388
|
AnyCType() : int64_value(0) {}
|
|
439
389
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
390
|
+
#if defined(V8_ENABLE_LOCAL_OFF_STACK_CHECK) && V8_HAS_ATTRIBUTE_TRIVIAL_ABI
|
|
391
|
+
// In this case, Local<T> is not trivially copyable and the implicit
|
|
392
|
+
// copy constructor and copy assignment for the union are deleted.
|
|
393
|
+
AnyCType(const AnyCType& other) : int64_value(other.int64_value) {}
|
|
394
|
+
AnyCType& operator=(const AnyCType& other) {
|
|
395
|
+
int64_value = other.int64_value;
|
|
396
|
+
return *this;
|
|
397
|
+
}
|
|
398
|
+
#endif
|
|
399
|
+
|
|
400
|
+
bool bool_value;
|
|
401
|
+
int32_t int32_value;
|
|
402
|
+
uint32_t uint32_value;
|
|
403
|
+
int64_t int64_value;
|
|
404
|
+
uint64_t uint64_value;
|
|
405
|
+
float float_value;
|
|
406
|
+
double double_value;
|
|
407
|
+
void* pointer_value;
|
|
408
|
+
Local<Object> object_value;
|
|
409
|
+
Local<Array> sequence_value;
|
|
410
|
+
const FastOneByteString* string_value;
|
|
411
|
+
FastApiCallbackOptions* options_value;
|
|
461
412
|
};
|
|
462
413
|
|
|
463
414
|
static_assert(
|
|
464
415
|
sizeof(AnyCType) == 8,
|
|
465
|
-
"The AnyCType
|
|
416
|
+
"The union AnyCType should have size == 64 bits, as this is assumed "
|
|
466
417
|
"by EffectControlLinearizer.");
|
|
467
418
|
|
|
468
419
|
class V8_EXPORT CFunction {
|
|
@@ -485,51 +436,23 @@ class V8_EXPORT CFunction {
|
|
|
485
436
|
|
|
486
437
|
enum class OverloadResolution { kImpossible, kAtRuntime, kAtCompileTime };
|
|
487
438
|
|
|
488
|
-
// Returns whether an overload between this and the given CFunction can
|
|
489
|
-
// be resolved at runtime by the RTTI available for the arguments or at
|
|
490
|
-
// compile time for functions with different number of arguments.
|
|
491
|
-
OverloadResolution GetOverloadResolution(const CFunction* other) {
|
|
492
|
-
// Runtime overload resolution can only deal with functions with the
|
|
493
|
-
// same number of arguments. Functions with different arity are handled
|
|
494
|
-
// by compile time overload resolution though.
|
|
495
|
-
if (ArgumentCount() != other->ArgumentCount()) {
|
|
496
|
-
return OverloadResolution::kAtCompileTime;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
// The functions can only differ by a single argument position.
|
|
500
|
-
int diff_index = -1;
|
|
501
|
-
for (unsigned int i = 0; i < ArgumentCount(); ++i) {
|
|
502
|
-
if (ArgumentInfo(i).GetSequenceType() !=
|
|
503
|
-
other->ArgumentInfo(i).GetSequenceType()) {
|
|
504
|
-
if (diff_index >= 0) {
|
|
505
|
-
return OverloadResolution::kImpossible;
|
|
506
|
-
}
|
|
507
|
-
diff_index = i;
|
|
508
|
-
|
|
509
|
-
// We only support overload resolution between sequence types.
|
|
510
|
-
if (ArgumentInfo(i).GetSequenceType() ==
|
|
511
|
-
CTypeInfo::SequenceType::kScalar ||
|
|
512
|
-
other->ArgumentInfo(i).GetSequenceType() ==
|
|
513
|
-
CTypeInfo::SequenceType::kScalar) {
|
|
514
|
-
return OverloadResolution::kImpossible;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
return OverloadResolution::kAtRuntime;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
439
|
template <typename F>
|
|
523
|
-
static CFunction Make(F* func
|
|
524
|
-
|
|
440
|
+
static CFunction Make(F* func,
|
|
441
|
+
CFunctionInfo::Int64Representation int64_rep =
|
|
442
|
+
CFunctionInfo::Int64Representation::kNumber) {
|
|
443
|
+
CFunction result = ArgUnwrap<F*>::Make(func, int64_rep);
|
|
444
|
+
result.GetInt64Representation();
|
|
445
|
+
return result;
|
|
525
446
|
}
|
|
526
447
|
|
|
527
448
|
// Provided for testing purposes.
|
|
528
449
|
template <typename R, typename... Args, typename R_Patch,
|
|
529
450
|
typename... Args_Patch>
|
|
530
451
|
static CFunction Make(R (*func)(Args...),
|
|
531
|
-
R_Patch (*patching_func)(Args_Patch...)
|
|
532
|
-
|
|
452
|
+
R_Patch (*patching_func)(Args_Patch...),
|
|
453
|
+
CFunctionInfo::Int64Representation int64_rep =
|
|
454
|
+
CFunctionInfo::Int64Representation::kNumber) {
|
|
455
|
+
CFunction c_func = ArgUnwrap<R (*)(Args...)>::Make(func, int64_rep);
|
|
533
456
|
static_assert(
|
|
534
457
|
sizeof...(Args_Patch) == sizeof...(Args),
|
|
535
458
|
"The patching function must have the same number of arguments.");
|
|
@@ -552,7 +475,9 @@ class V8_EXPORT CFunction {
|
|
|
552
475
|
template <typename R, typename... Args>
|
|
553
476
|
class ArgUnwrap<R (*)(Args...)> {
|
|
554
477
|
public:
|
|
555
|
-
static CFunction Make(R (*func)(Args...)
|
|
478
|
+
static CFunction Make(R (*func)(Args...),
|
|
479
|
+
CFunctionInfo::Int64Representation int64_rep =
|
|
480
|
+
CFunctionInfo::Int64Representation::kNumber);
|
|
556
481
|
};
|
|
557
482
|
};
|
|
558
483
|
|
|
@@ -568,35 +493,15 @@ struct FastApiCallbackOptions {
|
|
|
568
493
|
* returned instance may be filled with mock data.
|
|
569
494
|
*/
|
|
570
495
|
static FastApiCallbackOptions CreateForTesting(Isolate* isolate) {
|
|
571
|
-
return {
|
|
496
|
+
return {};
|
|
572
497
|
}
|
|
573
498
|
|
|
574
|
-
|
|
575
|
-
* If the callback wants to signal an error condition or to perform an
|
|
576
|
-
* allocation, it must set options.fallback to true and do an early return
|
|
577
|
-
* from the fast method. Then V8 checks the value of options.fallback and if
|
|
578
|
-
* it's true, falls back to executing the SlowCallback, which is capable of
|
|
579
|
-
* reporting the error (either by throwing a JS exception or logging to the
|
|
580
|
-
* console) or doing the allocation. It's the embedder's responsibility to
|
|
581
|
-
* ensure that the fast callback is idempotent up to the point where error and
|
|
582
|
-
* fallback conditions are checked, because otherwise executing the slow
|
|
583
|
-
* callback might produce visible side-effects twice.
|
|
584
|
-
*/
|
|
585
|
-
bool fallback;
|
|
499
|
+
v8::Isolate* isolate = nullptr;
|
|
586
500
|
|
|
587
501
|
/**
|
|
588
502
|
* The `data` passed to the FunctionTemplate constructor, or `undefined`.
|
|
589
|
-
* `data_ptr` allows for default constructing FastApiCallbackOptions.
|
|
590
|
-
*/
|
|
591
|
-
union {
|
|
592
|
-
uintptr_t data_ptr;
|
|
593
|
-
v8::Local<v8::Value> data;
|
|
594
|
-
};
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
* When called from WebAssembly, a view of the calling module's memory.
|
|
598
503
|
*/
|
|
599
|
-
|
|
504
|
+
v8::Local<v8::Value> data;
|
|
600
505
|
};
|
|
601
506
|
|
|
602
507
|
namespace internal {
|
|
@@ -660,9 +565,6 @@ struct TypeInfoHelper {
|
|
|
660
565
|
} \
|
|
661
566
|
\
|
|
662
567
|
static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::Enum; } \
|
|
663
|
-
static constexpr CTypeInfo::SequenceType SequenceType() { \
|
|
664
|
-
return CTypeInfo::SequenceType::kScalar; \
|
|
665
|
-
} \
|
|
666
568
|
};
|
|
667
569
|
|
|
668
570
|
template <CTypeInfo::Type type>
|
|
@@ -691,6 +593,7 @@ struct CTypeInfoTraits {};
|
|
|
691
593
|
V(void, kVoid) \
|
|
692
594
|
V(v8::Local<v8::Value>, kV8Value) \
|
|
693
595
|
V(v8::Local<v8::Object>, kV8Value) \
|
|
596
|
+
V(v8::Local<v8::Array>, kV8Value) \
|
|
694
597
|
V(AnyCType, kAny)
|
|
695
598
|
|
|
696
599
|
// ApiObject was a temporary solution to wrap the pointer to the v8::Value.
|
|
@@ -703,52 +606,8 @@ PRIMITIVE_C_TYPES(DEFINE_TYPE_INFO_TRAITS)
|
|
|
703
606
|
#undef PRIMITIVE_C_TYPES
|
|
704
607
|
#undef ALL_C_TYPES
|
|
705
608
|
|
|
706
|
-
#define SPECIALIZE_GET_TYPE_INFO_HELPER_FOR_TA(T, Enum) \
|
|
707
|
-
template <> \
|
|
708
|
-
struct TypeInfoHelper<const FastApiTypedArray<T>&> { \
|
|
709
|
-
static constexpr CTypeInfo::Flags Flags() { \
|
|
710
|
-
return CTypeInfo::Flags::kNone; \
|
|
711
|
-
} \
|
|
712
|
-
\
|
|
713
|
-
static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::Enum; } \
|
|
714
|
-
static constexpr CTypeInfo::SequenceType SequenceType() { \
|
|
715
|
-
return CTypeInfo::SequenceType::kIsTypedArray; \
|
|
716
|
-
} \
|
|
717
|
-
};
|
|
718
|
-
|
|
719
|
-
#define TYPED_ARRAY_C_TYPES(V) \
|
|
720
|
-
V(uint8_t, kUint8) \
|
|
721
|
-
V(int32_t, kInt32) \
|
|
722
|
-
V(uint32_t, kUint32) \
|
|
723
|
-
V(int64_t, kInt64) \
|
|
724
|
-
V(uint64_t, kUint64) \
|
|
725
|
-
V(float, kFloat32) \
|
|
726
|
-
V(double, kFloat64)
|
|
727
|
-
|
|
728
|
-
TYPED_ARRAY_C_TYPES(SPECIALIZE_GET_TYPE_INFO_HELPER_FOR_TA)
|
|
729
|
-
|
|
730
609
|
#undef TYPED_ARRAY_C_TYPES
|
|
731
610
|
|
|
732
|
-
template <>
|
|
733
|
-
struct TypeInfoHelper<v8::Local<v8::Array>> {
|
|
734
|
-
static constexpr CTypeInfo::Flags Flags() { return CTypeInfo::Flags::kNone; }
|
|
735
|
-
|
|
736
|
-
static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::kVoid; }
|
|
737
|
-
static constexpr CTypeInfo::SequenceType SequenceType() {
|
|
738
|
-
return CTypeInfo::SequenceType::kIsSequence;
|
|
739
|
-
}
|
|
740
|
-
};
|
|
741
|
-
|
|
742
|
-
template <>
|
|
743
|
-
struct TypeInfoHelper<v8::Local<v8::Uint32Array>> {
|
|
744
|
-
static constexpr CTypeInfo::Flags Flags() { return CTypeInfo::Flags::kNone; }
|
|
745
|
-
|
|
746
|
-
static constexpr CTypeInfo::Type Type() { return CTypeInfo::Type::kUint32; }
|
|
747
|
-
static constexpr CTypeInfo::SequenceType SequenceType() {
|
|
748
|
-
return CTypeInfo::SequenceType::kIsTypedArray;
|
|
749
|
-
}
|
|
750
|
-
};
|
|
751
|
-
|
|
752
611
|
template <>
|
|
753
612
|
struct TypeInfoHelper<FastApiCallbackOptions&> {
|
|
754
613
|
static constexpr CTypeInfo::Flags Flags() { return CTypeInfo::Flags::kNone; }
|
|
@@ -756,9 +615,6 @@ struct TypeInfoHelper<FastApiCallbackOptions&> {
|
|
|
756
615
|
static constexpr CTypeInfo::Type Type() {
|
|
757
616
|
return CTypeInfo::kCallbackOptionsType;
|
|
758
617
|
}
|
|
759
|
-
static constexpr CTypeInfo::SequenceType SequenceType() {
|
|
760
|
-
return CTypeInfo::SequenceType::kScalar;
|
|
761
|
-
}
|
|
762
618
|
};
|
|
763
619
|
|
|
764
620
|
template <>
|
|
@@ -768,9 +624,6 @@ struct TypeInfoHelper<const FastOneByteString&> {
|
|
|
768
624
|
static constexpr CTypeInfo::Type Type() {
|
|
769
625
|
return CTypeInfo::Type::kSeqOneByteString;
|
|
770
626
|
}
|
|
771
|
-
static constexpr CTypeInfo::SequenceType SequenceType() {
|
|
772
|
-
return CTypeInfo::SequenceType::kScalar;
|
|
773
|
-
}
|
|
774
627
|
};
|
|
775
628
|
|
|
776
629
|
#define STATIC_ASSERT_IMPLIES(COND, ASSERTION, MSG) \
|
|
@@ -787,14 +640,7 @@ class V8_EXPORT CTypeInfoBuilder {
|
|
|
787
640
|
constexpr CTypeInfo::Flags kFlags =
|
|
788
641
|
MergeFlags(internal::TypeInfoHelper<T>::Flags(), Flags...);
|
|
789
642
|
constexpr CTypeInfo::Type kType = internal::TypeInfoHelper<T>::Type();
|
|
790
|
-
constexpr CTypeInfo::SequenceType kSequenceType =
|
|
791
|
-
internal::TypeInfoHelper<T>::SequenceType();
|
|
792
643
|
|
|
793
|
-
STATIC_ASSERT_IMPLIES(
|
|
794
|
-
uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kAllowSharedBit),
|
|
795
|
-
(kSequenceType == CTypeInfo::SequenceType::kIsTypedArray ||
|
|
796
|
-
kSequenceType == CTypeInfo::SequenceType::kIsArrayBuffer),
|
|
797
|
-
"kAllowSharedBit is only allowed for TypedArrays and ArrayBuffers.");
|
|
798
644
|
STATIC_ASSERT_IMPLIES(
|
|
799
645
|
uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kEnforceRangeBit),
|
|
800
646
|
CTypeInfo::IsIntegralType(kType),
|
|
@@ -807,17 +653,9 @@ class V8_EXPORT CTypeInfoBuilder {
|
|
|
807
653
|
uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kIsRestrictedBit),
|
|
808
654
|
CTypeInfo::IsFloatingPointType(kType),
|
|
809
655
|
"kIsRestrictedBit is only allowed for floating point types.");
|
|
810
|
-
STATIC_ASSERT_IMPLIES(kSequenceType == CTypeInfo::SequenceType::kIsSequence,
|
|
811
|
-
kType == CTypeInfo::Type::kVoid,
|
|
812
|
-
"Sequences are only supported from void type.");
|
|
813
|
-
STATIC_ASSERT_IMPLIES(
|
|
814
|
-
kSequenceType == CTypeInfo::SequenceType::kIsTypedArray,
|
|
815
|
-
CTypeInfo::IsPrimitive(kType) || kType == CTypeInfo::Type::kVoid,
|
|
816
|
-
"TypedArrays are only supported from primitive types or void.");
|
|
817
656
|
|
|
818
657
|
// Return the same type with the merged flags.
|
|
819
|
-
return CTypeInfo(internal::TypeInfoHelper<T>::Type(),
|
|
820
|
-
internal::TypeInfoHelper<T>::SequenceType(), kFlags);
|
|
658
|
+
return CTypeInfo(internal::TypeInfoHelper<T>::Type(), kFlags);
|
|
821
659
|
}
|
|
822
660
|
|
|
823
661
|
private:
|
|
@@ -920,8 +758,14 @@ class CFunctionBuilder {
|
|
|
920
758
|
|
|
921
759
|
// static
|
|
922
760
|
template <typename R, typename... Args>
|
|
923
|
-
CFunction CFunction::ArgUnwrap<R (*)(Args...)>::Make(
|
|
924
|
-
|
|
761
|
+
CFunction CFunction::ArgUnwrap<R (*)(Args...)>::Make(
|
|
762
|
+
R (*func)(Args...), CFunctionInfo::Int64Representation int64_rep) {
|
|
763
|
+
if (int64_rep == CFunctionInfo::Int64Representation::kNumber) {
|
|
764
|
+
return internal::CFunctionBuilder().Fn(func).Build();
|
|
765
|
+
}
|
|
766
|
+
return internal::CFunctionBuilder()
|
|
767
|
+
.Fn(func)
|
|
768
|
+
.template Build<CFunctionInfo::Int64Representation::kBigInt>();
|
|
925
769
|
}
|
|
926
770
|
|
|
927
771
|
using CFunctionBuilder = internal::CFunctionBuilder;
|