5#ifndef V8_OBJECTS_FEEDBACK_VECTOR_INL_H_
6#define V8_OBJECTS_FEEDBACK_VECTOR_INL_H_
30#include "torque-generated/src/objects/feedback-vector-tq-inl.inc"
41 kCreateClosureSlotCountOffset)
63#ifndef V8_ENABLE_LEAPTIERING
71 if (code_kind != CodeKind::MAGLEV) {
131 return shared_function_info(cage_base)->feedback_metadata(cage_base);
135 return shared_function_info(cage_base)->feedback_metadata(cage_base,
140 kInvocationCountOffset)
143 set_invocation_count(0, tag);
147 kInvocationCountBeforeStableOffset)
150 return OsrUrgencyBits::decode(osr_state());
156 set_osr_state(OsrUrgencyBits::update(osr_state(), urgency));
172 return MaybeHasMaglevOsrCodeBit::decode(osr_state());
176 return MaybeHasTurbofanOsrCodeBit::decode(osr_state());
181 if (code_kind == CodeKind::MAGLEV) {
183 set_osr_state(MaybeHasMaglevOsrCodeBit::update(osr_state(), value));
185 CHECK_EQ(code_kind, CodeKind::TURBOFAN_JS);
186 set_osr_state(MaybeHasTurbofanOsrCodeBit::update(osr_state(), value));
191 return InterruptBudgetResetByIcChangeBit::decode(
flags());
195 set_flags(InterruptBudgetResetByIcChangeBit::update(
flags(), value));
208#ifdef V8_ENABLE_LEAPTIERING
210bool FeedbackVector::tiering_in_progress()
const {
211 return TieringInProgressBit::decode(
flags());
217 return TieringStateBits::decode(
flags());
225 return LogNextExecutionBit::decode(
flags());
229 set_flags(LogNextExecutionBit::update(
flags(), value));
253 bool is_cleared = maybe_optimized_code().IsCleared();
260 return MaybeHasMaglevCodeBit::decode(
flags());
264 set_flags(MaybeHasMaglevCodeBit::update(
flags(), value));
268 return MaybeHasTurbofanCodeBit::decode(
flags());
272 set_flags(MaybeHasTurbofanCodeBit::update(
flags(), value));
284 if (code->marked_for_deoptimization()) {
301 static_cast<uintptr_t
>(std::numeric_limits<int>::max()));
310 if (value.GetHeapObject(&heap_object)) {
311 return IsFixedArray(heap_object) && !IsHashTable(heap_object);
319 DCHECK(!IsOfLegacyType(value));
327 DCHECK(!IsOfLegacyType(value));
332 Isolate* isolate,
int index)
const {
334 return direct_handle(closure_feedback_cell_array()->get(index), isolate);
339 return closure_feedback_cell_array()->get(index);
343 const int i = slot.
ToInt();
348 DCHECK(!IsOfLegacyType(value));
355 DCHECK(!IsOfLegacyType(value));
356 const int i = slot.
ToInt();
365 DCHECK(!IsOfLegacyType(value));
375 switch (type_feedback) {
403template <CompareOperationFeedback::Type Feedback>
404bool Is(
int type_feedback) {
405 return !(type_feedback & ~Feedback);
450 switch (type_feedback) {
464 return isolate->factory()->uninitialized_symbol();
468 return isolate->factory()->megamorphic_symbol();
472 return isolate->factory()->mega_dom_symbol();
506 return vector->SynchronizedGet(slot);
513 vector->SynchronizedSet(slot, feedback, mode);
567template <
typename FeedbackType>
573template <
typename FeedbackType,
typename FeedbackExtraType>
592 if (!it.handler().IsCleared()) {
Tagged< MaybeObject > UninitializedSentinel() const
const NexusConfig * config() const
Tagged< FeedbackVector > vector() const
Tagged< MaybeObject > GetFeedbackExtra() const
std::pair< Tagged< MaybeObject >, Tagged< MaybeObject > > GetFeedbackPair() const
FeedbackSlotKind kind() const
FeedbackSlot slot() const
Tagged< MaybeObject > GetFeedback() const
Tagged< MaybeObject > MegaDOMSentinel() const
std::optional< std::pair< MaybeObjectHandle, MaybeObjectHandle > > feedback_cache_
MaybeObjectHandle ToHandle(Tagged< MaybeObject > value) const
Tagged< MaybeObject > FromHandle(MaybeObjectDirectHandle slot) const
Tagged< MaybeObject > MegamorphicSentinel() const
void SetFeedback(Tagged< FeedbackType > feedback, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
void IterateMapsWithUnclearedHandler(F) const
static FeedbackSlot Invalid()
V8_EXPORT_PRIVATE void set_tiering_state(TieringState state)
bool was_once_deoptimized() const
static DirectHandle< Symbol > MegaDOMSentinel(Isolate *isolate)
Tagged< MaybeObject > Get(FeedbackSlot slot) const
static FeedbackSlot ToSlot(intptr_t index)
static DirectHandle< Symbol > UninitializedSentinel(Isolate *isolate)
Tagged< Code > optimized_code(IsolateForSandbox isolate) const
void set_maybe_has_turbofan_code(bool value)
void set_maybe_has_optimized_osr_code(bool value, CodeKind code_kind)
bool maybe_has_optimized_osr_code() const
bool has_optimized_code() const
void RequestOsrAtNextOpportunity()
Tagged< FeedbackCell > closure_feedback_cell(int index) const
void Set(FeedbackSlot slot, Tagged< MaybeObject > value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
static Tagged< Symbol > RawUninitializedSentinel(Isolate *isolate)
static constexpr uint8_t kInvocationCountBeforeStableDeoptSentinel
bool maybe_has_maglev_osr_code() const
static constexpr uint32_t kFlagsMaybeHasMaglevCode
MaybeObjectSlot slots_start()
bool maybe_has_turbofan_code() const
bool maybe_has_maglev_code() const
bool log_next_execution() const
std::optional< Tagged< Code > > GetOptimizedOsrCode(Isolate *isolate, FeedbackSlot slot)
void set_log_next_execution(bool value=true)
Tagged< MaybeObject > SynchronizedGet(FeedbackSlot slot) const
DirectHandle< FeedbackCell > GetClosureFeedbackCell(Isolate *isolate, int index) const
static int GetIndex(FeedbackSlot slot)
void reset_tiering_state()
void set_maybe_has_maglev_code(bool value)
void SynchronizedSet(FeedbackSlot slot, Tagged< MaybeObject > value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
TieringState tiering_state() const
static constexpr uint32_t kFlagsTieringStateIsAnyRequested
bool interrupt_budget_reset_by_ic_change() const
void clear_invocation_count(RelaxedStoreTag tag)
static constexpr uint32_t kFlagsLogNextExecution
void set_was_once_deoptimized()
static Handle< Symbol > MegamorphicSentinel(Isolate *isolate)
bool maybe_has_turbofan_osr_code() const
void set_interrupt_budget_reset_by_ic_change(bool value)
void set_osr_urgency(int urgency)
static constexpr uint32_t kFlagsMaybeHasTurbofanCode
static constexpr int kMaxOsrUrgency
static constexpr uint32_t FlagMaskForNeedsProcessingCheckFrom(CodeKind code_kind)
static constexpr int OffsetOfElementAt(int index)
static constexpr int kHeaderSize
T ReadField(size_t offset) const
void WriteField(size_t offset, T value) const
Tagged< MaybeObject > GetFeedback(Tagged< FeedbackVector > vector, FeedbackSlot slot) const
MaybeObjectHandle NewHandle(Tagged< MaybeObject > object) const
void SetFeedback(Tagged< FeedbackVector > vector, FeedbackSlot slot, Tagged< MaybeObject > object, WriteBarrierMode mode=UPDATE_WRITE_BARRIER) const
LocalHeap *const local_heap_
static void Release_Store(Tagged< HeapObject > host, PtrType value)
static PtrType Acquire_Load(Tagged< HeapObject > host, int offset=0)
constexpr bool IsCleared() const
bool GetHeapObject(Tagged< HeapObject > *result) const
constexpr bool IsWeakOrCleared() const
@ kReceiverOrNullOrUndefined
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
constexpr int kTaggedSize
ForInHint ForInHintFromFeedback(ForInFeedback type_feedback)
bool Is(IndirectHandle< U > value)
CompareOperationHint CompareOperationHintFromFeedback(int type_feedback)
constexpr bool CodeKindCanTierUp(CodeKind kind)
@ kLoadGlobalNotInsideTypeof
@ kLoadGlobalInsideTypeof
@ kDefineKeyedOwnPropertyInLiteral
V8_INLINE DirectHandle< T > direct_handle(Tagged< T > object, Isolate *isolate)
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in allocation gc speed threshold for starting incremental marking via a task in percent of available threshold for starting incremental marking immediately in percent of available Use a single schedule for determining a marking schedule between JS and C objects schedules the minor GC task with kUserVisible priority max worker number of concurrent for NumberOfWorkerThreads start background threads that allocate memory concurrent_array_buffer_sweeping use parallel threads to clear weak refs in the atomic pause trace progress of the incremental marking trace object counts and memory usage report a tick only when allocated zone memory changes by this amount TracingFlags::gc_stats TracingFlags::gc_stats track native contexts that are expected to be garbage collected verify heap pointers before and after GC memory reducer runs GC with ReduceMemoryFootprint flag Maximum number of memory reducer GCs scheduled Old gen GC speed is computed directly from gc tracer counters Perform compaction on full GCs based on V8 s default heuristics Perform compaction on every full GC Perform code space compaction when finalizing a full GC with stack Stress GC compaction to flush out bugs with moving objects flush of baseline code when it has not been executed recently Use time base code flushing instead of age Use a progress bar to scan large objects in increments when incremental marking is active force incremental marking for small heaps and run it more often force marking at random points between and force scavenge at random points between and reclaim otherwise unreachable unmodified wrapper objects when possible less compaction in non memory reducing mode use high priority threads for concurrent Marking Test mode only flag It allows an unit test to select evacuation candidates use incremental marking for CppHeap cppheap_concurrent_marking c value for membalancer A special constant to balance between memory and space tradeoff The smaller the more memory it uses enable use of SSE4 instructions if available enable use of AVX VNNI instructions if available enable use of POPCNT instruction if available force all emitted branches to be in long mode(MIPS/PPC only)") DEFINE_BOOL(partial_constant_pool
Tagged< ClearedWeakValue > ClearedValue(PtrComprCageBase cage_base)
V8_EXPORT_PRIVATE FlagValues v8_flags
@ kEnumCacheKeysAndIndices
@ kEnumCacheKeysAndIndices
BinaryOperationHint BinaryOperationHintFromFeedback(int type_feedback)
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
static constexpr RelaxedLoadTag kRelaxedLoad
static constexpr RelaxedStoreTag kRelaxedStore
static constexpr AcquireLoadTag kAcquireLoad
#define RELAXED_UINT8_ACCESSORS(holder, name, offset)
#define OBJECT_CONSTRUCTORS_IMPL(Type, Super)
#define DEF_ACQUIRE_GETTER(holder, name,...)
#define ACQUIRE_READ_INT32_FIELD(p, offset)
#define TQ_OBJECT_CONSTRUCTORS_IMPL(Type)
#define CONDITIONAL_WRITE_BARRIER(object, offset, value, mode)
#define RELAXED_INT32_ACCESSORS(holder, name, offset)
#define INT32_ACCESSORS(holder, name, offset)
#define NEVER_READ_ONLY_SPACE_IMPL(Type)
#define DEF_GETTER(Camel, Lower, Bit)
#define DCHECK_LE(v1, v2)
#define CHECK_LT(lhs, rhs)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK_GE(v1, v2)
#define CHECK_EQ(lhs, rhs)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)