5#ifndef V8_COMMON_SEGMENTED_TABLE_H_
6#define V8_COMMON_SEGMENTED_TABLE_H_
33template <
typename Entry,
size_t size>
36 static constexpr bool kIsWriteProtected = Entry::IsWriteProtected;
37 static constexpr int kEntrySize =
sizeof(Entry);
39#ifdef V8_TARGET_ARCH_64_BIT
41 static constexpr bool kUseContiguousMemory =
true;
42 static constexpr size_t kReservationSize =
size;
43 static constexpr size_t kMaxCapacity = kReservationSize / kEntrySize;
46 static constexpr bool kUseContiguousMemory =
false;
56 static constexpr size_t kSegmentSize = 64 *
KB;
57 static constexpr size_t kEntriesPerSegment = kSegmentSize / kEntrySize;
63 explicit Segment(uint32_t number) : number_(number) {}
70 static Segment Containing(uint32_t entry_index);
74 uint32_t
number()
const {
return number_; }
77 uint32_t
offset()
const {
return number_ * kSegmentSize; }
80 uint32_t
first_entry()
const {
return number_ * kEntriesPerSegment; }
84 return first_entry() + kEntriesPerSegment - 1;
89 return number_ < other.number_;
106 : next_(next),
length_(length) {}
110 uint32_t
next()
const {
return next_; }
124 static_assert(std::atomic<FreelistHead>::is_always_lock_free);
138 DCHECK(!crossed_segment_);
142 DCHECK(!crossed_segment_);
149 crossed_segment_ =
true;
158 crossed_segment_ =
true;
172 bool crossed_segment_ =
false;
177 Entry& at(uint32_t index);
178 const Entry& at(uint32_t index)
const;
186 bool is_initialized()
const;
189 Address
base()
const;
194 std::pair<Segment, FreelistHead> AllocateAndInitializeSegment();
196 std::optional<std::pair<Segment, FreelistHead>>
197 TryAllocateAndInitializeSegment();
208 void FreeTableSegment(
Segment segment);
WriteIterator & operator++()
std::conditional_t< kIsWriteProtected, CFIMetadataWriteScope, NopRwxMemoryWriteScope > write_scope_
WriteIterator & operator--()
SegmentedTable(const SegmentedTable &)=delete
SegmentedTable & operator=(const SegmentedTable &)=delete
#define V8_ENABLE_SANDBOX_BOOL
refactor address components for immediate indexing make OptimizeMaglevOnNextCall optimize to turbofan instead of maglev filter for tracing turbofan compilation trace turbo cfg trace TurboFan s graph trimmer trace TurboFan s control equivalence trace TurboFan s register allocator trace stack load store counters for optimized code in run fuzzing &&concurrent_recompilation trace_turbo trace_turbo_scheduled trace_turbo_stack_accesses verify TurboFan machine graph of code stubs enable FixedArray bounds checks print TurboFan statistics of wasm compilations maximum cumulative size of bytecode considered for inlining scale factor of bytecode size used to calculate the inlining budget * KB
#define DCHECK(condition)
#define DCHECK_GT(v1, v2)
#define V8_EXPORT_PRIVATE
constexpr bool IsAligned(T value, U alignment)
constexpr FreelistHead(uint32_t next, uint32_t length)
uint32_t first_entry() const
bool operator<(const Segment &other) const
uint32_t last_entry() const