Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade V8 binaries for 12.9.202.22 version #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deps/include/cppgc/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include_rules = [
"-include",
"+v8config.h",
"+v8-platform.h",
"+v8-source-location.h",
"+cppgc",
"-src",
"+libplatform/libplatform.h",
Expand Down
21 changes: 10 additions & 11 deletions deps/include/cppgc/allocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace internal {
// Similar to C++17 std::align_val_t;
enum class AlignVal : size_t {};

class V8_EXPORT MakeGarbageCollectedTraitInternal {
class MakeGarbageCollectedTraitInternal {
protected:
static inline void MarkObjectAsFullyConstructed(const void* payload) {
// See api_constants for an explanation of the constants.
Expand Down Expand Up @@ -121,16 +121,15 @@ class V8_EXPORT MakeGarbageCollectedTraitInternal {
};

private:
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);
V8_EXPORT static void* CPPGC_DEFAULT_ALIGNED
Allocate(cppgc::AllocationHandle&, size_t, GCInfoIndex);
V8_EXPORT static void* CPPGC_DOUBLE_WORD_ALIGNED
Allocate(cppgc::AllocationHandle&, size_t, AlignVal, GCInfoIndex);
V8_EXPORT static void* CPPGC_DEFAULT_ALIGNED
Allocate(cppgc::AllocationHandle&, size_t, GCInfoIndex, CustomSpaceIndex);
V8_EXPORT static void* CPPGC_DOUBLE_WORD_ALIGNED
Allocate(cppgc::AllocationHandle&, size_t, AlignVal, GCInfoIndex,
CustomSpaceIndex);

friend class HeapObjectHeader;
};
Expand Down
6 changes: 4 additions & 2 deletions deps/include/cppgc/cross-thread-persistent.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ class BasicCrossThreadPersistent final : public CrossThreadPersistentBase,

template <typename U, typename MemberBarrierPolicy,
typename MemberWeaknessTag, typename MemberCheckingPolicy,
typename MemberStorageType,
typename = std::enable_if_t<std::is_base_of<T, U>::value>>
BasicCrossThreadPersistent(
internal::BasicMember<U, MemberBarrierPolicy, MemberWeaknessTag,
MemberCheckingPolicy>
MemberCheckingPolicy, MemberStorageType>
member,
const SourceLocation& loc = SourceLocation::Current())
: BasicCrossThreadPersistent(member.Get(), loc) {}
Expand Down Expand Up @@ -230,10 +231,11 @@ class BasicCrossThreadPersistent final : public CrossThreadPersistentBase,
// Assignment from member.
template <typename U, typename MemberBarrierPolicy,
typename MemberWeaknessTag, typename MemberCheckingPolicy,
typename MemberStorageType,
typename = std::enable_if_t<std::is_base_of<T, U>::value>>
BasicCrossThreadPersistent& operator=(
internal::BasicMember<U, MemberBarrierPolicy, MemberWeaknessTag,
MemberCheckingPolicy>
MemberCheckingPolicy, MemberStorageType>
member) {
return operator=(member.Get());
}
Expand Down
8 changes: 8 additions & 0 deletions deps/include/cppgc/garbage-collected.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ class GarbageCollectedMixin {
public:
using IsGarbageCollectedMixinTypeMarker = void;

// Must use MakeGarbageCollected.
void* operator new(size_t) = delete;
void* operator new[](size_t) = delete;
// The garbage collector is taking care of reclaiming the object.
// Not override the non-array varaint of `delete` to not conflict with the
// operator in GarbageCollected above.
void operator delete[](void*) = delete;

/**
* This Trace method must be overriden by objects inheriting from
* GarbageCollectedMixin.
Expand Down
4 changes: 2 additions & 2 deletions deps/include/cppgc/heap-consistency.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ class HeapConsistency final {
* \returns whether a write barrier is needed and which barrier to invoke.
*/
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
typename CheckingPolicy>
typename CheckingPolicy, typename StorageType>
static V8_INLINE WriteBarrierType GetWriteBarrierType(
const internal::BasicMember<T, WeaknessTag, WriteBarrierPolicy,
CheckingPolicy>& value,
CheckingPolicy, StorageType>& value,
WriteBarrierParams& params) {
return internal::WriteBarrier::GetWriteBarrierType(
value.GetRawSlot(), value.GetRawStorage(), params);
Expand Down
2 changes: 2 additions & 0 deletions deps/include/cppgc/heap-statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ struct HeapStatistics final {
size_t resident_size_bytes = 0;
/** Amount of memory actually used on the heap. */
size_t used_size_bytes = 0;
/** Memory retained in the page pool, not used directly by the heap. */
size_t pooled_memory_size_bytes = 0;
/** Detail level of this HeapStatistics. */
DetailLevel detail_level;

Expand Down
39 changes: 33 additions & 6 deletions deps/include/cppgc/internal/api-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,47 @@ static constexpr size_t kFullyConstructedBitFieldOffsetFromPayload =
// Mask for in-construction bit.
static constexpr uint16_t kFullyConstructedBitMask = uint16_t{1};

static constexpr size_t kPageSize = size_t{1} << 17;
static constexpr size_t kPageSizeBits = 17;
static constexpr size_t kPageSize = size_t{1} << kPageSizeBits;

#if defined(V8_TARGET_ARCH_ARM64) && defined(V8_OS_MACOS)
#if defined(V8_HOST_ARCH_ARM64) && defined(V8_OS_DARWIN)
constexpr size_t kGuardPageSize = 0;
#elif defined(V8_HOST_ARCH_PPC64)
constexpr size_t kGuardPageSize = 0;
#elif defined(V8_HOST_ARCH_LOONG64) || defined(V8_HOST_ARCH_MIPS64)
constexpr size_t kGuardPageSize = 0;
#else
constexpr size_t kGuardPageSize = 4096;
#endif

static constexpr size_t kLargeObjectSizeThreshold = kPageSize / 2;

#if defined(CPPGC_POINTER_COMPRESSION)
#if defined(CPPGC_ENABLE_LARGER_CAGE)
constexpr unsigned kPointerCompressionShift = 3;
#else // !defined(CPPGC_ENABLE_LARGER_CAGE)
constexpr unsigned kPointerCompressionShift = 1;
#endif // !defined(CPPGC_ENABLE_LARGER_CAGE)
#endif // !defined(CPPGC_POINTER_COMPRESSION)

#if defined(CPPGC_CAGED_HEAP)
#if defined(CPPGC_2GB_CAGE)
constexpr size_t kCagedHeapReservationSize = static_cast<size_t>(2) * kGB;
#else // !defined(CPPGC_2GB_CAGE)
constexpr size_t kCagedHeapReservationSize = static_cast<size_t>(4) * kGB;
constexpr size_t kCagedHeapDefaultReservationSize =
static_cast<size_t>(2) * kGB;
constexpr size_t kCagedHeapMaxReservationSize =
kCagedHeapDefaultReservationSize;
#else // !defined(CPPGC_2GB_CAGE)
constexpr size_t kCagedHeapDefaultReservationSize =
static_cast<size_t>(4) * kGB;
#if defined(CPPGC_POINTER_COMPRESSION)
constexpr size_t kCagedHeapMaxReservationSize =
size_t{1} << (31 + kPointerCompressionShift);
#else // !defined(CPPGC_POINTER_COMPRESSION)
constexpr size_t kCagedHeapMaxReservationSize =
kCagedHeapDefaultReservationSize;
#endif // !defined(CPPGC_POINTER_COMPRESSION)
#endif // !defined(CPPGC_2GB_CAGE)
constexpr size_t kCagedHeapReservationAlignment = kCagedHeapReservationSize;
constexpr size_t kCagedHeapReservationAlignment = kCagedHeapMaxReservationSize;
#endif // defined(CPPGC_CAGED_HEAP)

static constexpr size_t kDefaultAlignment = sizeof(void*);
Expand All @@ -57,6 +81,9 @@ static constexpr size_t kMaxSupportedAlignment = 2 * kDefaultAlignment;
// Granularity of heap allocations.
constexpr size_t kAllocationGranularity = sizeof(void*);

// Default cacheline size.
constexpr size_t kCachelineSize = 64;

} // namespace api_constants

} // namespace internal
Expand Down
22 changes: 16 additions & 6 deletions deps/include/cppgc/internal/caged-heap-local-data.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ class V8_EXPORT AgeTable final {
enum class AdjacentCardsPolicy : uint8_t { kConsider, kIgnore };

static constexpr size_t kCardSizeInBytes =
api_constants::kCagedHeapReservationSize / kRequiredSize;
api_constants::kCagedHeapDefaultReservationSize / kRequiredSize;

static constexpr size_t CalculateAgeTableSizeForHeapSize(size_t heap_size) {
return heap_size / kCardSizeInBytes;
}

void SetAge(uintptr_t cage_offset, Age age) {
table_[card(cage_offset)] = age;
Expand Down Expand Up @@ -81,23 +85,29 @@ class V8_EXPORT AgeTable final {
#endif // !V8_HAS_BUILTIN_CTZ
static_assert((1 << kGranularityBits) == kCardSizeInBytes);
const size_t entry = offset >> kGranularityBits;
CPPGC_DCHECK(table_.size() > entry);
CPPGC_DCHECK(CagedHeapBase::GetAgeTableSize() > entry);
return entry;
}

std::array<Age, kRequiredSize> table_;
#if defined(V8_CC_GNU)
// gcc disallows flexible arrays in otherwise empty classes.
Age table_[0];
#else // !defined(V8_CC_GNU)
Age table_[];
#endif // !defined(V8_CC_GNU)
};

static_assert(sizeof(AgeTable) == 1 * api_constants::kMB,
"Size of AgeTable is 1MB");

#endif // CPPGC_YOUNG_GENERATION

struct CagedHeapLocalData final {
V8_INLINE static CagedHeapLocalData& Get() {
return *reinterpret_cast<CagedHeapLocalData*>(CagedHeapBase::GetBase());
}

static constexpr size_t CalculateLocalDataSizeForHeapSize(size_t heap_size) {
return AgeTable::CalculateAgeTableSizeForHeapSize(heap_size);
}

#if defined(CPPGC_YOUNG_GENERATION)
AgeTable age_table;
#endif
Expand Down
17 changes: 12 additions & 5 deletions deps/include/cppgc/internal/caged-heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,31 @@ class V8_EXPORT CagedHeapBase {

V8_INLINE static bool AreWithinCage(const void* addr1, const void* addr2) {
#if defined(CPPGC_2GB_CAGE)
static constexpr size_t kHalfWordShift = sizeof(uint32_t) * CHAR_BIT - 1;
static constexpr size_t kHeapBaseShift = sizeof(uint32_t) * CHAR_BIT - 1;
#else //! defined(CPPGC_2GB_CAGE)
static constexpr size_t kHalfWordShift = sizeof(uint32_t) * CHAR_BIT;
#if defined(CPPGC_POINTER_COMPRESSION)
static constexpr size_t kHeapBaseShift =
31 + api_constants::kPointerCompressionShift;
#else // !defined(CPPGC_POINTER_COMPRESSION)
static constexpr size_t kHeapBaseShift = sizeof(uint32_t) * CHAR_BIT;
#endif // !defined(CPPGC_POINTER_COMPRESSION)
#endif //! defined(CPPGC_2GB_CAGE)
static_assert((static_cast<size_t>(1) << kHalfWordShift) ==
api_constants::kCagedHeapReservationSize);
static_assert((static_cast<size_t>(1) << kHeapBaseShift) ==
api_constants::kCagedHeapMaxReservationSize);
CPPGC_DCHECK(g_heap_base_);
return !(((reinterpret_cast<uintptr_t>(addr1) ^ g_heap_base_) |
(reinterpret_cast<uintptr_t>(addr2) ^ g_heap_base_)) >>
kHalfWordShift);
kHeapBaseShift);
}

V8_INLINE static uintptr_t GetBase() { return g_heap_base_; }
V8_INLINE static size_t GetAgeTableSize() { return g_age_table_size_; }

private:
friend class CagedHeap;

static uintptr_t g_heap_base_;
static size_t g_age_table_size_;
};

} // namespace internal
Expand Down
10 changes: 9 additions & 1 deletion deps/include/cppgc/internal/compiler-specific.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_
#define INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_

#include "v8config.h" // NOLINT(build/include_directory)

namespace cppgc {

#if defined(__has_attribute)
Expand All @@ -21,7 +23,13 @@ namespace cppgc {

// [[no_unique_address]] comes in C++20 but supported in clang with -std >=
// c++11.
#if CPPGC_HAS_CPP_ATTRIBUTE(no_unique_address)
#if defined(V8_CC_MSVC) && CPPGC_HAS_CPP_ATTRIBUTE(msvc::no_unique_address)
// Unfortunately MSVC ignores [[no_unique_address]] (see
// https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/#msvc-extensions-and-abi),
// and clang-cl matches it for ABI compatibility reasons. We need to prefer
// [[msvc::no_unique_address]] when available if we actually want any effect.
#define CPPGC_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
#elif CPPGC_HAS_CPP_ATTRIBUTE(no_unique_address)
#define CPPGC_NO_UNIQUE_ADDRESS [[no_unique_address]]
#else
#define CPPGC_NO_UNIQUE_ADDRESS
Expand Down
Loading