node-darwin-x64 24.8.0 → 25.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +177 -1642
- package/README.md +2 -2
- package/bin/node +0 -0
- package/include/node/common.gypi +1 -13
- package/include/node/config.gypi +12 -8
- package/include/node/cppgc/allocation.h +3 -3
- package/include/node/cppgc/cross-thread-persistent.h +25 -29
- package/include/node/cppgc/internal/finalizer-trait.h +1 -1
- package/include/node/cppgc/internal/gc-info.h +3 -3
- package/include/node/cppgc/internal/logging.h +2 -2
- package/include/node/cppgc/internal/name-trait.h +1 -1
- package/include/node/cppgc/internal/pointer-policies.h +3 -3
- package/include/node/cppgc/member.h +10 -4
- package/include/node/cppgc/persistent.h +14 -15
- package/include/node/cppgc/platform.h +1 -1
- package/include/node/cppgc/trace-trait.h +1 -2
- package/include/node/cppgc/visitor.h +14 -9
- package/include/node/js_native_api.h +21 -1
- package/include/node/node.h +34 -78
- package/include/node/node_version.h +3 -3
- package/include/node/openssl/archs/BSD-x86/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/BSD-x86/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/BSD-x86/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/BSD-x86/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/BSD-x86/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/BSD-x86/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/BSD-x86/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/BSD-x86/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/BSD-x86/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/BSD-x86_64/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/BSD-x86_64/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/BSD-x86_64/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/BSD-x86_64/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/BSD-x86_64/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/BSD-x86_64/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/BSD-x86_64/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/BSD-x86_64/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/BSD-x86_64/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/VC-WIN32/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/VC-WIN32/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/VC-WIN32/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/VC-WIN32/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/VC-WIN32/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/VC-WIN32/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/VC-WIN32/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/VC-WIN32/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/VC-WIN32/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/VC-WIN64-ARM/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/VC-WIN64-ARM/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/VC-WIN64-ARM/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/VC-WIN64A/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/VC-WIN64A/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/VC-WIN64A/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/VC-WIN64A/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/VC-WIN64A/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/VC-WIN64A/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/VC-WIN64A/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/VC-WIN64A/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/VC-WIN64A/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/aix64-gcc-as/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/aix64-gcc-as/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/aix64-gcc-as/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/aix64-gcc-as/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/aix64-gcc-as/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/aix64-gcc-as/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/aix64-gcc-as/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/aix64-gcc-as/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/aix64-gcc-as/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/darwin-i386-cc/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/darwin-i386-cc/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/darwin-i386-cc/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/darwin-i386-cc/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/darwin-i386-cc/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/darwin-i386-cc/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/darwin-i386-cc/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/darwin-i386-cc/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/darwin-i386-cc/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/darwin64-arm64-cc/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/darwin64-arm64-cc/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/darwin64-arm64-cc/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/darwin64-arm64-cc/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/darwin64-arm64-cc/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/darwin64-arm64-cc/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/darwin64-arm64-cc/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/darwin64-arm64-cc/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/darwin64-arm64-cc/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/darwin64-x86_64-cc/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/darwin64-x86_64-cc/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/darwin64-x86_64-cc/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/darwin64-x86_64-cc/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/darwin64-x86_64-cc/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/darwin64-x86_64-cc/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/darwin64-x86_64-cc/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/darwin64-x86_64-cc/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/darwin64-x86_64-cc/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux-aarch64/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux-aarch64/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux-aarch64/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux-aarch64/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux-aarch64/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux-aarch64/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux-aarch64/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux-aarch64/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux-aarch64/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux-armv4/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux-armv4/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux-armv4/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux-armv4/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux-armv4/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux-armv4/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux-armv4/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux-armv4/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux-armv4/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux-elf/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux-elf/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux-elf/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux-elf/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux-elf/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux-elf/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux-elf/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux-elf/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux-elf/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux-ppc64le/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux-ppc64le/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux-ppc64le/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux-ppc64le/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux-ppc64le/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux-ppc64le/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux-ppc64le/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux-ppc64le/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux-ppc64le/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux-x86_64/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux-x86_64/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux-x86_64/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux-x86_64/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux-x86_64/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux-x86_64/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux-x86_64/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux-x86_64/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux-x86_64/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux32-s390x/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux32-s390x/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux32-s390x/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux32-s390x/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux32-s390x/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux32-s390x/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux32-s390x/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux32-s390x/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux32-s390x/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux64-loongarch64/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux64-loongarch64/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux64-loongarch64/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux64-mips64/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux64-mips64/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux64-mips64/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux64-mips64/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux64-mips64/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux64-mips64/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux64-mips64/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux64-mips64/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux64-mips64/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux64-riscv64/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux64-riscv64/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux64-riscv64/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux64-s390x/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux64-s390x/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux64-s390x/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux64-s390x/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux64-s390x/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux64-s390x/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/linux64-s390x/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/linux64-s390x/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/linux64-s390x/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/solaris-x86-gcc/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/solaris-x86-gcc/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/solaris-x86-gcc/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/solaris-x86-gcc/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/solaris-x86-gcc/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/solaris-x86-gcc/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/solaris-x86-gcc/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/solaris-x86-gcc/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/solaris-x86-gcc/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/solaris64-x86_64-gcc/asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/solaris64-x86_64-gcc/asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/solaris64-x86_64-gcc/asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/solaris64-x86_64-gcc/asm_avx2/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/solaris64-x86_64-gcc/asm_avx2/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/solaris64-x86_64-gcc/asm_avx2/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/archs/solaris64-x86_64-gcc/no-asm/crypto/buildinf.h +1 -1
- package/include/node/openssl/archs/solaris64-x86_64-gcc/no-asm/include/openssl/crypto.h +4 -4
- package/include/node/openssl/archs/solaris64-x86_64-gcc/no-asm/include/openssl/opensslv.h +8 -13
- package/include/node/openssl/proverr.h +1 -0
- package/include/node/openssl/self_test.h +1 -0
- package/include/node/v8-array-buffer.h +1 -1
- package/include/node/v8-callbacks.h +3 -4
- package/include/node/v8-context.h +15 -5
- package/include/node/v8-data.h +5 -0
- package/include/node/v8-debug.h +11 -0
- package/include/node/v8-function-callback.h +26 -26
- package/include/node/v8-internal.h +136 -36
- package/include/node/v8-isolate.h +75 -16
- package/include/node/v8-json.h +8 -1
- package/include/node/v8-local-handle.h +112 -13
- package/include/node/v8-maybe.h +34 -10
- package/include/node/v8-memory-span.h +9 -4
- package/include/node/v8-message.h +3 -0
- package/include/node/v8-object.h +87 -24
- package/include/node/v8-persistent-handle.h +4 -4
- package/include/node/v8-platform.h +92 -28
- package/include/node/v8-primitive.h +22 -9
- package/include/node/v8-profiler.h +4 -0
- package/include/node/v8-sandbox.h +16 -0
- package/include/node/v8-source-location.h +19 -26
- package/include/node/v8-template.h +37 -15
- package/include/node/v8-traced-handle.h +6 -6
- package/include/node/v8-unwinder.h +13 -0
- package/include/node/v8-version.h +4 -4
- package/include/node/v8config.h +65 -5
- package/package.json +5 -1
- package/share/doc/node/gdbinit +221 -4
- package/share/man/man1/node.1 +21 -4
|
@@ -154,6 +154,10 @@ class V8_EXPORT ResourceConstraints {
|
|
|
154
154
|
initial_young_generation_size_ = initial_size;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
uint64_t physical_memory_size_in_bytes() const {
|
|
158
|
+
return physical_memory_size_;
|
|
159
|
+
}
|
|
160
|
+
|
|
157
161
|
private:
|
|
158
162
|
static constexpr size_t kMB = 1048576u;
|
|
159
163
|
size_t code_range_size_ = 0;
|
|
@@ -161,6 +165,7 @@ class V8_EXPORT ResourceConstraints {
|
|
|
161
165
|
size_t max_young_generation_size_ = 0;
|
|
162
166
|
size_t initial_old_generation_size_ = 0;
|
|
163
167
|
size_t initial_young_generation_size_ = 0;
|
|
168
|
+
uint64_t physical_memory_size_ = 0;
|
|
164
169
|
uint32_t* stack_limit_ = nullptr;
|
|
165
170
|
};
|
|
166
171
|
|
|
@@ -253,6 +258,17 @@ class V8_EXPORT IsolateGroup {
|
|
|
253
258
|
return !operator==(other);
|
|
254
259
|
}
|
|
255
260
|
|
|
261
|
+
#ifdef V8_ENABLE_SANDBOX
|
|
262
|
+
/**
|
|
263
|
+
* Whether the sandbox of the isolate group contains a given pointer.
|
|
264
|
+
* Will always return true if the sandbox is not enabled.
|
|
265
|
+
*/
|
|
266
|
+
bool SandboxContains(void* pointer) const;
|
|
267
|
+
VirtualAddressSpace* GetSandboxAddressSpace();
|
|
268
|
+
#else
|
|
269
|
+
V8_INLINE bool SandboxContains(void* pointer) const { return true; }
|
|
270
|
+
#endif
|
|
271
|
+
|
|
256
272
|
private:
|
|
257
273
|
friend class Isolate;
|
|
258
274
|
friend class ArrayBuffer::Allocator;
|
|
@@ -345,7 +361,9 @@ class V8_EXPORT Isolate {
|
|
|
345
361
|
* for wrapped API objects and are used by the fast C API
|
|
346
362
|
* (for details see v8-fast-api-calls.h).
|
|
347
363
|
*/
|
|
364
|
+
V8_DEPRECATE_SOON("This field is unused.")
|
|
348
365
|
int embedder_wrapper_type_index = -1;
|
|
366
|
+
V8_DEPRECATE_SOON("This field is unused.")
|
|
349
367
|
int embedder_wrapper_object_index = -1;
|
|
350
368
|
|
|
351
369
|
/**
|
|
@@ -557,7 +575,8 @@ class V8_EXPORT Isolate {
|
|
|
557
575
|
kBreakIteratorTypeWord = 88,
|
|
558
576
|
kBreakIteratorTypeLine = 89,
|
|
559
577
|
kInvalidatedArrayBufferDetachingProtector = 90,
|
|
560
|
-
kInvalidatedArrayConstructorProtector
|
|
578
|
+
kInvalidatedArrayConstructorProtector V8_DEPRECATE_SOON(
|
|
579
|
+
"The ArrayConstructorProtector has been removed") = 91,
|
|
561
580
|
kInvalidatedArrayIteratorLookupChainProtector = 92,
|
|
562
581
|
kInvalidatedArraySpeciesLookupChainProtector = 93,
|
|
563
582
|
kInvalidatedIsConcatSpreadableLookupChainProtector = 94,
|
|
@@ -575,8 +594,8 @@ class V8_EXPORT Isolate {
|
|
|
575
594
|
kWasmSimdOpcodes = 106,
|
|
576
595
|
kVarRedeclaredCatchBinding = 107,
|
|
577
596
|
kWasmRefTypes = 108,
|
|
578
|
-
|
|
579
|
-
|
|
597
|
+
kWasmBulkMemory = 109,
|
|
598
|
+
kWasmMultiValue = 110,
|
|
580
599
|
kWasmExceptionHandling = 111,
|
|
581
600
|
kInvalidatedMegaDOMProtector = 112,
|
|
582
601
|
kFunctionPrototypeArguments = 113,
|
|
@@ -634,6 +653,21 @@ class V8_EXPORT Isolate {
|
|
|
634
653
|
kFloat16Array = 165,
|
|
635
654
|
kExplicitResourceManagement = 166,
|
|
636
655
|
kWasmBranchHinting = 167,
|
|
656
|
+
kWasmMutableGlobals = 168,
|
|
657
|
+
kUint8ArrayToFromBase64AndHex = 169,
|
|
658
|
+
kAtomicsPause = 170,
|
|
659
|
+
kTopLevelAwait = 171,
|
|
660
|
+
kLogicalAssignment = 172,
|
|
661
|
+
kNullishCoalescing = 173,
|
|
662
|
+
kInvalidatedNoDateTimeConfigurationChangeProtector = 174,
|
|
663
|
+
kWasmNonTrappingFloatToInt = 175,
|
|
664
|
+
kWasmSignExtensionOps = 176,
|
|
665
|
+
kRegExpCompile = 177,
|
|
666
|
+
kRegExpStaticProperties = 178,
|
|
667
|
+
kRegExpStaticPropertiesWithLastMatch = 179,
|
|
668
|
+
kWithStatement = 180,
|
|
669
|
+
kHtmlWrapperMethods = 181,
|
|
670
|
+
kWasmCustomDescriptors = 182,
|
|
637
671
|
|
|
638
672
|
// If you add new values here, you'll also need to update Chromium's:
|
|
639
673
|
// web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to
|
|
@@ -937,14 +971,31 @@ class V8_EXPORT Isolate {
|
|
|
937
971
|
* Returns the value that was set or restored by
|
|
938
972
|
* SetContinuationPreservedEmbedderData(), if any.
|
|
939
973
|
*/
|
|
974
|
+
V8_DEPRECATED("Use GetContinuationPreservedEmbedderDataV2 instead")
|
|
940
975
|
Local<Value> GetContinuationPreservedEmbedderData();
|
|
941
976
|
|
|
942
977
|
/**
|
|
943
978
|
* Sets a value that will be stored on continuations and reset while the
|
|
944
979
|
* continuation runs.
|
|
945
980
|
*/
|
|
981
|
+
V8_DEPRECATED("Use SetContinuationPreservedEmbedderDataV2 instead")
|
|
946
982
|
void SetContinuationPreservedEmbedderData(Local<Value> data);
|
|
947
983
|
|
|
984
|
+
/**
|
|
985
|
+
* Returns the value set by `SetContinuationPreservedEmbedderDataV2()` or
|
|
986
|
+
* restored during microtask execution for the currently running continuation,
|
|
987
|
+
* if any. Returns undefiend if no continuation preserved embedder data was
|
|
988
|
+
* set.
|
|
989
|
+
*/
|
|
990
|
+
Local<Data> GetContinuationPreservedEmbedderDataV2();
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Sets a value that will be stored on continuations and restored while the
|
|
994
|
+
* continuation runs. If `data` is empty, the continuation preserved embedder
|
|
995
|
+
* data is set to undefined.
|
|
996
|
+
*/
|
|
997
|
+
void SetContinuationPreservedEmbedderDataV2(Local<Data> data);
|
|
998
|
+
|
|
948
999
|
/**
|
|
949
1000
|
* Get statistics about the heap memory usage.
|
|
950
1001
|
*/
|
|
@@ -1660,21 +1711,14 @@ class V8_EXPORT Isolate {
|
|
|
1660
1711
|
void SetWasmImportedStringsEnabledCallback(
|
|
1661
1712
|
WasmImportedStringsEnabledCallback callback);
|
|
1662
1713
|
|
|
1714
|
+
void SetWasmCustomDescriptorsEnabledCallback(
|
|
1715
|
+
WasmCustomDescriptorsEnabledCallback callback);
|
|
1716
|
+
|
|
1663
1717
|
void SetSharedArrayBufferConstructorEnabledCallback(
|
|
1664
1718
|
SharedArrayBufferConstructorEnabledCallback callback);
|
|
1665
1719
|
|
|
1666
1720
|
void SetWasmJSPIEnabledCallback(WasmJSPIEnabledCallback callback);
|
|
1667
1721
|
|
|
1668
|
-
/**
|
|
1669
|
-
* Register callback to control whether compile hints magic comments are
|
|
1670
|
-
* enabled.
|
|
1671
|
-
*/
|
|
1672
|
-
V8_DEPRECATED(
|
|
1673
|
-
"Will be removed, use ScriptCompiler::CompileOptions for enabling the "
|
|
1674
|
-
"compile hints magic comments")
|
|
1675
|
-
void SetJavaScriptCompileHintsMagicEnabledCallback(
|
|
1676
|
-
JavaScriptCompileHintsMagicEnabledCallback callback);
|
|
1677
|
-
|
|
1678
1722
|
/**
|
|
1679
1723
|
* This function can be called by the embedder to signal V8 that the dynamic
|
|
1680
1724
|
* enabling of features has finished. V8 can now set up dynamically added
|
|
@@ -1697,7 +1741,7 @@ class V8_EXPORT Isolate {
|
|
|
1697
1741
|
* If data is specified, it will be passed to the callback when it is called.
|
|
1698
1742
|
* Otherwise, the exception object will be passed to the callback instead.
|
|
1699
1743
|
*/
|
|
1700
|
-
bool AddMessageListener(MessageCallback
|
|
1744
|
+
bool AddMessageListener(MessageCallback callback,
|
|
1701
1745
|
Local<Value> data = Local<Value>());
|
|
1702
1746
|
|
|
1703
1747
|
/**
|
|
@@ -1711,14 +1755,14 @@ class V8_EXPORT Isolate {
|
|
|
1711
1755
|
*
|
|
1712
1756
|
* A listener can listen for particular error levels by providing a mask.
|
|
1713
1757
|
*/
|
|
1714
|
-
bool AddMessageListenerWithErrorLevel(MessageCallback
|
|
1758
|
+
bool AddMessageListenerWithErrorLevel(MessageCallback callback,
|
|
1715
1759
|
int message_levels,
|
|
1716
1760
|
Local<Value> data = Local<Value>());
|
|
1717
1761
|
|
|
1718
1762
|
/**
|
|
1719
1763
|
* Remove all message listeners from the specified callback function.
|
|
1720
1764
|
*/
|
|
1721
|
-
void RemoveMessageListeners(MessageCallback
|
|
1765
|
+
void RemoveMessageListeners(MessageCallback callback);
|
|
1722
1766
|
|
|
1723
1767
|
/** Callback function for reporting failed access checks.*/
|
|
1724
1768
|
void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback);
|
|
@@ -1789,6 +1833,21 @@ class V8_EXPORT Isolate {
|
|
|
1789
1833
|
*/
|
|
1790
1834
|
std::string GetDefaultLocale();
|
|
1791
1835
|
|
|
1836
|
+
/**
|
|
1837
|
+
* Returns a canonical and case-regularized form of locale if Intl support is
|
|
1838
|
+
* enabled. If the locale is not syntactically well-formed, throws a
|
|
1839
|
+
* RangeError.
|
|
1840
|
+
*
|
|
1841
|
+
* If Intl support is not enabled, returns Nothing<std::string>().
|
|
1842
|
+
*
|
|
1843
|
+
* Corresponds to the combination of the abstract operations
|
|
1844
|
+
* IsStructurallyValidLanguageTag and CanonicalizeUnicodeLocaleId. See:
|
|
1845
|
+
* https://tc39.es/ecma402/#sec-isstructurallyvalidlanguagetag
|
|
1846
|
+
* https://tc39.es/ecma402/#sec-canonicalizeunicodelocaleid
|
|
1847
|
+
*/
|
|
1848
|
+
V8_WARN_UNUSED_RESULT Maybe<std::string>
|
|
1849
|
+
ValidateAndCanonicalizeUnicodeLocaleId(std::string_view locale);
|
|
1850
|
+
|
|
1792
1851
|
/**
|
|
1793
1852
|
* Returns the hash seed for that isolate, for testing purposes.
|
|
1794
1853
|
*/
|
package/include/node/v8-json.h
CHANGED
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
#ifndef INCLUDE_V8_JSON_H_
|
|
6
6
|
#define INCLUDE_V8_JSON_H_
|
|
7
7
|
|
|
8
|
+
#include <optional>
|
|
9
|
+
|
|
8
10
|
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
|
11
|
+
#include "v8-message.h" // NOLINT(build/include_directory)
|
|
9
12
|
#include "v8config.h" // NOLINT(build/include_directory)
|
|
10
13
|
|
|
11
14
|
namespace v8 {
|
|
@@ -25,10 +28,14 @@ class V8_EXPORT JSON {
|
|
|
25
28
|
*
|
|
26
29
|
* \param the context in which to parse and create the value.
|
|
27
30
|
* \param json_string The string to parse.
|
|
31
|
+
* \param origin Optional script origin to use for error reporting.
|
|
32
|
+
* If not provided, error reporting will use default origin options
|
|
33
|
+
* or attempt to infer origin from the current stack.
|
|
28
34
|
* \return The corresponding value if successfully parsed.
|
|
29
35
|
*/
|
|
30
36
|
static V8_WARN_UNUSED_RESULT MaybeLocal<Value> Parse(
|
|
31
|
-
Local<Context> context, Local<String> json_string
|
|
37
|
+
Local<Context> context, Local<String> json_string,
|
|
38
|
+
std::optional<ScriptOrigin> origin = std::nullopt);
|
|
32
39
|
|
|
33
40
|
/**
|
|
34
41
|
* Tries to stringify the JSON-serializable object |json_object| and returns
|
|
@@ -42,6 +42,7 @@ class BasicTracedReference;
|
|
|
42
42
|
template <class F>
|
|
43
43
|
class TracedReference;
|
|
44
44
|
|
|
45
|
+
class ArrayBuffer;
|
|
45
46
|
class Boolean;
|
|
46
47
|
class Context;
|
|
47
48
|
class EscapableHandleScope;
|
|
@@ -62,6 +63,8 @@ template <class F>
|
|
|
62
63
|
class Traced;
|
|
63
64
|
class TypecheckWitness;
|
|
64
65
|
class Utils;
|
|
66
|
+
class Uint32;
|
|
67
|
+
class Value;
|
|
65
68
|
|
|
66
69
|
namespace debug {
|
|
67
70
|
class ConsoleCallArguments;
|
|
@@ -78,6 +81,25 @@ class SamplingHeapProfiler;
|
|
|
78
81
|
namespace api_internal {
|
|
79
82
|
// Called when ToLocalChecked is called on an empty Local.
|
|
80
83
|
V8_EXPORT void ToLocalEmpty();
|
|
84
|
+
|
|
85
|
+
#ifdef V8_ENABLE_CHECKS
|
|
86
|
+
template <typename T, typename V = Value>
|
|
87
|
+
void TypeCheckLocal(V* value) {
|
|
88
|
+
// If `T` does not provide a `Cast` method we cannot check anything.
|
|
89
|
+
if constexpr (requires { T::Cast(value); }) {
|
|
90
|
+
// TODO(419454582): Remove all these exceptions.
|
|
91
|
+
if (std::is_same_v<Array, T> && value->IsArgumentsObject()) return;
|
|
92
|
+
if (std::is_same_v<ArrayBuffer, T> && value->IsSharedArrayBuffer()) return;
|
|
93
|
+
if (std::is_same_v<Object, T> && value->IsNull()) return;
|
|
94
|
+
if (std::is_same_v<Object, T> && value->IsString()) return;
|
|
95
|
+
if (std::is_same_v<Object, T> && value->IsUndefined()) return;
|
|
96
|
+
if (std::is_same_v<Uint32, T> && value->IsInt32()) return;
|
|
97
|
+
if (std::is_same_v<Object, T> && value->IsNumber()) return;
|
|
98
|
+
// Execute the actual check (part of the cast).
|
|
99
|
+
T::Cast(value);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
#endif
|
|
81
103
|
} // namespace api_internal
|
|
82
104
|
|
|
83
105
|
/**
|
|
@@ -96,18 +118,16 @@ V8_EXPORT void ToLocalEmpty();
|
|
|
96
118
|
*/
|
|
97
119
|
class V8_EXPORT V8_NODISCARD HandleScope {
|
|
98
120
|
public:
|
|
99
|
-
explicit HandleScope(Isolate* isolate);
|
|
121
|
+
V8_INLINE explicit HandleScope(Isolate* isolate);
|
|
100
122
|
|
|
101
|
-
~HandleScope();
|
|
123
|
+
V8_INLINE ~HandleScope();
|
|
102
124
|
|
|
103
125
|
/**
|
|
104
126
|
* Counts the number of allocated handles.
|
|
105
127
|
*/
|
|
106
128
|
static int NumberOfHandles(Isolate* isolate);
|
|
107
129
|
|
|
108
|
-
V8_INLINE Isolate* GetIsolate() const {
|
|
109
|
-
return reinterpret_cast<Isolate*>(i_isolate_);
|
|
110
|
-
}
|
|
130
|
+
V8_INLINE Isolate* GetIsolate() const { return isolate_; }
|
|
111
131
|
|
|
112
132
|
HandleScope(const HandleScope&) = delete;
|
|
113
133
|
void operator=(const HandleScope&) = delete;
|
|
@@ -118,12 +138,29 @@ class V8_EXPORT V8_NODISCARD HandleScope {
|
|
|
118
138
|
protected:
|
|
119
139
|
V8_INLINE HandleScope() = default;
|
|
120
140
|
|
|
121
|
-
void Initialize(Isolate* isolate);
|
|
141
|
+
V8_INLINE void Initialize(Isolate* isolate);
|
|
122
142
|
|
|
123
|
-
static internal::Address* CreateHandle(
|
|
124
|
-
|
|
143
|
+
V8_INLINE static internal::Address* CreateHandle(Isolate* i_isolate,
|
|
144
|
+
internal::Address value);
|
|
125
145
|
|
|
126
146
|
private:
|
|
147
|
+
// Extend the HandleScope making room for more handles. Not inlined.
|
|
148
|
+
static internal::Address* Extend(Isolate* isolate);
|
|
149
|
+
// Delete any extensions in HandleScope destructor. Not called unless there
|
|
150
|
+
// are extensions. Not inlined.
|
|
151
|
+
void DeleteExtensions(Isolate* isolate);
|
|
152
|
+
|
|
153
|
+
#ifdef V8_ENABLE_CHECKS
|
|
154
|
+
// Non-inlined asserts on HandleScope constructor.
|
|
155
|
+
void DoInitializeAsserts(Isolate* isolate);
|
|
156
|
+
// Non-inlined assert for HandleScope destructor.
|
|
157
|
+
void AssertScopeLevelsMatch();
|
|
158
|
+
// Non-inlined asserts for HandleScope destructor. Also zaps the slots
|
|
159
|
+
// if this is enabled.
|
|
160
|
+
void DoCloseScopeAsserts(int before, internal::Address* limit,
|
|
161
|
+
internal::HandleScopeData* current);
|
|
162
|
+
#endif
|
|
163
|
+
|
|
127
164
|
// Declaring operator new and delete as deleted is not spec compliant.
|
|
128
165
|
// Therefore declare them private instead to disable dynamic alloc
|
|
129
166
|
void* operator new(size_t size);
|
|
@@ -131,7 +168,7 @@ class V8_EXPORT V8_NODISCARD HandleScope {
|
|
|
131
168
|
void operator delete(void*, size_t);
|
|
132
169
|
void operator delete[](void*, size_t);
|
|
133
170
|
|
|
134
|
-
|
|
171
|
+
Isolate* isolate_;
|
|
135
172
|
internal::Address* prev_next_;
|
|
136
173
|
internal::Address* prev_limit_;
|
|
137
174
|
#ifdef V8_ENABLE_CHECKS
|
|
@@ -148,6 +185,61 @@ class V8_EXPORT V8_NODISCARD HandleScope {
|
|
|
148
185
|
friend class Context;
|
|
149
186
|
};
|
|
150
187
|
|
|
188
|
+
HandleScope::HandleScope(Isolate* v8_isolate) { Initialize(v8_isolate); }
|
|
189
|
+
|
|
190
|
+
void HandleScope::Initialize(Isolate* v8_isolate) {
|
|
191
|
+
using I = internal::Internals;
|
|
192
|
+
internal::HandleScopeData* current = I::GetHandleScopeData(v8_isolate);
|
|
193
|
+
isolate_ = v8_isolate;
|
|
194
|
+
prev_next_ = current->next;
|
|
195
|
+
prev_limit_ = current->limit;
|
|
196
|
+
current->level++;
|
|
197
|
+
#ifdef V8_ENABLE_CHECKS
|
|
198
|
+
DoInitializeAsserts(v8_isolate);
|
|
199
|
+
scope_level_ = current->level;
|
|
200
|
+
#endif
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
HandleScope::~HandleScope() {
|
|
204
|
+
if (V8_UNLIKELY(isolate_ == nullptr)) return;
|
|
205
|
+
#ifdef V8_ENABLE_CHECKS
|
|
206
|
+
AssertScopeLevelsMatch();
|
|
207
|
+
int handle_count_before = NumberOfHandles(isolate_);
|
|
208
|
+
#endif
|
|
209
|
+
|
|
210
|
+
using I = internal::Internals;
|
|
211
|
+
internal::HandleScopeData* current = I::GetHandleScopeData(isolate_);
|
|
212
|
+
std::swap(current->next, prev_next_);
|
|
213
|
+
current->level--;
|
|
214
|
+
internal::Address* limit = prev_next_;
|
|
215
|
+
if (V8_UNLIKELY(current->limit != prev_limit_)) {
|
|
216
|
+
current->limit = prev_limit_;
|
|
217
|
+
limit = prev_limit_;
|
|
218
|
+
DeleteExtensions(isolate_);
|
|
219
|
+
}
|
|
220
|
+
#ifdef V8_ENABLE_CHECKS
|
|
221
|
+
DoCloseScopeAsserts(handle_count_before, limit, current);
|
|
222
|
+
#else
|
|
223
|
+
(void)limit; // Avoid unused variable warning.
|
|
224
|
+
#endif
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
internal::Address* HandleScope::CreateHandle(Isolate* v8_isolate,
|
|
228
|
+
internal::Address value) {
|
|
229
|
+
using I = internal::Internals;
|
|
230
|
+
internal::HandleScopeData* data = I::GetHandleScopeData(v8_isolate);
|
|
231
|
+
internal::Address* result = data->next;
|
|
232
|
+
if (V8_UNLIKELY(result == data->limit)) {
|
|
233
|
+
result = Extend(v8_isolate);
|
|
234
|
+
}
|
|
235
|
+
// Update the current next field, set the value in the created handle,
|
|
236
|
+
// and return the result.
|
|
237
|
+
data->next = reinterpret_cast<internal::Address*>(
|
|
238
|
+
reinterpret_cast<internal::Address>(result) + sizeof(internal::Address));
|
|
239
|
+
*result = value;
|
|
240
|
+
return result;
|
|
241
|
+
}
|
|
242
|
+
|
|
151
243
|
/**
|
|
152
244
|
* A base class for local handles.
|
|
153
245
|
* Its implementation depends on whether direct handle support is enabled.
|
|
@@ -164,7 +256,11 @@ class LocalBase : public api_internal::DirectHandleBase {
|
|
|
164
256
|
|
|
165
257
|
V8_INLINE LocalBase() = default;
|
|
166
258
|
|
|
167
|
-
V8_INLINE explicit LocalBase(internal::Address ptr) : DirectHandleBase(ptr) {
|
|
259
|
+
V8_INLINE explicit LocalBase(internal::Address ptr) : DirectHandleBase(ptr) {
|
|
260
|
+
#ifdef V8_ENABLE_CHECKS
|
|
261
|
+
if (!IsEmpty()) api_internal::TypeCheckLocal<T>(value<Value>());
|
|
262
|
+
#endif
|
|
263
|
+
}
|
|
168
264
|
|
|
169
265
|
template <typename S>
|
|
170
266
|
V8_INLINE LocalBase(const LocalBase<S>& other) : DirectHandleBase(other) {}
|
|
@@ -200,14 +296,17 @@ class LocalBase : public api_internal::IndirectHandleBase {
|
|
|
200
296
|
V8_INLINE LocalBase() = default;
|
|
201
297
|
|
|
202
298
|
V8_INLINE explicit LocalBase(internal::Address* location)
|
|
203
|
-
: IndirectHandleBase(location) {
|
|
299
|
+
: IndirectHandleBase(location) {
|
|
300
|
+
#ifdef V8_ENABLE_CHECKS
|
|
301
|
+
if (!IsEmpty()) api_internal::TypeCheckLocal<T>(value<Value>());
|
|
302
|
+
#endif
|
|
303
|
+
}
|
|
204
304
|
|
|
205
305
|
template <typename S>
|
|
206
306
|
V8_INLINE LocalBase(const LocalBase<S>& other) : IndirectHandleBase(other) {}
|
|
207
307
|
|
|
208
308
|
V8_INLINE static LocalBase<T> New(Isolate* isolate, internal::Address value) {
|
|
209
|
-
return LocalBase(HandleScope::CreateHandle(
|
|
210
|
-
reinterpret_cast<internal::Isolate*>(isolate), value));
|
|
309
|
+
return LocalBase(HandleScope::CreateHandle(isolate, value));
|
|
211
310
|
}
|
|
212
311
|
|
|
213
312
|
V8_INLINE static LocalBase<T> New(Isolate* isolate, T* that) {
|
package/include/node/v8-maybe.h
CHANGED
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
|
|
15
15
|
namespace v8 {
|
|
16
16
|
|
|
17
|
+
namespace internal {
|
|
18
|
+
struct NullMaybeType {};
|
|
19
|
+
|
|
20
|
+
constexpr NullMaybeType kNullMaybe;
|
|
21
|
+
} // namespace internal
|
|
22
|
+
|
|
17
23
|
namespace api_internal {
|
|
18
24
|
// Called when ToChecked is called on an empty Maybe.
|
|
19
25
|
V8_EXPORT void FromJustIsNothing();
|
|
@@ -32,9 +38,19 @@ V8_EXPORT void FromJustIsNothing();
|
|
|
32
38
|
template <class T>
|
|
33
39
|
class Maybe : public cppgc::internal::ConditionalStackAllocatedBase<T> {
|
|
34
40
|
public:
|
|
41
|
+
constexpr Maybe() = default;
|
|
42
|
+
|
|
43
|
+
V8_INLINE Maybe(internal::NullMaybeType) {}
|
|
44
|
+
|
|
35
45
|
V8_INLINE bool IsNothing() const { return !has_value_; }
|
|
36
46
|
V8_INLINE bool IsJust() const { return has_value_; }
|
|
37
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Same as IsNothing(). It's useful for unified handling of empty states
|
|
50
|
+
* with v8::MaybeLocal<T>.
|
|
51
|
+
*/
|
|
52
|
+
V8_INLINE bool IsEmpty() const { return IsNothing(); }
|
|
53
|
+
|
|
38
54
|
/**
|
|
39
55
|
* An alias for |FromJust|. Will crash if the Maybe<> is nothing.
|
|
40
56
|
*/
|
|
@@ -57,6 +73,16 @@ class Maybe : public cppgc::internal::ConditionalStackAllocatedBase<T> {
|
|
|
57
73
|
return IsJust();
|
|
58
74
|
}
|
|
59
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Converts this Maybe<> to a value of type T, moving out of it. If this
|
|
78
|
+
* Maybe<> is nothing (empty), |false| is returned and |out| is left
|
|
79
|
+
* untouched.
|
|
80
|
+
*/
|
|
81
|
+
V8_WARN_UNUSED_RESULT V8_INLINE bool MoveTo(T* out) && {
|
|
82
|
+
if (V8_LIKELY(IsJust())) *out = std::move(value_);
|
|
83
|
+
return IsJust();
|
|
84
|
+
}
|
|
85
|
+
|
|
60
86
|
/**
|
|
61
87
|
* Converts this Maybe<> to a value of type T. If this Maybe<> is
|
|
62
88
|
* nothing (empty), V8 will crash the process.
|
|
@@ -93,15 +119,12 @@ class Maybe : public cppgc::internal::ConditionalStackAllocatedBase<T> {
|
|
|
93
119
|
}
|
|
94
120
|
|
|
95
121
|
private:
|
|
96
|
-
Maybe() : has_value_(false) {}
|
|
97
122
|
explicit Maybe(const T& t) : has_value_(true), value_(t) {}
|
|
98
123
|
explicit Maybe(T&& t) : has_value_(true), value_(std::move(t)) {}
|
|
99
124
|
|
|
100
|
-
bool has_value_;
|
|
125
|
+
bool has_value_ = false;
|
|
101
126
|
T value_;
|
|
102
127
|
|
|
103
|
-
template <class U>
|
|
104
|
-
friend Maybe<U> Nothing();
|
|
105
128
|
template <class U>
|
|
106
129
|
friend Maybe<U> Just(const U& u);
|
|
107
130
|
template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
|
|
@@ -109,8 +132,8 @@ class Maybe : public cppgc::internal::ConditionalStackAllocatedBase<T> {
|
|
|
109
132
|
};
|
|
110
133
|
|
|
111
134
|
template <class T>
|
|
112
|
-
inline Maybe<T> Nothing() {
|
|
113
|
-
return
|
|
135
|
+
inline constexpr Maybe<T> Nothing() {
|
|
136
|
+
return {};
|
|
114
137
|
}
|
|
115
138
|
|
|
116
139
|
template <class T>
|
|
@@ -130,7 +153,11 @@ inline Maybe<T> Just(T&& t) {
|
|
|
130
153
|
template <>
|
|
131
154
|
class Maybe<void> {
|
|
132
155
|
public:
|
|
156
|
+
constexpr Maybe() = default;
|
|
157
|
+
constexpr Maybe(internal::NullMaybeType) {}
|
|
158
|
+
|
|
133
159
|
V8_INLINE bool IsNothing() const { return !is_valid_; }
|
|
160
|
+
V8_INLINE bool IsEmpty() const { return IsNothing(); }
|
|
134
161
|
V8_INLINE bool IsJust() const { return is_valid_; }
|
|
135
162
|
|
|
136
163
|
V8_INLINE bool operator==(const Maybe& other) const {
|
|
@@ -144,13 +171,10 @@ class Maybe<void> {
|
|
|
144
171
|
private:
|
|
145
172
|
struct JustTag {};
|
|
146
173
|
|
|
147
|
-
Maybe() : is_valid_(false) {}
|
|
148
174
|
explicit Maybe(JustTag) : is_valid_(true) {}
|
|
149
175
|
|
|
150
|
-
bool is_valid_;
|
|
176
|
+
bool is_valid_ = false;
|
|
151
177
|
|
|
152
|
-
template <class U>
|
|
153
|
-
friend Maybe<U> Nothing();
|
|
154
178
|
friend Maybe<void> JustVoid();
|
|
155
179
|
};
|
|
156
180
|
|
|
@@ -87,15 +87,20 @@ class V8_EXPORT MemorySpan {
|
|
|
87
87
|
static constexpr bool is_compatible_iterator_v =
|
|
88
88
|
is_compatible_iterator<It>::value;
|
|
89
89
|
|
|
90
|
+
// SFINAE-compatible wrapper for `std::to_address()`.
|
|
91
|
+
// Adapted from "base/types/to_address.h" in chromium.
|
|
90
92
|
template <typename U>
|
|
93
|
+
requires(!std::is_function_v<U>)
|
|
91
94
|
[[nodiscard]] static constexpr U* to_address(U* p) noexcept {
|
|
92
95
|
return p;
|
|
93
96
|
}
|
|
94
97
|
|
|
95
|
-
template <typename It
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
template <typename It>
|
|
99
|
+
requires(
|
|
100
|
+
requires(const It& it) { std::pointer_traits<It>::to_address(it); } ||
|
|
101
|
+
requires(const It& it) { it.operator->(); })
|
|
102
|
+
[[nodiscard]] static constexpr auto to_address(const It& it) noexcept {
|
|
103
|
+
return std::to_address(it);
|
|
99
104
|
}
|
|
100
105
|
|
|
101
106
|
public:
|
|
@@ -111,6 +111,9 @@ class V8_EXPORT Message {
|
|
|
111
111
|
/**
|
|
112
112
|
* Return the isolate to which the Message belongs.
|
|
113
113
|
*/
|
|
114
|
+
V8_DEPRECATED(
|
|
115
|
+
"Use Isolate::GetCurrent() instead, which is guaranteed to return the "
|
|
116
|
+
"same isolate since https://crrev.com/c/6458560.")
|
|
114
117
|
Isolate* GetIsolate() const;
|
|
115
118
|
|
|
116
119
|
V8_WARN_UNUSED_RESULT MaybeLocal<String> GetSource(
|