From cb8779b949d28e582a11d086ea341f44e5a21748 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 12 Jan 2022 07:51:03 -0800 Subject: [PATCH] Upgrade V8 binaries for 9.7.106.18 version (#264) Co-authored-by: dylanahsmith Co-authored-by: Genevieve --- deps/include/cppgc/allocation.h | 105 +++++++++++++++--- deps/include/cppgc/internal/api-constants.h | 5 + deps/include/cppgc/internal/persistent-node.h | 19 ++-- .../include/cppgc/internal/pointer-policies.h | 8 +- deps/include/libplatform/libplatform.h | 2 +- deps/include/v8-context.h | 2 +- deps/include/v8-cppgc.h | 17 ++- deps/include/v8-embedder-heap.h | 2 +- deps/include/v8-exception.h | 2 +- deps/include/v8-fast-api-calls.h | 51 ++++----- deps/include/v8-function.h | 3 + deps/include/v8-initialization.h | 10 ++ deps/include/v8-inspector.h | 2 +- deps/include/v8-internal.h | 60 ++++++++-- deps/include/v8-isolate.h | 11 ++ deps/include/v8-message.h | 10 +- deps/include/v8-metrics.h | 12 +- deps/include/v8-object.h | 5 + deps/include/v8-platform.h | 6 - deps/include/v8-primitive.h | 2 +- deps/include/v8-profiler.h | 2 +- deps/include/v8-script.h | 49 +++++--- deps/include/v8-traced-handle.h | 89 +++++++++------ deps/include/v8-version.h | 6 +- deps/include/v8-wasm.h | 8 +- deps/include/v8config.h | 13 +++ deps/v8 | 2 +- deps/v8_version | 2 +- 28 files changed, 353 insertions(+), 152 deletions(-) diff --git a/deps/include/cppgc/allocation.h b/deps/include/cppgc/allocation.h index a3112dd6..69883fb3 100644 --- a/deps/include/cppgc/allocation.h +++ b/deps/include/cppgc/allocation.h @@ -18,6 +18,23 @@ #include "cppgc/type-traits.h" #include "v8config.h" // NOLINT(build/include_directory) +#if defined(__has_attribute) +#if __has_attribute(assume_aligned) +#define CPPGC_DEFAULT_ALIGNED \ + __attribute__((assume_aligned(api_constants::kDefaultAlignment))) +#define CPPGC_DOUBLE_WORD_ALIGNED \ + __attribute__((assume_aligned(2 * api_constants::kDefaultAlignment))) +#endif // __has_attribute(assume_aligned) +#endif // defined(__has_attribute) + +#if !defined(CPPGC_DEFAULT_ALIGNED) +#define CPPGC_DEFAULT_ALIGNED +#endif + +#if !defined(CPPGC_DOUBLE_WORD_ALIGNED) +#define CPPGC_DOUBLE_WORD_ALIGNED +#endif + namespace cppgc { /** @@ -27,6 +44,9 @@ class AllocationHandle; namespace internal { +// Similar to C++17 std::align_val_t; +enum class AlignVal : size_t {}; + class V8_EXPORT MakeGarbageCollectedTraitInternal { protected: static inline void MarkObjectAsFullyConstructed(const void* payload) { @@ -45,32 +65,72 @@ class V8_EXPORT MakeGarbageCollectedTraitInternal { atomic_mutable_bitfield->store(value, std::memory_order_release); } - template - struct SpacePolicy { - static void* Allocate(AllocationHandle& handle, size_t size) { - // Custom space. + // Dispatch based on compile-time information. + // + // Default implementation is for a custom space with >`kDefaultAlignment` byte + // alignment. + template + struct AllocationDispatcher final { + static void* Invoke(AllocationHandle& handle, size_t size) { static_assert(std::is_base_of::value, "Custom space must inherit from CustomSpaceBase."); + static_assert( + !CustomSpace::kSupportsCompaction, + "Custom spaces that support compaction do not support allocating " + "objects with non-default (i.e. word-sized) alignment."); return MakeGarbageCollectedTraitInternal::Allocate( - handle, size, internal::GCInfoTrait::Index(), - CustomSpace::kSpaceIndex); + handle, size, static_cast(alignment), + internal::GCInfoTrait::Index(), CustomSpace::kSpaceIndex); + } + }; + + // Fast path for regular allocations for the default space with + // `kDefaultAlignment` byte alignment. + template + struct AllocationDispatcher + final { + static void* Invoke(AllocationHandle& handle, size_t size) { + return MakeGarbageCollectedTraitInternal::Allocate( + handle, size, internal::GCInfoTrait::Index()); } }; - template - struct SpacePolicy { - static void* Allocate(AllocationHandle& handle, size_t size) { - // Default space. + // Default space with >`kDefaultAlignment` byte alignment. + template + struct AllocationDispatcher final { + static void* Invoke(AllocationHandle& handle, size_t size) { return MakeGarbageCollectedTraitInternal::Allocate( - handle, size, internal::GCInfoTrait::Index()); + handle, size, static_cast(alignment), + internal::GCInfoTrait::Index()); + } + }; + + // Custom space with `kDefaultAlignment` byte alignment. + template + struct AllocationDispatcher + final { + static void* Invoke(AllocationHandle& handle, size_t size) { + static_assert(std::is_base_of::value, + "Custom space must inherit from CustomSpaceBase."); + return MakeGarbageCollectedTraitInternal::Allocate( + handle, size, internal::GCInfoTrait::Index(), + CustomSpace::kSpaceIndex); } }; private: - static void* Allocate(cppgc::AllocationHandle& handle, size_t size, - GCInfoIndex index); - static void* Allocate(cppgc::AllocationHandle& handle, size_t size, - GCInfoIndex index, CustomSpaceIndex space_index); + static void* CPPGC_DEFAULT_ALIGNED Allocate(cppgc::AllocationHandle&, size_t, + GCInfoIndex); + static void* CPPGC_DOUBLE_WORD_ALIGNED Allocate(cppgc::AllocationHandle&, + size_t, AlignVal, + GCInfoIndex); + static void* CPPGC_DEFAULT_ALIGNED Allocate(cppgc::AllocationHandle&, size_t, + GCInfoIndex, CustomSpaceIndex); + static void* CPPGC_DOUBLE_WORD_ALIGNED Allocate(cppgc::AllocationHandle&, + size_t, AlignVal, GCInfoIndex, + CustomSpaceIndex); friend class HeapObjectHeader; }; @@ -109,10 +169,18 @@ class MakeGarbageCollectedTraitBase std::is_base_of::value, "U of GarbageCollected must be a base of T. Check " "GarbageCollected base class inheritance."); - return SpacePolicy< + static constexpr size_t kWantedAlignment = + alignof(T) < internal::api_constants::kDefaultAlignment + ? internal::api_constants::kDefaultAlignment + : alignof(T); + static_assert( + kWantedAlignment <= internal::api_constants::kMaxSupportedAlignment, + "Requested alignment larger than alignof(std::max_align_t) bytes. " + "Please file a bug to possibly get this restriction lifted."); + return AllocationDispatcher< typename internal::GCInfoFolding< T, typename T::ParentMostGarbageCollectedType>::ResultType, - typename SpaceTrait::Space>::Allocate(handle, size); + typename SpaceTrait::Space, kWantedAlignment>::Invoke(handle, size); } /** @@ -236,4 +304,7 @@ V8_INLINE T* MakeGarbageCollected(AllocationHandle& handle, } // namespace cppgc +#undef CPPGC_DEFAULT_ALIGNED +#undef CPPGC_DOUBLE_WORD_ALIGNED + #endif // INCLUDE_CPPGC_ALLOCATION_H_ diff --git a/deps/include/cppgc/internal/api-constants.h b/deps/include/cppgc/internal/api-constants.h index 7253a470..791039f1 100644 --- a/deps/include/cppgc/internal/api-constants.h +++ b/deps/include/cppgc/internal/api-constants.h @@ -39,6 +39,11 @@ constexpr size_t kCagedHeapReservationSize = static_cast(4) * kGB; constexpr size_t kCagedHeapReservationAlignment = kCagedHeapReservationSize; #endif +static constexpr size_t kDefaultAlignment = sizeof(void*); + +// Maximum support alignment for a type as in `alignof(T)`. +static constexpr size_t kMaxSupportedAlignment = 2 * kDefaultAlignment; + } // namespace api_constants } // namespace internal diff --git a/deps/include/cppgc/internal/persistent-node.h b/deps/include/cppgc/internal/persistent-node.h index 1fea6678..68a8096c 100644 --- a/deps/include/cppgc/internal/persistent-node.h +++ b/deps/include/cppgc/internal/persistent-node.h @@ -20,6 +20,7 @@ class Visitor; namespace internal { class CrossThreadPersistentRegion; +class FatalOutOfMemoryHandler; // PersistentNode represents a variant of two states: // 1) traceable node with a back pointer to the Persistent object; @@ -79,7 +80,7 @@ class V8_EXPORT PersistentRegionBase { using PersistentNodeSlots = std::array; public: - PersistentRegionBase() = default; + explicit PersistentRegionBase(const FatalOutOfMemoryHandler& oom_handler); // Clears Persistent fields to avoid stale pointers after heap teardown. ~PersistentRegionBase(); @@ -89,6 +90,7 @@ class V8_EXPORT PersistentRegionBase { PersistentNode* AllocateNode(void* owner, TraceCallback trace) { if (!free_list_head_) { EnsureNodeSlots(); + CPPGC_DCHECK(free_list_head_); } PersistentNode* node = free_list_head_; free_list_head_ = free_list_head_->FreeListNext(); @@ -122,6 +124,7 @@ class V8_EXPORT PersistentRegionBase { std::vector> nodes_; PersistentNode* free_list_head_ = nullptr; size_t nodes_in_use_ = 0; + const FatalOutOfMemoryHandler& oom_handler_; friend class CrossThreadPersistentRegion; }; @@ -130,7 +133,7 @@ class V8_EXPORT PersistentRegionBase { // freeing happens only on the thread that created the region. class V8_EXPORT PersistentRegion final : public PersistentRegionBase { public: - PersistentRegion(); + explicit PersistentRegion(const FatalOutOfMemoryHandler&); // Clears Persistent fields to avoid stale pointers after heap teardown. ~PersistentRegion() = default; @@ -138,21 +141,17 @@ class V8_EXPORT PersistentRegion final : public PersistentRegionBase { PersistentRegion& operator=(const PersistentRegion&) = delete; V8_INLINE PersistentNode* AllocateNode(void* owner, TraceCallback trace) { -#if V8_ENABLE_CHECKS - CheckIsCreationThread(); -#endif // V8_ENABLE_CHECKS + CPPGC_DCHECK(IsCreationThread()); return PersistentRegionBase::AllocateNode(owner, trace); } V8_INLINE void FreeNode(PersistentNode* node) { -#if V8_ENABLE_CHECKS - CheckIsCreationThread(); -#endif // V8_ENABLE_CHECKS + CPPGC_DCHECK(IsCreationThread()); PersistentRegionBase::FreeNode(node); } private: - void CheckIsCreationThread(); + bool IsCreationThread(); int creation_thread_id_; }; @@ -172,7 +171,7 @@ class V8_EXPORT PersistentRegionLock final { class V8_EXPORT CrossThreadPersistentRegion final : protected PersistentRegionBase { public: - CrossThreadPersistentRegion() = default; + explicit CrossThreadPersistentRegion(const FatalOutOfMemoryHandler&); // Clears Persistent fields to avoid stale pointers after heap teardown. ~CrossThreadPersistentRegion(); diff --git a/deps/include/cppgc/internal/pointer-policies.h b/deps/include/cppgc/internal/pointer-policies.h index 7c4f4a08..853d7031 100644 --- a/deps/include/cppgc/internal/pointer-policies.h +++ b/deps/include/cppgc/internal/pointer-policies.h @@ -92,19 +92,19 @@ class DisabledCheckingPolicy { void CheckPointer(const void*) {} }; -#if V8_ENABLE_CHECKS +#ifdef DEBUG // Off heap members are not connected to object graph and thus cannot ressurect // dead objects. using DefaultMemberCheckingPolicy = SameThreadEnabledCheckingPolicy; using DefaultPersistentCheckingPolicy = SameThreadEnabledCheckingPolicy; -#else +#else // !DEBUG using DefaultMemberCheckingPolicy = DisabledCheckingPolicy; using DefaultPersistentCheckingPolicy = DisabledCheckingPolicy; -#endif +#endif // !DEBUG // For CT(W)P neither marking information (for value), nor objectstart bitmap -// (for slot) are guaranteed to be present because there's no synchonization +// (for slot) are guaranteed to be present because there's no synchronization // between heaps after marking. using DefaultCrossThreadPersistentCheckingPolicy = DisabledCheckingPolicy; diff --git a/deps/include/libplatform/libplatform.h b/deps/include/libplatform/libplatform.h index 00de81df..fb79bcfe 100644 --- a/deps/include/libplatform/libplatform.h +++ b/deps/include/libplatform/libplatform.h @@ -95,7 +95,7 @@ V8_PLATFORM_EXPORT void RunIdleTasks(v8::Platform* platform, * The |platform| has to be created using |NewDefaultPlatform|. * */ -V8_DEPRECATE_SOON("Access the DefaultPlatform directly") +V8_DEPRECATED("Access the DefaultPlatform directly") V8_PLATFORM_EXPORT void SetTracingController( v8::Platform* platform, v8::platform::tracing::TracingController* tracing_controller); diff --git a/deps/include/v8-context.h b/deps/include/v8-context.h index bd28c6c9..d398ac4b 100644 --- a/deps/include/v8-context.h +++ b/deps/include/v8-context.h @@ -318,7 +318,7 @@ class V8_EXPORT Context : public Data { * stack may be allocated separately from the native stack. See also * |TryCatch::JSStackComparableAddressPrivate| for details. */ - V8_DEPRECATE_SOON( + V8_DEPRECATED( "This is private V8 information that should not be exposed in the API.") uintptr_t JSStackComparableAddress() const { return JSStackComparableAddressPrivate(); diff --git a/deps/include/v8-cppgc.h b/deps/include/v8-cppgc.h index 813e0842..64b42c2b 100644 --- a/deps/include/v8-cppgc.h +++ b/deps/include/v8-cppgc.h @@ -195,9 +195,11 @@ class V8_EXPORT JSHeapConsistency final { * \returns whether a write barrier is needed and which barrier to invoke. */ template + V8_DEPRECATE_SOON("Write barriers automatically emitted by TracedReference.") static V8_INLINE WriteBarrierType - GetWriteBarrierType(const TracedReferenceBase& ref, - WriteBarrierParams& params, HeapHandleCallback callback) { + GetWriteBarrierType(const TracedReferenceBase& ref, + WriteBarrierParams& params, + HeapHandleCallback callback) { if (ref.IsEmpty()) return WriteBarrierType::kNone; if (V8_LIKELY(!cppgc::internal::WriteBarrier:: @@ -251,6 +253,7 @@ class V8_EXPORT JSHeapConsistency final { * \param params The parameters retrieved from `GetWriteBarrierType()`. * \param ref The reference being written to. */ + V8_DEPRECATE_SOON("Write barriers automatically emitted by TracedReference.") static V8_INLINE void DijkstraMarkingBarrier(const WriteBarrierParams& params, cppgc::HeapHandle& heap_handle, const TracedReferenceBase& ref) { @@ -280,6 +283,7 @@ class V8_EXPORT JSHeapConsistency final { * \param params The parameters retrieved from `GetWriteBarrierType()`. * \param ref The reference being written to. */ + V8_DEPRECATE_SOON("Write barriers automatically emitted by TracedReference.") static V8_INLINE void GenerationalBarrier(const WriteBarrierParams& params, const TracedReferenceBase& ref) {} @@ -318,8 +322,13 @@ namespace cppgc { template struct TraceTrait> { - static void Trace(Visitor* visitor, const v8::TracedReference* self) { - static_cast(visitor)->Trace(*self); + static cppgc::TraceDescriptor GetTraceDescriptor(const void* self) { + return {nullptr, Trace}; + } + + static void Trace(Visitor* visitor, const void* self) { + static_cast(visitor)->Trace( + *static_cast*>(self)); } }; diff --git a/deps/include/v8-embedder-heap.h b/deps/include/v8-embedder-heap.h index 501a4fc5..c3e5ddc1 100644 --- a/deps/include/v8-embedder-heap.h +++ b/deps/include/v8-embedder-heap.h @@ -127,7 +127,7 @@ class V8_EXPORT EmbedderHeapTracer { /** * Called by the embedder to notify V8 of an empty execution stack. */ - V8_DEPRECATE_SOON( + V8_DEPRECATED( "This call only optimized internal caches which V8 is able to figure out " "on its own now.") void NotifyEmptyEmbedderStack(); diff --git a/deps/include/v8-exception.h b/deps/include/v8-exception.h index add882da..faa46487 100644 --- a/deps/include/v8-exception.h +++ b/deps/include/v8-exception.h @@ -169,7 +169,7 @@ class V8_EXPORT TryCatch { */ void SetCaptureMessage(bool value); - V8_DEPRECATE_SOON( + V8_DEPRECATED( "This is private information that should not be exposed by the API") static void* JSStackComparableAddress(TryCatch* handler) { if (handler == nullptr) return nullptr; diff --git a/deps/include/v8-fast-api-calls.h b/deps/include/v8-fast-api-calls.h index 854f845a..141fddd2 100644 --- a/deps/include/v8-fast-api-calls.h +++ b/deps/include/v8-fast-api-calls.h @@ -460,12 +460,6 @@ class V8_EXPORT CFunction { return ArgUnwrap::Make(func); } - template - V8_DEPRECATED("Use CFunctionBuilder instead.") - static CFunction MakeWithFallbackSupport(F* func) { - return ArgUnwrap::Make(func); - } - CFunction(const void* address, const CFunctionInfo* type_info); private: @@ -485,7 +479,7 @@ class V8_EXPORT CFunction { }; }; -struct V8_DEPRECATE_SOON("Use v8::Local instead.") ApiObject { +struct V8_DEPRECATED("Use v8::Local instead.") ApiObject { uintptr_t address; }; @@ -684,17 +678,19 @@ struct TypeInfoHelper { #define STATIC_ASSERT_IMPLIES(COND, ASSERTION, MSG) \ static_assert(((COND) == 0) || (ASSERTION), MSG) +} // namespace internal + template -class CTypeInfoBuilder { +class V8_EXPORT CTypeInfoBuilder { public: using BaseType = T; static constexpr CTypeInfo Build() { constexpr CTypeInfo::Flags kFlags = - MergeFlags(TypeInfoHelper::Flags(), Flags...); - constexpr CTypeInfo::Type kType = TypeInfoHelper::Type(); + MergeFlags(internal::TypeInfoHelper::Flags(), Flags...); + constexpr CTypeInfo::Type kType = internal::TypeInfoHelper::Type(); constexpr CTypeInfo::SequenceType kSequenceType = - TypeInfoHelper::SequenceType(); + internal::TypeInfoHelper::SequenceType(); STATIC_ASSERT_IMPLIES( uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kAllowSharedBit), @@ -722,8 +718,8 @@ class CTypeInfoBuilder { "TypedArrays are only supported from primitive types or void."); // Return the same type with the merged flags. - return CTypeInfo(TypeInfoHelper::Type(), - TypeInfoHelper::SequenceType(), kFlags); + return CTypeInfo(internal::TypeInfoHelper::Type(), + internal::TypeInfoHelper::SequenceType(), kFlags); } private: @@ -735,6 +731,7 @@ class CTypeInfoBuilder { static constexpr CTypeInfo::Flags MergeFlags() { return CTypeInfo::Flags(0); } }; +namespace internal { template class CFunctionBuilderWithFunction { public: @@ -864,24 +861,28 @@ bool V8_EXPORT V8_WARN_UNUSED_RESULT TryToCopyAndConvertArrayToCppBuffer( Local src, T* dst, uint32_t max_length); template <> -bool V8_EXPORT V8_WARN_UNUSED_RESULT TryToCopyAndConvertArrayToCppBuffer< - internal::CTypeInfoBuilder::Build().GetId(), int32_t>( - Local src, int32_t* dst, uint32_t max_length); +bool V8_EXPORT V8_WARN_UNUSED_RESULT +TryToCopyAndConvertArrayToCppBuffer::Build().GetId(), + int32_t>(Local src, int32_t* dst, + uint32_t max_length); template <> -bool V8_EXPORT V8_WARN_UNUSED_RESULT TryToCopyAndConvertArrayToCppBuffer< - internal::CTypeInfoBuilder::Build().GetId(), uint32_t>( - Local src, uint32_t* dst, uint32_t max_length); +bool V8_EXPORT V8_WARN_UNUSED_RESULT +TryToCopyAndConvertArrayToCppBuffer::Build().GetId(), + uint32_t>(Local src, uint32_t* dst, + uint32_t max_length); template <> -bool V8_EXPORT V8_WARN_UNUSED_RESULT TryToCopyAndConvertArrayToCppBuffer< - internal::CTypeInfoBuilder::Build().GetId(), float>( - Local src, float* dst, uint32_t max_length); +bool V8_EXPORT V8_WARN_UNUSED_RESULT +TryToCopyAndConvertArrayToCppBuffer::Build().GetId(), + float>(Local src, float* dst, + uint32_t max_length); template <> -bool V8_EXPORT V8_WARN_UNUSED_RESULT TryToCopyAndConvertArrayToCppBuffer< - internal::CTypeInfoBuilder::Build().GetId(), double>( - Local src, double* dst, uint32_t max_length); +bool V8_EXPORT V8_WARN_UNUSED_RESULT +TryToCopyAndConvertArrayToCppBuffer::Build().GetId(), + double>(Local src, double* dst, + uint32_t max_length); } // namespace v8 diff --git a/deps/include/v8-function.h b/deps/include/v8-function.h index 9424a86f..897e6ed6 100644 --- a/deps/include/v8-function.h +++ b/deps/include/v8-function.h @@ -18,6 +18,7 @@ namespace v8 { class Context; +class UnboundScript; /** * A JavaScript function object (ECMA-262, 15.3). @@ -58,6 +59,8 @@ class V8_EXPORT Function : public Object { void SetName(Local name); Local GetName() const; + MaybeLocal GetUnboundScript() const; + /** * Name inferred from variable or property assignment of this function. * Used to facilitate debugging and profiling of JavaScript code written diff --git a/deps/include/v8-initialization.h b/deps/include/v8-initialization.h index 7c9f26b8..822d1503 100644 --- a/deps/include/v8-initialization.h +++ b/deps/include/v8-initialization.h @@ -227,6 +227,16 @@ class V8_EXPORT V8 { * this returns zero. */ static size_t GetVirtualMemoryCageSizeInBytes(); + + /** + * Returns whether the virtual memory cage is configured securely. + * + * If V8 cannot create a proper virtual memory cage, it will fall back to + * creating a cage that doesn't have the desired security properties but at + * least still allows V8 to function. This API can be used to determine if + * such an insecure cage is being used, in which case it will return false. + */ + static bool IsUsingSecureVirtualMemoryCage(); #endif /** diff --git a/deps/include/v8-inspector.h b/deps/include/v8-inspector.h index 74592fdf..8ba21ffd 100644 --- a/deps/include/v8-inspector.h +++ b/deps/include/v8-inspector.h @@ -114,7 +114,7 @@ class V8_EXPORT V8StackTrace { virtual int topLineNumber() const = 0; virtual int topColumnNumber() const = 0; virtual int topScriptId() const = 0; - V8_DEPRECATE_SOON("Use V8::StackTrace::topScriptId() instead.") + V8_DEPRECATED("Use V8::StackTrace::topScriptId() instead.") int topScriptIdAsInteger() const { return topScriptId(); } virtual StringView topFunctionName() const = 0; diff --git a/deps/include/v8-internal.h b/deps/include/v8-internal.h index e1aee508..f0531bcf 100644 --- a/deps/include/v8-internal.h +++ b/deps/include/v8-internal.h @@ -494,13 +494,14 @@ constexpr bool VirtualMemoryCageIsEnabled() { #endif } -#ifdef V8_VIRTUAL_MEMORY_CAGE -// Size of the virtual memory cage, excluding the guard regions surrounding it. -constexpr size_t kVirtualMemoryCageSize = size_t{1} << 40; // 1 TB +#ifdef V8_VIRTUAL_MEMORY_CAGE_IS_AVAILABLE -static_assert(kVirtualMemoryCageSize > Internals::kPtrComprCageReservationSize, - "The virtual memory cage must be larger than the pointer " - "compression cage contained within it."); +#define GB (1ULL << 30) +#define TB (1ULL << 40) + +// Size of the virtual memory cage, excluding the guard regions surrounding it. +constexpr size_t kVirtualMemoryCageSizeLog2 = 40; // 1 TB +constexpr size_t kVirtualMemoryCageSize = 1ULL << kVirtualMemoryCageSizeLog2; // Required alignment of the virtual memory cage. For simplicity, we require the // size of the guard regions to be a multiple of this, so that this specifies @@ -510,10 +511,22 @@ static_assert(kVirtualMemoryCageSize > Internals::kPtrComprCageReservationSize, constexpr size_t kVirtualMemoryCageAlignment = Internals::kPtrComprCageBaseAlignment; +#ifdef V8_CAGED_POINTERS +// CagedPointers are guaranteed to point into the virtual memory cage. This is +// achieved by storing them as offset from the cage base rather than as raw +// pointers. +using CagedPointer_t = Address; + +// For efficiency, the offset is stored shifted to the left, so that +// it is guaranteed that the offset is smaller than the cage size after +// shifting it to the right again. This constant specifies the shift amount. +constexpr uint64_t kCagedPointerShift = 64 - kVirtualMemoryCageSizeLog2; +#endif + // Size of the guard regions surrounding the virtual memory cage. This assumes a // worst-case scenario of a 32-bit unsigned index being used to access an array // of 64-bit values. -constexpr size_t kVirtualMemoryCageGuardRegionSize = size_t{32} << 30; // 32 GB +constexpr size_t kVirtualMemoryCageGuardRegionSize = 32ULL * GB; static_assert((kVirtualMemoryCageGuardRegionSize % kVirtualMemoryCageAlignment) == 0, @@ -525,7 +538,33 @@ static_assert((kVirtualMemoryCageGuardRegionSize % // until either the reservation succeeds or the minimum size is reached. A // minimum of 32GB allows the 4GB pointer compression region as well as the // ArrayBuffer partition and two 10GB WASM memory cages to fit into the cage. -constexpr size_t kVirtualMemoryCageMinimumSize = size_t{32} << 30; // 32 GB +// 32GB should also be the minimum possible size of the userspace address space +// as there are some machine configurations with only 36 virtual address bits. +constexpr size_t kVirtualMemoryCageMinimumSize = 32ULL * GB; + +static_assert(kVirtualMemoryCageMinimumSize <= kVirtualMemoryCageSize, + "The minimal size of the virtual memory cage must be smaller or " + "equal to the regular size."); + +// On OSes where reservation virtual memory is too expensive to create a real +// cage, notably Windows pre 8.1, we create a fake cage that doesn't actually +// reserve most of the memory, and so doesn't have the desired security +// properties, but still ensures that objects that should be located inside the +// cage are allocated within kVirtualMemoryCageSize bytes from the start of the +// cage, and so appear to be inside the cage. The minimum size of the virtual +// memory range that is actually reserved for a fake cage is specified by this +// constant and should be big enough to contain the pointer compression region +// as well as the ArrayBuffer partition. +constexpr size_t kFakeVirtualMemoryCageMinReservationSize = 8ULL * GB; + +static_assert(kVirtualMemoryCageMinimumSize > + Internals::kPtrComprCageReservationSize, + "The virtual memory cage must be larger than the pointer " + "compression cage contained within it."); +static_assert(kFakeVirtualMemoryCageMinReservationSize > + Internals::kPtrComprCageReservationSize, + "The reservation for a fake virtual memory cage must be larger " + "than the pointer compression cage contained within it."); // For now, even if the virtual memory cage is enabled, we still allow backing // stores to be allocated outside of it as fallback. This will simplify the @@ -537,7 +576,10 @@ constexpr bool kAllowBackingStoresOutsideCage = false; constexpr bool kAllowBackingStoresOutsideCage = true; #endif // V8_HEAP_SANDBOX -#endif // V8_VIRTUAL_MEMORY_CAGE +#undef GB +#undef TB + +#endif // V8_VIRTUAL_MEMORY_CAGE_IS_AVAILABLE // Only perform cast check for types derived from v8::Data since // other types do not implement the Cast method. diff --git a/deps/include/v8-isolate.h b/deps/include/v8-isolate.h index 39276b34..32b53f1b 100644 --- a/deps/include/v8-isolate.h +++ b/deps/include/v8-isolate.h @@ -281,6 +281,12 @@ class V8_EXPORT Isolate { */ int embedder_wrapper_type_index = -1; int embedder_wrapper_object_index = -1; + + /** + * The following parameter is experimental and may change significantly. + * This is currently for internal testing. + */ + Isolate* experimental_attach_to_shared_isolate = nullptr; }; /** @@ -585,6 +591,11 @@ class V8_EXPORT Isolate { */ static Isolate* TryGetCurrent(); + /** + * Return true if this isolate is currently active. + **/ + bool IsCurrent() const; + /** * Clears the set of objects held strongly by the heap. This set of * objects are originally built when a WeakRef is created or diff --git a/deps/include/v8-message.h b/deps/include/v8-message.h index 62b6bd92..e9d668ca 100644 --- a/deps/include/v8-message.h +++ b/deps/include/v8-message.h @@ -60,7 +60,7 @@ class ScriptOriginOptions { */ class V8_EXPORT ScriptOrigin { public: - V8_DEPRECATE_SOON("Use constructor with primitive C++ types") + V8_DEPRECATED("Use constructor with primitive C++ types") ScriptOrigin( Local resource_name, Local resource_line_offset, Local resource_column_offset, @@ -71,7 +71,7 @@ class V8_EXPORT ScriptOrigin { Local is_wasm = Local(), Local is_module = Local(), Local host_defined_options = Local()); - V8_DEPRECATE_SOON("Use constructor that takes an isolate") + V8_DEPRECATED("Use constructor that takes an isolate") explicit ScriptOrigin( Local resource_name, int resource_line_offset = 0, int resource_column_offset = 0, @@ -99,11 +99,11 @@ class V8_EXPORT ScriptOrigin { host_defined_options_(host_defined_options) {} V8_INLINE Local ResourceName() const; - V8_DEPRECATE_SOON("Use getter with primitive C++ types.") + V8_DEPRECATED("Use getter with primitive C++ types.") V8_INLINE Local ResourceLineOffset() const; - V8_DEPRECATE_SOON("Use getter with primitive C++ types.") + V8_DEPRECATED("Use getter with primitive C++ types.") V8_INLINE Local ResourceColumnOffset() const; - V8_DEPRECATE_SOON("Use getter with primitive C++ types.") + V8_DEPRECATED("Use getter with primitive C++ types.") V8_INLINE Local ScriptID() const; V8_INLINE int LineOffset() const; V8_INLINE int ColumnOffset() const; diff --git a/deps/include/v8-metrics.h b/deps/include/v8-metrics.h index 29e54401..62738442 100644 --- a/deps/include/v8-metrics.h +++ b/deps/include/v8-metrics.h @@ -46,12 +46,12 @@ struct GarbageCollectionFullCycle { GarbageCollectionSizes objects_cpp; GarbageCollectionSizes memory; GarbageCollectionSizes memory_cpp; - double collection_rate_in_percent; - double collection_rate_cpp_in_percent; - double efficiency_in_bytes_per_us; - double efficiency_cpp_in_bytes_per_us; - double main_thread_efficiency_in_bytes_per_us; - double main_thread_efficiency_cpp_in_bytes_per_us; + double collection_rate_in_percent = -1.0; + double collection_rate_cpp_in_percent = -1.0; + double efficiency_in_bytes_per_us = -1.0; + double efficiency_cpp_in_bytes_per_us = -1.0; + double main_thread_efficiency_in_bytes_per_us = -1.0; + double main_thread_efficiency_cpp_in_bytes_per_us = -1.0; }; struct GarbageCollectionFullMainThreadIncrementalMark { diff --git a/deps/include/v8-object.h b/deps/include/v8-object.h index 114e452a..6716162d 100644 --- a/deps/include/v8-object.h +++ b/deps/include/v8-object.h @@ -598,6 +598,11 @@ class V8_EXPORT Object : public Value { Local CreationContext(); MaybeLocal GetCreationContext(); + /** + * Shortcut for GetCreationContext().ToLocalChecked(). + **/ + Local GetCreationContextChecked(); + /** Same as above, but works for Persistents */ V8_DEPRECATE_SOON( "Use MaybeLocal GetCreationContext(const " diff --git a/deps/include/v8-platform.h b/deps/include/v8-platform.h index e60e1757..234582f0 100644 --- a/deps/include/v8-platform.h +++ b/deps/include/v8-platform.h @@ -444,13 +444,7 @@ class PageAllocator { * zero-initialized again. The memory must have been previously allocated by a * call to AllocatePages. Returns true on success, false otherwise. */ -#ifdef V8_VIRTUAL_MEMORY_CAGE - // Implementing this API is required when the virtual memory cage is enabled. virtual bool DecommitPages(void* address, size_t size) = 0; -#else - // Otherwise, it is optional for now. - virtual bool DecommitPages(void* address, size_t size) { return false; } -#endif /** * INTERNAL ONLY: This interface has not been stabilised and may change diff --git a/deps/include/v8-primitive.h b/deps/include/v8-primitive.h index 59d959da..8a95c151 100644 --- a/deps/include/v8-primitive.h +++ b/deps/include/v8-primitive.h @@ -575,7 +575,7 @@ class V8_EXPORT Symbol : public Name { /** * Returns the description string of the symbol, or undefined if none. */ - V8_DEPRECATE_SOON("Use Symbol::Description(isolate)") + V8_DEPRECATED("Use Symbol::Description(isolate)") Local Description() const; Local Description(Isolate* isolate) const; diff --git a/deps/include/v8-profiler.h b/deps/include/v8-profiler.h index f2354cac..ccf15bab 100644 --- a/deps/include/v8-profiler.h +++ b/deps/include/v8-profiler.h @@ -603,7 +603,7 @@ class V8_EXPORT ActivityControl { * Notify about current progress. The activity can be stopped by * returning kAbort as the callback result. */ - virtual ControlOption ReportProgressValue(int done, int total) = 0; + virtual ControlOption ReportProgressValue(uint32_t done, uint32_t total) = 0; }; /** diff --git a/deps/include/v8-script.h b/deps/include/v8-script.h index d1708993..bc68dd9a 100644 --- a/deps/include/v8-script.h +++ b/deps/include/v8-script.h @@ -173,14 +173,14 @@ class V8_EXPORT Module : public Data { /** * Returns the number of modules requested by this module. */ - V8_DEPRECATE_SOON("Use Module::GetModuleRequests() and FixedArray::Length().") + V8_DEPRECATED("Use Module::GetModuleRequests() and FixedArray::Length().") int GetModuleRequestsLength() const; /** * Returns the ith module specifier in this module. * i must be < GetModuleRequestsLength() and >= 0. */ - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use Module::GetModuleRequests() and ModuleRequest::GetSpecifier().") Local GetModuleRequest(int i) const; @@ -188,7 +188,7 @@ class V8_EXPORT Module : public Data { * Returns the source location (line number and column number) of the ith * module specifier's first occurrence in this module. */ - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use Module::GetModuleRequests(), ModuleRequest::GetSourceOffset(), and " "Module::SourceOffsetToLocation().") Location GetModuleRequestLocation(int i) const; @@ -209,7 +209,7 @@ class V8_EXPORT Module : public Data { */ int GetIdentityHash() const; - using ResolveCallback V8_DEPRECATE_SOON("Use ResolveModuleCallback") = + using ResolveCallback V8_DEPRECATED("Use ResolveModuleCallback") = MaybeLocal (*)(Local context, Local specifier, Local referrer); using ResolveModuleCallback = MaybeLocal (*)( @@ -223,7 +223,7 @@ class V8_EXPORT Module : public Data { * instantiation. (In the case where the callback throws an exception, that * exception is propagated.) */ - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use the version of InstantiateModule that takes a ResolveModuleCallback " "parameter") V8_WARN_UNUSED_RESULT Maybe InstantiateModule(Local context, @@ -345,6 +345,12 @@ class V8_EXPORT Script { * Returns the corresponding context-unbound script. */ Local GetUnboundScript(); + + /** + * The name that was passed by the embedder as ResourceName to the + * ScriptOrigin. This can be either a v8::String or v8::Undefined. + */ + Local GetResourceName(); }; enum class ScriptType { kClassic, kModule }; @@ -465,21 +471,16 @@ class V8_EXPORT ScriptCompiler { virtual size_t GetMoreData(const uint8_t** src) = 0; /** - * V8 calls this method to set a 'bookmark' at the current position in - * the source stream, for the purpose of (maybe) later calling - * ResetToBookmark. If ResetToBookmark is called later, then subsequent - * calls to GetMoreData should return the same data as they did when - * SetBookmark was called earlier. - * - * The embedder may return 'false' to indicate it cannot provide this - * functionality. + * [DEPRECATED]: No longer used, will be removed soon. */ - virtual bool SetBookmark(); + V8_DEPRECATED("Not used") + virtual bool SetBookmark() { return false; } /** - * V8 calls this to return to a previously set bookmark. + * [DEPRECATED]: No longer used, will be removed soon. */ - virtual void ResetToBookmark(); + V8_DEPRECATED("Not used") + virtual void ResetToBookmark() {} }; /** @@ -687,6 +688,7 @@ class V8_EXPORT ScriptCompiler { * It is possible to specify multiple context extensions (obj in the above * example). */ + V8_DEPRECATE_SOON("Use CompileFunction") static V8_WARN_UNUSED_RESULT MaybeLocal CompileFunctionInContext( Local context, Source* source, size_t arguments_count, Local arguments[], size_t context_extension_count, @@ -694,6 +696,12 @@ class V8_EXPORT ScriptCompiler { CompileOptions options = kNoCompileOptions, NoCacheReason no_cache_reason = kNoCacheNoReason, Local* script_or_module_out = nullptr); + static V8_WARN_UNUSED_RESULT MaybeLocal CompileFunction( + Local context, Source* source, size_t arguments_count = 0, + Local arguments[] = nullptr, size_t context_extension_count = 0, + Local context_extensions[] = nullptr, + CompileOptions options = kNoCompileOptions, + NoCacheReason no_cache_reason = kNoCacheNoReason); /** * Creates and returns code cache for the specified unbound_script. @@ -712,7 +720,7 @@ class V8_EXPORT ScriptCompiler { /** * Creates and returns code cache for the specified function that was - * previously produced by CompileFunctionInContext. + * previously produced by CompileFunction. * This will return nullptr if the script cannot be serialized. The * CachedData returned by this function should be owned by the caller. */ @@ -722,6 +730,13 @@ class V8_EXPORT ScriptCompiler { static V8_WARN_UNUSED_RESULT MaybeLocal CompileUnboundInternal( Isolate* isolate, Source* source, CompileOptions options, NoCacheReason no_cache_reason); + + static V8_WARN_UNUSED_RESULT MaybeLocal CompileFunctionInternal( + Local context, Source* source, size_t arguments_count, + Local arguments[], size_t context_extension_count, + Local context_extensions[], CompileOptions options, + NoCacheReason no_cache_reason, + Local* script_or_module_out); }; ScriptCompiler::Source::Source(Local string, const ScriptOrigin& origin, diff --git a/deps/include/v8-traced-handle.h b/deps/include/v8-traced-handle.h index 15c9693e..7db34a97 100644 --- a/deps/include/v8-traced-handle.h +++ b/deps/include/v8-traced-handle.h @@ -26,13 +26,20 @@ namespace v8 { class Value; namespace internal { + class BasicTracedReferenceExtractor; -} // namespace internal -namespace api_internal { +enum class GlobalHandleDestructionMode { kWithDestructor, kWithoutDestructor }; + +enum class GlobalHandleStoreMode { + kInitializingStore, + kAssigningStore, +}; + V8_EXPORT internal::Address* GlobalizeTracedReference( internal::Isolate* isolate, internal::Address* handle, - internal::Address* slot, bool has_destructor); + internal::Address* slot, GlobalHandleDestructionMode destruction_mode, + GlobalHandleStoreMode store_mode); V8_EXPORT void MoveTracedGlobalReference(internal::Address** from, internal::Address** to); V8_EXPORT void CopyTracedGlobalReference(const internal::Address* const* from, @@ -41,7 +48,8 @@ V8_EXPORT void DisposeTracedGlobal(internal::Address* global_handle); V8_EXPORT void SetFinalizationCallbackTraced( internal::Address* location, void* parameter, WeakCallbackInfo::Callback callback); -} // namespace api_internal + +} // namespace internal /** * Deprecated. Use |TracedReference| instead. @@ -164,15 +172,15 @@ class BasicTracedReference : public TracedReferenceBase { } private: - enum DestructionMode { kWithDestructor, kWithoutDestructor }; - /** * An empty BasicTracedReference without storage cell. */ BasicTracedReference() = default; - V8_INLINE static internal::Address* New(Isolate* isolate, T* that, void* slot, - DestructionMode destruction_mode); + V8_INLINE static internal::Address* New( + Isolate* isolate, T* that, void* slot, + internal::GlobalHandleDestructionMode destruction_mode, + internal::GlobalHandleStoreMode store_mode); friend class EmbedderHeapTracer; template @@ -215,15 +223,17 @@ class TracedGlobal : public BasicTracedReference { */ template TracedGlobal(Isolate* isolate, Local that) : BasicTracedReference() { - this->val_ = this->New(isolate, that.val_, &this->val_, - BasicTracedReference::kWithDestructor); + this->val_ = + this->New(isolate, that.val_, &this->val_, + internal::GlobalHandleDestructionMode::kWithDestructor, + internal::GlobalHandleStoreMode::kInitializingStore); static_assert(std::is_base_of::value, "type check"); } /** * Move constructor initializing TracedGlobal from an existing one. */ - V8_INLINE TracedGlobal(TracedGlobal&& other) { + V8_INLINE TracedGlobal(TracedGlobal&& other) noexcept { // Forward to operator=. *this = std::move(other); } @@ -232,7 +242,7 @@ class TracedGlobal : public BasicTracedReference { * Move constructor initializing TracedGlobal from an existing one. */ template - V8_INLINE TracedGlobal(TracedGlobal&& other) { + V8_INLINE TracedGlobal(TracedGlobal&& other) noexcept { // Forward to operator=. *this = std::move(other); } @@ -257,13 +267,13 @@ class TracedGlobal : public BasicTracedReference { /** * Move assignment operator initializing TracedGlobal from an existing one. */ - V8_INLINE TracedGlobal& operator=(TracedGlobal&& rhs); + V8_INLINE TracedGlobal& operator=(TracedGlobal&& rhs) noexcept; /** * Move assignment operator initializing TracedGlobal from an existing one. */ template - V8_INLINE TracedGlobal& operator=(TracedGlobal&& rhs); + V8_INLINE TracedGlobal& operator=(TracedGlobal&& rhs) noexcept; /** * Copy assignment operator initializing TracedGlobal from an existing one. @@ -338,8 +348,10 @@ class TracedReference : public BasicTracedReference { */ template TracedReference(Isolate* isolate, Local that) : BasicTracedReference() { - this->val_ = this->New(isolate, that.val_, &this->val_, - BasicTracedReference::kWithoutDestructor); + this->val_ = + this->New(isolate, that.val_, &this->val_, + internal::GlobalHandleDestructionMode::kWithoutDestructor, + internal::GlobalHandleStoreMode::kInitializingStore); static_assert(std::is_base_of::value, "type check"); } @@ -347,7 +359,7 @@ class TracedReference : public BasicTracedReference { * Move constructor initializing TracedReference from an * existing one. */ - V8_INLINE TracedReference(TracedReference&& other) { + V8_INLINE TracedReference(TracedReference&& other) noexcept { // Forward to operator=. *this = std::move(other); } @@ -357,7 +369,7 @@ class TracedReference : public BasicTracedReference { * existing one. */ template - V8_INLINE TracedReference(TracedReference&& other) { + V8_INLINE TracedReference(TracedReference&& other) noexcept { // Forward to operator=. *this = std::move(other); } @@ -384,13 +396,13 @@ class TracedReference : public BasicTracedReference { /** * Move assignment operator initializing TracedGlobal from an existing one. */ - V8_INLINE TracedReference& operator=(TracedReference&& rhs); + V8_INLINE TracedReference& operator=(TracedReference&& rhs) noexcept; /** * Move assignment operator initializing TracedGlobal from an existing one. */ template - V8_INLINE TracedReference& operator=(TracedReference&& rhs); + V8_INLINE TracedReference& operator=(TracedReference&& rhs) noexcept; /** * Copy assignment operator initializing TracedGlobal from an existing one. @@ -420,18 +432,19 @@ class TracedReference : public BasicTracedReference { // --- Implementation --- template internal::Address* BasicTracedReference::New( - Isolate* isolate, T* that, void* slot, DestructionMode destruction_mode) { + Isolate* isolate, T* that, void* slot, + internal::GlobalHandleDestructionMode destruction_mode, + internal::GlobalHandleStoreMode store_mode) { if (that == nullptr) return nullptr; internal::Address* p = reinterpret_cast(that); - return api_internal::GlobalizeTracedReference( + return internal::GlobalizeTracedReference( reinterpret_cast(isolate), p, - reinterpret_cast(slot), - destruction_mode == kWithDestructor); + reinterpret_cast(slot), destruction_mode, store_mode); } void TracedReferenceBase::Reset() { if (IsEmpty()) return; - api_internal::DisposeTracedGlobal(reinterpret_cast(val_)); + internal::DisposeTracedGlobal(reinterpret_cast(val_)); SetSlotThreadSafe(nullptr); } @@ -484,12 +497,13 @@ void TracedGlobal::Reset(Isolate* isolate, const Local& other) { Reset(); if (other.IsEmpty()) return; this->val_ = this->New(isolate, other.val_, &this->val_, - BasicTracedReference::kWithDestructor); + internal::GlobalHandleDestructionMode::kWithDestructor, + internal::GlobalHandleStoreMode::kAssigningStore); } template template -TracedGlobal& TracedGlobal::operator=(TracedGlobal&& rhs) { +TracedGlobal& TracedGlobal::operator=(TracedGlobal&& rhs) noexcept { static_assert(std::is_base_of::value, "type check"); *this = std::move(rhs.template As()); return *this; @@ -504,9 +518,9 @@ TracedGlobal& TracedGlobal::operator=(const TracedGlobal& rhs) { } template -TracedGlobal& TracedGlobal::operator=(TracedGlobal&& rhs) { +TracedGlobal& TracedGlobal::operator=(TracedGlobal&& rhs) noexcept { if (this != &rhs) { - api_internal::MoveTracedGlobalReference( + internal::MoveTracedGlobalReference( reinterpret_cast(&rhs.val_), reinterpret_cast(&this->val_)); } @@ -518,7 +532,7 @@ TracedGlobal& TracedGlobal::operator=(const TracedGlobal& rhs) { if (this != &rhs) { this->Reset(); if (rhs.val_ != nullptr) { - api_internal::CopyTracedGlobalReference( + internal::CopyTracedGlobalReference( reinterpret_cast(&rhs.val_), reinterpret_cast(&this->val_)); } @@ -534,12 +548,14 @@ void TracedReference::Reset(Isolate* isolate, const Local& other) { if (other.IsEmpty()) return; this->SetSlotThreadSafe( this->New(isolate, other.val_, &this->val_, - BasicTracedReference::kWithoutDestructor)); + internal::GlobalHandleDestructionMode::kWithoutDestructor, + internal::GlobalHandleStoreMode::kAssigningStore)); } template template -TracedReference& TracedReference::operator=(TracedReference&& rhs) { +TracedReference& TracedReference::operator=( + TracedReference&& rhs) noexcept { static_assert(std::is_base_of::value, "type check"); *this = std::move(rhs.template As()); return *this; @@ -555,9 +571,10 @@ TracedReference& TracedReference::operator=( } template -TracedReference& TracedReference::operator=(TracedReference&& rhs) { +TracedReference& TracedReference::operator=( + TracedReference&& rhs) noexcept { if (this != &rhs) { - api_internal::MoveTracedGlobalReference( + internal::MoveTracedGlobalReference( reinterpret_cast(&rhs.val_), reinterpret_cast(&this->val_)); } @@ -569,7 +586,7 @@ TracedReference& TracedReference::operator=(const TracedReference& rhs) { if (this != &rhs) { this->Reset(); if (rhs.val_ != nullptr) { - api_internal::CopyTracedGlobalReference( + internal::CopyTracedGlobalReference( reinterpret_cast(&rhs.val_), reinterpret_cast(&this->val_)); } @@ -596,7 +613,7 @@ uint16_t TracedReferenceBase::WrapperClassId() const { template void TracedGlobal::SetFinalizationCallback( void* parameter, typename WeakCallbackInfo::Callback callback) { - api_internal::SetFinalizationCallbackTraced( + internal::SetFinalizationCallbackTraced( reinterpret_cast(this->val_), parameter, callback); } diff --git a/deps/include/v8-version.h b/deps/include/v8-version.h index 3f5f88cf..24da2489 100644 --- a/deps/include/v8-version.h +++ b/deps/include/v8-version.h @@ -9,9 +9,9 @@ // NOTE these macros are used by some of the tool scripts and the build // system so their names cannot be changed without changing the scripts. #define V8_MAJOR_VERSION 9 -#define V8_MINOR_VERSION 6 -#define V8_BUILD_NUMBER 180 -#define V8_PATCH_LEVEL 12 +#define V8_MINOR_VERSION 7 +#define V8_BUILD_NUMBER 106 +#define V8_PATCH_LEVEL 18 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/include/v8-wasm.h b/deps/include/v8-wasm.h index af47a3ea..612ed2fa 100644 --- a/deps/include/v8-wasm.h +++ b/deps/include/v8-wasm.h @@ -151,8 +151,12 @@ class V8_EXPORT WasmStreaming final { * {Finish} should be called after all received bytes where passed to * {OnBytesReceived} to tell V8 that there will be no more bytes. {Finish} * does not have to be called after {Abort} has been called already. + * If {can_use_compiled_module} is true and {SetCompiledModuleBytes} was + * previously called, the compiled module bytes can be used. + * If {can_use_compiled_module} is false, the compiled module bytes previously + * set by {SetCompiledModuleBytes} should not be used. */ - void Finish(); + void Finish(bool can_use_compiled_module = true); /** * Abort streaming compilation. If {exception} has a value, then the promise @@ -167,6 +171,8 @@ class V8_EXPORT WasmStreaming final { * can be used, false otherwise. The buffer passed via {bytes} and {size} * is owned by the caller. If {SetCompiledModuleBytes} returns true, the * buffer must remain valid until either {Finish} or {Abort} completes. + * The compiled module bytes should not be used until {Finish(true)} is + * called, because they can be invalidated later by {Finish(false)}. */ bool SetCompiledModuleBytes(const uint8_t* bytes, size_t size); diff --git a/deps/include/v8config.h b/deps/include/v8config.h index b010b65d..ecb99282 100644 --- a/deps/include/v8config.h +++ b/deps/include/v8config.h @@ -553,6 +553,19 @@ V8 shared library set USING_V8_SHARED. #endif // V8_OS_WIN +// The virtual memory cage is available (i.e. defined) when pointer compression +// is enabled, but it is only used when V8_VIRTUAL_MEMORY_CAGE is enabled as +// well. This allows better test coverage of the cage. +#if defined(V8_COMPRESS_POINTERS) +#define V8_VIRTUAL_MEMORY_CAGE_IS_AVAILABLE +#endif + +// CagedPointers are currently only used if the heap sandbox is enabled. +// In the future, they will be enabled when the virtual memory cage is enabled. +#if defined(V8_HEAP_SANDBOX) +#define V8_CAGED_POINTERS +#endif + // clang-format on #undef V8_HAS_CPP_ATTRIBUTE diff --git a/deps/v8 b/deps/v8 index 7a8373f1..96e2674d 160000 --- a/deps/v8 +++ b/deps/v8 @@ -1 +1 @@ -Subproject commit 7a8373f18e2327d7dc52600fc9e52cc2f5b6abf6 +Subproject commit 96e2674d6126c2ae64d44024aaa7968c853ac4a2 diff --git a/deps/v8_version b/deps/v8_version index a0b16439..36f684ce 100644 --- a/deps/v8_version +++ b/deps/v8_version @@ -1 +1 @@ -9.6.180.12 \ No newline at end of file +9.7.106.18 \ No newline at end of file