5#ifndef V8_OBJECTS_JS_FUNCTION_H_
6#define V8_OBJECTS_JS_FUNCTION_H_
19class ClosureFeedbackCellArray;
21#include "torque-generated/src/objects/js-function-tq.inc"
27 :
public TorqueGeneratedJSFunctionOrBoundFunctionOrWrappedFunction<
28 JSFunctionOrBoundFunctionOrWrappedFunction, JSObject> {
40 static_assert(kHeaderSize == JSObject::kHeaderSize);
46 :
public TorqueGeneratedJSBoundFunction<
47 JSBoundFunction, JSFunctionOrBoundFunctionOrWrappedFunction> {
67 :
public TorqueGeneratedJSWrappedFunction<
68 JSWrappedFunction, JSFunctionOrBoundFunctionOrWrappedFunction> {
95 JSFunction, JSFunctionOrBoundFunctionOrWrappedFunction> {
101 void TraceOptimizationStatus(const
char* reason, ...);
115 using TorqueGeneratedClass::context;
116 using TorqueGeneratedClass::set_context;
157 template <typename IsolateT>
160#ifdef V8_ENABLE_LEAPTIERING
165 inline void clear_dispatch_handle();
168 inline void set_dispatch_handle(
220#ifndef V8_ENABLE_LEAPTIERING
264 std::optional<CodeKind> override_active_tier = {});
311 bool reset_budget_for_feedback_allocation);
324 gc_notify_updated_slot = std::nullopt);
401 int requested_embedder_fields,
402 int requested_in_object_properties,
404 int* in_object_properties);
444#ifndef V8_ENABLE_LEAPTIERING
449 bool keep_tiering_request);
static constexpr BytecodeOffset None()
static MaybeHandle< String > GetName(Isolate *isolate, DirectHandle< JSBoundFunction > function)
static Maybe< int > GetLength(Isolate *isolate, DirectHandle< JSBoundFunction > function)
static DirectHandle< String > ToString(DirectHandle< JSBoundFunction > function)
static const int kLengthDescriptorIndex
static const int kNameDescriptorIndex
static Maybe< bool > CopyNameAndLength(Isolate *isolate, DirectHandle< JSFunctionOrBoundFunctionOrWrappedFunction > function, DirectHandle< JSReceiver > target, DirectHandle< String > prefix, int arg_count)
std::unique_ptr< char[]> DebugNameCStr()
void UpdateCodeImpl(Tagged< Code > code, WriteBarrierMode mode, bool keep_tiering_request)
static void CalculateInstanceSizeHelper(InstanceType instance_type, bool has_prototype_slot, int requested_embedder_fields, int requested_in_object_properties, int *instance_size, int *in_object_properties)
void UpdateDispatchEntryKeepTieringRequest(Tagged< Code > new_code, WriteBarrierMode mode=WriteBarrierMode::UPDATE_WRITE_BARRIER)
void ClearAllTypeFeedbackInfoForTesting()
void RequestOptimization(Isolate *isolate, CodeKind target_kind, ConcurrencyMode mode=ConcurrencyMode::kConcurrent)
bool HasAvailableHigherTierCodeThan(IsolateForSandbox isolate, CodeKind kind) const
TieringState tiering_state() const
static void SetPrototype(DirectHandle< JSFunction > function, DirectHandle< Object > value)
static constexpr int kSizeWithPrototype
int ComputeInstanceSizeWithMinSlack(Isolate *isolate)
bool tiering_in_progress() const
static const int kHeaderSize
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Map > GetDerivedRabGsabDataViewMap(Isolate *isolate, DirectHandle< JSReceiver > new_target)
static V8_WARN_UNUSED_RESULT bool SetName(DirectHandle< JSFunction > function, DirectHandle< Name > name, DirectHandle< String > prefix)
static V8_EXPORT_PRIVATE void EnsureFeedbackVector(Isolate *isolate, DirectHandle< JSFunction > function, IsCompiledScope *compiled_scope)
FeedbackVector eventually. Generally this shouldn't be used to get the.
static V8_WARN_UNUSED_RESULT int CalculateExpectedNofProperties(Isolate *isolate, DirectHandle< JSFunction > function)
Address instruction_start(IsolateForSandbox isolate) const
bool IsMaglevRequested(Isolate *isolate) const
static Handle< String > GetName(Isolate *isolate, DirectHandle< JSFunction > function)
bool HasAvailableCodeKind(IsolateForSandbox isolate, CodeKind kind) const
void UpdateCodeKeepTieringRequests(Tagged< Code > code, WriteBarrierMode mode=WriteBarrierMode::UPDATE_WRITE_BARRIER)
bool NeedsResetDueToFlushedBaselineCode(IsolateForSandbox isolate)
bool HasAvailableHigherTierCodeThanWithFilter(IsolateForSandbox isolate, CodeKind kind, CodeKinds filter_mask) const
void set_tiering_state(IsolateForSandbox isolate, TieringState state)
static constexpr int kSizeWithoutPrototype
CodeKinds GetAttachedCodeKinds(IsolateForSandbox isolate) const
Tagged< Object > raw_code(IsolateForSandbox isolate) const
bool HasAvailableOptimizedCode(IsolateForSandbox isolate) const
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Map > GetDerivedRabGsabTypedArrayMap(Isolate *isolate, DirectHandle< JSFunction > constructor, DirectHandle< JSReceiver > new_target)
bool has_closure_feedback_cell_array() const
bool ActiveTierIsMaglev(IsolateForSandbox isolate) const
void UpdateOptimizedCode(Isolate *isolate, Tagged< Code > code, WriteBarrierMode mode=WriteBarrierMode::UPDATE_WRITE_BARRIER)
static V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT MaybeHandle< Map > GetDerivedMap(Isolate *isolate, DirectHandle< JSFunction > constructor, DirectHandle< JSReceiver > new_target)
static DirectHandle< String > GetDebugName(DirectHandle< JSFunction > function)
static const int kMinDescriptorsForFastBindAndWrap
bool HasAttachedCodeKind(IsolateForSandbox isolate, CodeKind kind) const
DECL_RELEASE_ACQUIRE_ACCESSORS(prototype_or_initial_map, Tagged< UnionOf< JSPrototype, Map, Hole > >) void TraceOptimizationStatus(const char *reason
bool is_compiled(IsolateForSandbox isolate) const
static void InitializeFeedbackCell(DirectHandle< JSFunction > function, IsCompiledScope *compiled_scope, bool reset_budget_for_feedback_allocation)
static V8_EXPORT_PRIVATE void EnsureHasInitialMap(DirectHandle< JSFunction > function)
bool IsTurbofanRequested(Isolate *isolate) const
bool ActiveTierIsBaseline(IsolateForSandbox isolate) const
void UpdateDispatchEntry(Tagged< Code > new_code, WriteBarrierMode mode=WriteBarrierMode::UPDATE_WRITE_BARRIER)
static void EnsureClosureFeedbackCellArray(DirectHandle< JSFunction > function)
static DirectHandle< String > ToString(DirectHandle< JSFunction > function)
Tagged< ClosureFeedbackCellArray > closure_feedback_cell_array() const
CodeKinds GetAvailableCodeKinds(IsolateForSandbox isolate) const
bool osr_tiering_in_progress()
Tagged< NativeContext > native_context()
V8_EXPORT_PRIVATE bool HasAttachedOptimizedCode(IsolateForSandbox isolate) const
static int GetHeaderSize(bool function_has_prototype_slot)
void SetInterruptBudget(Isolate *isolate, BudgetModification kind, std::optional< CodeKind > override_active_tier={})
static void SetInitialMap(Isolate *isolate, DirectHandle< JSFunction > function, DirectHandle< Map > map, DirectHandle< JSPrototype > prototype)
bool IsLoggingRequested(Isolate *isolate) const
void ResetTieringRequests()
bool IsTieringRequestedOrInProgress() const
bool ActiveTierIsTurbofan(IsolateForSandbox isolate) const
static void CreateAndAttachFeedbackVector(Isolate *isolate, DirectHandle< JSFunction > function, IsCompiledScope *compiled_scope)
void SetTieringInProgress(bool in_progress, BytecodeOffset osr_offset=BytecodeOffset::None())
bool ChecksTieringState(IsolateForSandbox isolate)
Tagged< JSGlobalProxy > global_proxy()
std::optional< CodeKind > GetActiveTier(IsolateForSandbox isolate) const
V8_INLINE std::optional< CodeKind > GetRequestedOptimizationIfAny(Isolate *isolate, ConcurrencyMode mode=ConcurrencyMode::kConcurrent) const
bool IsOptimizationRequested(Isolate *isolate) const
void ResetIfCodeFlushed(Isolate *isolate, std::optional< std::function< void(Tagged< HeapObject > object, ObjectSlot slot, Tagged< HeapObject > target)> > gc_notify_updated_slot=std::nullopt)
void CompleteInobjectSlackTrackingIfActive()
bool NeedsResetDueToFlushedBytecode(Isolate *isolate)
bool ShouldFlushBaselineCode(base::EnumSet< CodeFlushMode > code_flush_mode)
bool CanDiscardCompiled(IsolateForSandbox isolate) const
V8_EXPORT_PRIVATE bool ActiveTierIsIgnition(IsolateForSandbox isolate) const
Tagged< AbstractCode > abstract_code(IsolateT *isolate)
void UpdateCode(Tagged< Code > code, WriteBarrierMode mode=WriteBarrierMode::UPDATE_WRITE_BARRIER)
void PrintName(FILE *out=stdout)
static DirectHandle< String > ToString(DirectHandle< JSWrappedFunction > function)
static Maybe< int > GetLength(Isolate *isolate, DirectHandle< JSWrappedFunction > function)
static MaybeDirectHandle< Object > Create(Isolate *isolate, DirectHandle< NativeContext > creation_context, DirectHandle< JSReceiver > value)
static MaybeHandle< String > GetName(Isolate *isolate, DirectHandle< JSWrappedFunction > function)
DirectHandle< Object > new_target
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
typename detail::FlattenUnionHelper< Union<>, Ts... >::type UnionOf
#define DECL_ACCESSORS(name,...)
#define DECL_GETTER(name,...)
#define DECL_VERIFIER(Name)
#define DECL_TRUSTED_POINTER_GETTERS(name, type)
#define DECL_RELAXED_GETTER(name,...)
#define DECL_PRINTER(Name)
#define DECL_RELEASE_ACQUIRE_ACCESSORS(name,...)
#define TQ_OBJECT_CONSTRUCTORS(Type)
#define V8_EXPORT_PRIVATE
#define V8_WARN_UNUSED_RESULT