Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
dart::Function Class Reference

#include <object.h>

Inheritance diagram for dart::Function:
dart::Object

Classes

struct  AwaiterLink
 
struct  ICDataArrayIndices
 
class  KindBits
 
class  ModifierBits
 
class  RecognizedBits
 

Public Types

enum  StateBits
 
enum  KindTagBits {
  kKindTagPos = 0 , kKindTagSize = 5 , kRecognizedTagPos = kKindTagPos + kKindTagSize , kRecognizedTagSize = 9 ,
  kModifierPos = kRecognizedTagPos + kRecognizedTagSize , kModifierSize = 2 , kLastModifierBitPos = kModifierPos + (kModifierSize - 1) , kNumTagBits
}
 
- Public Types inherited from dart::Object
enum  NameVisibility { kInternalName = 0 , kScrubbedName , kUserVisibleName }
 
enum class  NameDisambiguation { kYes , kNo }
 
using UntaggedObjectType = UntaggedObject
 
using ObjectPtrType = ObjectPtr
 

Public Member Functions

StringPtr name () const
 
StringPtr UserVisibleName () const
 
const char * UserVisibleNameCString () const
 
const char * NameCString (NameVisibility name_visibility) const
 
void PrintName (const NameFormattingParams &params, BaseTextBuffer *printer) const
 
StringPtr QualifiedScrubbedName () const
 
const char * QualifiedScrubbedNameCString () const
 
StringPtr QualifiedUserVisibleName () const
 
const char * QualifiedUserVisibleNameCString () const
 
virtual StringPtr DictionaryName () const
 
StringPtr GetSource () const
 
void SetFfiCSignature (const FunctionType &sig) const
 
FunctionTypePtr FfiCSignature () const
 
bool FfiCSignatureContainsHandles () const
 
bool FfiCSignatureReturnsStruct () const
 
int32_t FfiCallbackId () const
 
void AssignFfiCallbackId (int32_t callback_id) const
 
bool FfiIsLeaf () const
 
FunctionPtr FfiCallbackTarget () const
 
void SetFfiCallbackTarget (const Function &target) const
 
InstancePtr FfiCallbackExceptionalReturn () const
 
void SetFfiCallbackExceptionalReturn (const Instance &value) const
 
FfiCallbackKind GetFfiCallbackKind () const
 
void SetFfiCallbackKind (FfiCallbackKind value) const
 
 PRECOMPILER_WSR_FIELD_DECLARATION (FunctionType, signature)
 
void SetSignature (const FunctionType &value) const
 
StringPtr InternalSignature () const
 
StringPtr UserVisibleSignature () const
 
bool HasInstantiatedSignature (Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
 
bool IsPrivate () const
 
ClassPtr Owner () const
 
void set_owner (const Object &value) const
 
ScriptPtr script () const
 
KernelProgramInfoPtr KernelProgramInfo () const
 
ObjectPtr RawOwner () const
 
RegExpPtr regexp () const
 
intptr_t string_specialization_cid () const
 
bool is_sticky_specialization () const
 
void SetRegExpData (const RegExp &regexp, intptr_t string_specialization_cid, bool sticky) const
 
StringPtr native_name () const
 
void set_native_name (const String &name) const
 
InstancePtr GetNativeAnnotation () const
 
bool is_ffi_native () const
 
bool is_old_native () const
 
AbstractTypePtr result_type () const
 
AbstractTypePtr ParameterTypeAt (intptr_t index) const
 
ArrayPtr parameter_types () const
 
StringPtr ParameterNameAt (intptr_t index) const
 
void SetParameterNameAt (intptr_t index, const String &value) const
 
void CreateNameArray (Heap::Space space=Heap::kOld) const
 
bool IsRequiredAt (intptr_t index) const
 
TypeParametersPtr type_parameters () const
 
intptr_t NumTypeParameters () const
 
intptr_t NumParentTypeArguments () const
 
intptr_t NumTypeArguments () const
 
bool IsGeneric () const
 
bool HasGenericParent () const
 
TypeParameterPtr TypeParameterAt (intptr_t index, Nullability nullability=Nullability::kNonNullable) const
 
void InstallOptimizedCode (const Code &code) const
 
void AttachCode (const Code &value) const
 
void SetInstructions (const Code &value) const
 
void SetInstructionsSafe (const Code &value) const
 
void ClearCode () const
 
void ClearCodeSafe () const
 
void SwitchToUnoptimizedCode () const
 
CodePtr EnsureHasCode () const
 
void SwitchToLazyCompiledUnoptimizedCode () const
 
void EnsureHasCompiledUnoptimizedCode () const
 
CodePtr CurrentCode () const
 
bool SafeToClosurize () const
 
CodePtr unoptimized_code () const
 
void set_unoptimized_code (const Code &value) const
 
bool HasCode () const
 
uword entry_point () const
 
virtual uword Hash () const
 
bool HasBreakpoint () const
 
ContextScopePtr context_scope () const
 
void set_context_scope (const ContextScope &value) const
 
AwaiterLink awaiter_link () const
 
void set_awaiter_link (AwaiterLink link) const
 
bool HasAwaiterLink () const
 
FunctionPtr parent_function () const
 
TypeArgumentsPtr DefaultTypeArguments (Zone *zone) const
 
InstantiationMode default_type_arguments_instantiation_mode () const
 
void set_default_type_arguments_instantiation_mode (InstantiationMode value) const
 
FunctionPtr GetOutermostFunction () const
 
void set_extracted_method_closure (const Function &function) const
 
FunctionPtr extracted_method_closure () const
 
void set_saved_args_desc (const Array &array) const
 
ArrayPtr saved_args_desc () const
 
bool HasSavedArgumentsDescriptor () const
 
void set_accessor_field (const Field &value) const
 
FieldPtr accessor_field () const
 
bool IsRegularFunction () const
 
bool IsMethodExtractor () const
 
bool IsNoSuchMethodDispatcher () const
 
bool IsRecordFieldGetter () const
 
bool IsInvokeFieldDispatcher () const
 
bool IsDynamicInvokeFieldDispatcher () const
 
bool IsDynamicClosureCallDispatcher () const
 
bool IsDynamicClosureCallDispatcher (Thread *thread) const
 
bool IsDynamicInvocationForwarder () const
 
bool IsImplicitGetterOrSetter () const
 
bool HasImplicitClosureFunction () const
 
FunctionPtr ImplicitClosureFunction () const
 
void DropUncompiledImplicitClosureFunction () const
 
ClosurePtr ImplicitStaticClosure () const
 
ClosurePtr ImplicitInstanceClosure (const Instance &receiver) const
 
FunctionPtr ImplicitClosureTarget (Zone *zone) const
 
FunctionPtr ForwardingTarget () const
 
void SetForwardingTarget (const Function &target) const
 
UntaggedFunction::Kind kind () const
 
UntaggedFunction::AsyncModifier modifier () const
 
bool IsConstructor () const
 
bool IsGenerativeConstructor () const
 
bool IsImplicitConstructor () const
 
bool IsFactory () const
 
bool HasThisParameter () const
 
bool IsDynamicFunction (bool allow_abstract=false) const
 
bool IsStaticFunction () const
 
bool NeedsTypeArgumentTypeChecks () const
 
bool NeedsArgumentTypeChecks () const
 
bool NeedsMonomorphicCheckedEntry (Zone *zone) const
 
bool HasDynamicCallers (Zone *zone) const
 
bool PrologueNeedsArgumentsDescriptor () const
 
bool MayHaveUncheckedEntryPoint () const
 
TokenPosition token_pos () const
 
void set_token_pos (TokenPosition value) const
 
TokenPosition end_token_pos () const
 
void set_end_token_pos (TokenPosition value) const
 
intptr_t SourceSize () const
 
uint32_t packed_fields () const
 
void set_packed_fields (uint32_t packed_fields) const
 
intptr_t num_fixed_parameters () const
 
bool HasOptionalParameters () const
 
bool HasOptionalNamedParameters () const
 
bool HasRequiredNamedParameters () const
 
bool HasOptionalPositionalParameters () const
 
intptr_t NumOptionalParameters () const
 
intptr_t NumOptionalPositionalParameters () const
 
intptr_t NumOptionalNamedParameters () const
 
intptr_t NumParameters () const
 
intptr_t NumImplicitParameters () const
 
bool MakesCopyOfParameters () const
 
intptr_t MaxNumberOfParametersInRegisters (Zone *zone) const
 
intptr_t kernel_offset () const
 
void set_kernel_offset (intptr_t value) const
 
void InheritKernelOffsetFrom (const Function &src) const
 
void InheritKernelOffsetFrom (const Field &src) const
 
void SetOptimizedInstructionCountClamped (uintptr_t value) const
 
void SetOptimizedCallSiteCountClamped (uintptr_t value) const
 
void SetKernelLibraryAndEvalScript (const Script &script, const class KernelProgramInfo &kernel_program_info, intptr_t index) const
 
intptr_t KernelLibraryOffset () const
 
intptr_t KernelLibraryIndex () const
 
TypedDataViewPtr KernelLibrary () const
 
bool IsOptimizable () const
 
void SetIsOptimizable (bool value) const
 
bool ForceOptimize () const
 
bool IsPreferInline () const
 
bool IsIdempotent () const
 
bool IsCachableIdempotent () const
 
bool RecognizedKindForceOptimize () const
 
bool CanBeInlined () const
 
MethodRecognizer::Kind recognized_kind () const
 
void set_recognized_kind (MethodRecognizer::Kind value) const
 
bool IsRecognized () const
 
bool HasOptimizedCode () const
 
bool AreValidArgumentCounts (intptr_t num_type_arguments, intptr_t num_arguments, intptr_t num_named_arguments, String *error_message) const
 
ObjectPtr DoArgumentTypesMatch (const Array &args, const ArgumentsDescriptor &arg_names) const
 
ObjectPtr DoArgumentTypesMatch (const Array &args, const ArgumentsDescriptor &arg_names, const TypeArguments &instantiator_type_args) const
 
ObjectPtr DoArgumentTypesMatch (const Array &args, const ArgumentsDescriptor &arg_names, const TypeArguments &instantiator_type_args, const TypeArguments &function_type_args) const
 
bool AreValidArguments (intptr_t num_type_arguments, intptr_t num_arguments, const Array &argument_names, String *error_message) const
 
bool AreValidArguments (const ArgumentsDescriptor &args_desc, String *error_message) const
 
const char * ToFullyQualifiedCString () const
 
const char * ToLibNamePrefixedQualifiedCString () const
 
const char * ToQualifiedCString () const
 
void reset_unboxed_parameters_and_return () const
 
void set_unboxed_integer_parameter_at (intptr_t index) const
 
void set_unboxed_double_parameter_at (intptr_t index) const
 
void set_unboxed_integer_return () const
 
void set_unboxed_double_return () const
 
void set_unboxed_record_return () const
 
bool is_unboxed_parameter_at (intptr_t index) const
 
bool is_unboxed_integer_parameter_at (intptr_t index) const
 
bool is_unboxed_double_parameter_at (intptr_t index) const
 
bool has_unboxed_return () const
 
bool has_unboxed_integer_return () const
 
bool has_unboxed_double_return () const
 
bool has_unboxed_record_return () const
 
bool HasUnboxedParameters () const
 
bool HasUnboxedReturnValue () const
 
bool IsDispatcherOrImplicitAccessor () const
 
bool IsGetterFunction () const
 
bool IsImplicitGetterFunction () const
 
bool IsImplicitStaticGetterFunction () const
 
bool IsSetterFunction () const
 
bool IsImplicitSetterFunction () const
 
bool IsFieldInitializer () const
 
bool IsClosureFunction () const
 
bool IsIrregexpFunction () const
 
bool IsImplicitClosureFunction () const
 
bool IsNonImplicitClosureFunction () const
 
bool IsImplicitStaticClosureFunction () const
 
bool IsImplicitInstanceClosureFunction () const
 
bool HasParent () const
 
bool IsLocalFunction () const
 
bool IsFfiCallbackTrampoline () const
 
bool IsFfiCallClosure () const
 
InstancePtr GetFfiCallClosurePragmaValue () const
 
bool IsSuspendableFunction () const
 
bool IsAsyncFunction () const
 
bool IsSyncGenerator () const
 
bool IsAsyncGenerator () const
 
bool IsTypedDataViewFactory () const
 
bool IsUnmodifiableTypedDataViewFactory () const
 
DART_WARN_UNUSED_RESULT ErrorPtr VerifyCallEntryPoint () const
 
DART_WARN_UNUSED_RESULT ErrorPtr VerifyClosurizedEntryPoint () const
 
FunctionPtr CreateMethodExtractor (const String &getter_name) const
 
FunctionPtr GetMethodExtractor (const String &getter_name) const
 
FunctionPtr CreateDynamicInvocationForwarder (const String &mangled_name) const
 
FunctionPtr GetDynamicInvocationForwarder (const String &mangled_name, bool allow_add=true) const
 
int32_t SourceFingerprint () const
 
bool CheckSourceFingerprint (int32_t fp, const char *kind=nullptr) const
 
void SaveICDataMap (const ZoneGrowableArray< const ICData * > &deopt_id_to_ic_data, const Array &edge_counters_array, const Array &coverage_array) const
 
void RestoreICDataMap (ZoneGrowableArray< const ICData * > *deopt_id_to_ic_data, bool clone_ic_data) const
 
ArrayPtr ic_data_array () const
 
void ClearICDataArray () const
 
ICDataPtr FindICData (intptr_t deopt_id) const
 
ArrayPtr GetCoverageArray () const
 
void AddFunctionServiceId (const JSONObject &obj) const
 
void SetDeoptReasonForAll (intptr_t deopt_id, ICData::DeoptReasonId reason)
 
void set_modifier (UntaggedFunction::AsyncModifier value) const
 
void SetUsageCounter (intptr_t value) const
 
bool WasExecuted () const
 
void SetWasExecuted (bool value) const
 
bool is_optimizable () const
 
void set_is_optimizable (bool value) const
 
 COMPILE_ASSERT (MethodRecognizer::kNumRecognizedMethods<(1<< kRecognizedTagSize))
 
 COMPILE_ASSERT (kNumTagBits<=(kBitsPerByte *sizeof(decltype(UntaggedFunction::kind_tag_))))
 
- Public Member Functions inherited from dart::Object
virtual ~Object ()
 
ObjectPtr ptr () const
 
void operator= (ObjectPtr value)
 
bool IsCanonical () const
 
void SetCanonical () const
 
void ClearCanonical () const
 
bool IsImmutable () const
 
void SetImmutable () const
 
void ClearImmutable () const
 
intptr_t GetClassId () const
 
ClassPtr clazz () const
 
 CLASS_LIST_FOR_HANDLES (DEFINE_CLASS_TESTER)
 
bool IsNull () const
 
virtual const char * ToCString () const
 
void PrintJSON (JSONStream *stream, bool ref=true) const
 
virtual void PrintJSONImpl (JSONStream *stream, bool ref) const
 
void PrintImplementationFields (JSONStream *stream) const
 
virtual void PrintImplementationFieldsImpl (const JSONArray &jsarr_fields) const
 
virtual const char * JSONType () const
 
bool IsNew () const
 
bool IsOld () const
 
bool InVMIsolateHeap () const
 
void Print () const
 

Static Public Member Functions

static intptr_t signature_offset ()
 
static CodePtr CurrentCodeOf (const FunctionPtr function)
 
static bool HasCode (FunctionPtr function)
 
static intptr_t code_offset ()
 
static uword EntryPointOf (const FunctionPtr function)
 
static intptr_t entry_point_offset (CodeEntryKind entry_kind=CodeEntryKind::kNormal)
 
static intptr_t unchecked_entry_point_offset ()
 
static UntaggedFunction::Kind KindOf (FunctionPtr func)
 
static const char * KindToCString (UntaggedFunction::Kind kind)
 
static constexpr intptr_t maximum_unboxed_parameter_count ()
 
static bool IsImplicitClosureFunction (FunctionPtr func)
 
static bool IsImplicitStaticClosureFunction (FunctionPtr func)
 
static bool IsImplicitInstanceClosureFunction (FunctionPtr func)
 
static bool IsFfiCallbackTrampoline (FunctionPtr function)
 
static intptr_t InstanceSize ()
 
static FunctionPtr New (const FunctionType &signature, const String &name, UntaggedFunction::Kind kind, bool is_static, bool is_const, bool is_abstract, bool is_external, bool is_native, const Object &owner, TokenPosition token_pos, Heap::Space space=Heap::kOld)
 
static FunctionPtr NewClosureFunctionWithKind (UntaggedFunction::Kind kind, const String &name, const Function &parent, bool is_static, TokenPosition token_pos, const Object &owner)
 
static FunctionPtr NewClosureFunction (const String &name, const Function &parent, TokenPosition token_pos)
 
static FunctionPtr NewImplicitClosureFunction (const String &name, const Function &parent, TokenPosition token_pos)
 
static bool IsDynamicInvocationForwarderName (const String &name)
 
static bool IsDynamicInvocationForwarderName (StringPtr name)
 
static StringPtr DemangleDynamicInvocationForwarderName (const String &name)
 
static StringPtr CreateDynamicInvocationForwarderName (const String &name)
 
static intptr_t data_offset ()
 
static intptr_t kind_tag_offset ()
 
static bool is_visible (FunctionPtr f)
 
- Static Public Member Functions inherited from dart::Object
static ObjectPtr RawCast (ObjectPtr obj)
 
static constexpr bool ContainsCompressedPointers ()
 
static intptr_t tags_offset ()
 
static ObjectHandle ()
 
static ObjectHandle (Zone *zone)
 
static ObjectHandle (ObjectPtr ptr)
 
static ObjectHandle (Zone *zone, ObjectPtr ptr)
 
static ObjectZoneHandle ()
 
static ObjectZoneHandle (Zone *zone)
 
static ObjectZoneHandle (ObjectPtr ptr)
 
static ObjectZoneHandle (Zone *zone, ObjectPtr ptr)
 
static ObjectReadOnlyHandle ()
 
static ObjectPtr null ()
 
static void set_vm_isolate_snapshot_object_table (const Array &table)
 
static ClassPtr class_class ()
 
static ClassPtr dynamic_class ()
 
static ClassPtr void_class ()
 
static ClassPtr type_parameters_class ()
 
static ClassPtr type_arguments_class ()
 
static ClassPtr patch_class_class ()
 
static ClassPtr function_class ()
 
static ClassPtr closure_data_class ()
 
static ClassPtr ffi_trampoline_data_class ()
 
static ClassPtr field_class ()
 
static ClassPtr script_class ()
 
static ClassPtr library_class ()
 
static ClassPtr namespace_class ()
 
static ClassPtr kernel_program_info_class ()
 
static ClassPtr code_class ()
 
static ClassPtr instructions_class ()
 
static ClassPtr instructions_section_class ()
 
static ClassPtr instructions_table_class ()
 
static ClassPtr object_pool_class ()
 
static ClassPtr pc_descriptors_class ()
 
static ClassPtr code_source_map_class ()
 
static ClassPtr compressed_stackmaps_class ()
 
static ClassPtr var_descriptors_class ()
 
static ClassPtr exception_handlers_class ()
 
static ClassPtr context_class ()
 
static ClassPtr context_scope_class ()
 
static ClassPtr sentinel_class ()
 
static ClassPtr api_error_class ()
 
static ClassPtr language_error_class ()
 
static ClassPtr unhandled_exception_class ()
 
static ClassPtr unwind_error_class ()
 
static ClassPtr singletargetcache_class ()
 
static ClassPtr unlinkedcall_class ()
 
static ClassPtr monomorphicsmiablecall_class ()
 
static ClassPtr icdata_class ()
 
static ClassPtr megamorphic_cache_class ()
 
static ClassPtr subtypetestcache_class ()
 
static ClassPtr loadingunit_class ()
 
static ClassPtr weak_serialization_reference_class ()
 
static ClassPtr weak_array_class ()
 
static void InitNullAndBool (IsolateGroup *isolate_group)
 
static void Init (IsolateGroup *isolate_group)
 
static void InitVtables ()
 
static void FinishInit (IsolateGroup *isolate_group)
 
static void FinalizeVMIsolate (IsolateGroup *isolate_group)
 
static void FinalizeReadOnlyObject (ObjectPtr object)
 
static void Cleanup ()
 
static ErrorPtr Init (IsolateGroup *isolate_group, const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
 
static void MakeUnusedSpaceTraversable (const Object &obj, intptr_t original_size, intptr_t used_size)
 
static intptr_t InstanceSize ()
 
template<class FakeObject >
static void VerifyBuiltinVtable (intptr_t cid)
 
static void VerifyBuiltinVtables ()
 
static bool ShouldHaveImmutabilityBitSet (classid_t class_id)
 

Static Public Attributes

static constexpr intptr_t kMaxInstructionCount = (1 << 16) - 1
 
- Static Public Attributes inherited from dart::Object
static constexpr intptr_t kHashBits = 30
 
static const ClassId kClassId = kObjectCid
 

Friends

class Class
 
class Parser
 
class UntaggedFunction
 
class ClassFinalizer
 
class Type
 
class Precompiler
 
class ProgramVisitor
 

Additional Inherited Members

- Protected Member Functions inherited from dart::Object
 Object ()
 
uword raw_value () const
 
void setPtr (ObjectPtr value, intptr_t default_cid)
 
void CheckHandle () const
 
cpp_vtable vtable () const
 
void set_vtable (cpp_vtable value)
 
bool Contains (uword addr) const
 
template<typename type , std::memory_order order = std::memory_order_relaxed>
type LoadPointer (type const *addr) const
 
template<typename type , std::memory_order order = std::memory_order_relaxed>
void StorePointer (type const *addr, type value) const
 
template<typename type , typename compressed_type , std::memory_order order = std::memory_order_relaxed>
void StoreCompressedPointer (compressed_type const *addr, type value) const
 
template<typename type >
void StorePointerUnaligned (type const *addr, type value, Thread *thread) const
 
void StoreSmi (SmiPtr const *addr, SmiPtr value) const
 
template<typename FieldType >
void StoreSimd128 (const FieldType *addr, simd128_value_t value) const
 
template<typename FieldType >
FieldType LoadNonPointer (const FieldType *addr) const
 
template<typename FieldType , std::memory_order order>
FieldType LoadNonPointer (const FieldType *addr) const
 
template<typename FieldType , typename ValueType >
void StoreNonPointer (const FieldType *addr, ValueType value) const
 
template<typename FieldType , typename ValueType , std::memory_order order>
void StoreNonPointer (const FieldType *addr, ValueType value) const
 
template<typename FieldType >
FieldType * UnsafeMutableNonPointer (const FieldType *addr) const
 
 CLASS_LIST (STORE_NON_POINTER_ILLEGAL_TYPE)
 
void UnimplementedMethod () const
 
void AddCommonObjectProperties (JSONObject *jsobj, const char *protocol_type, bool ref) const
 
- Static Protected Member Functions inherited from dart::Object
static DART_NOINLINE ObjectHandleImpl (Zone *zone, ObjectPtr ptr, intptr_t default_cid)
 
static DART_NOINLINE ObjectZoneHandleImpl (Zone *zone, ObjectPtr ptr, intptr_t default_cid)
 
static DART_NOINLINE ObjectReadOnlyHandleImpl (intptr_t cid)
 
static ObjectPtr Allocate (intptr_t cls_id, intptr_t size, Heap::Space space, bool compressed, uword ptr_field_start_offset, uword ptr_field_end_offset)
 
template<typename T >
static DART_FORCE_INLINE T::ObjectPtrType Allocate (Heap::Space space)
 
template<typename T >
static DART_FORCE_INLINE T::ObjectPtrType Allocate (Heap::Space space, intptr_t elements)
 
template<typename T >
static DART_FORCE_INLINE T::ObjectPtrType AllocateVariant (intptr_t class_id, Heap::Space space)
 
template<typename T >
static DART_FORCE_INLINE T::ObjectPtrType AllocateVariant (intptr_t class_id, Heap::Space space, intptr_t elements)
 
static constexpr intptr_t RoundedAllocationSize (intptr_t size)
 
static ObjectPtr Clone (const Object &orig, Heap::Space space, bool load_with_relaxed_atomics=false)
 
template<typename T >
static DART_FORCE_INLINE uword from_offset ()
 
template<typename T >
static DART_FORCE_INLINE uword to_offset (intptr_t length=0)
 
- Protected Attributes inherited from dart::Object
ObjectPtr ptr_
 

Detailed Description

Definition at line 2970 of file object.h.

Member Enumeration Documentation

◆ KindTagBits

Enumerator
kKindTagPos 
kKindTagSize 
kRecognizedTagPos 
kRecognizedTagSize 
kModifierPos 
kModifierSize 
kLastModifierBitPos 
kNumTagBits 

Definition at line 4194 of file object.h.

4194 {
4195 kKindTagPos = 0,
4196 kKindTagSize = 5,
4200 kModifierSize = 2,
4202// Single bit sized fields start here.
4203#define DECLARE_BIT(name, _) k##name##Bit,
4206#undef DECLARE_BIT
4208 };
StringPtr name() const
Definition object.h:2972
@ kLastModifierBitPos
Definition object.h:4201
#define DECLARE_BIT(Name)
Definition isolate.h:766
#define FOR_EACH_FUNCTION_KIND_BIT(V)
Definition object.h:4135
#define FOR_EACH_FUNCTION_VOLATILE_KIND_BIT(V)
Definition object.h:4153

◆ StateBits

Definition at line 4075 of file object.h.

4075 {
4076#define DECLARE_FLAG_POS(Name) k##Name##Pos,
4078#undef DECLARE_FLAG_POS
4079 };
#define DECLARE_FLAG_POS(Name)
Definition object.h:4076
#define STATE_BITS_LIST(V)
Definition object.h:4069

Member Function Documentation

◆ accessor_field()

FieldPtr dart::Function::accessor_field ( ) const

Definition at line 8207 of file object.cc.

8207 {
8208 ASSERT(kind() == UntaggedFunction::kImplicitGetter ||
8209 kind() == UntaggedFunction::kImplicitSetter ||
8210 kind() == UntaggedFunction::kImplicitStaticGetter ||
8211 kind() == UntaggedFunction::kFieldInitializer);
8212 return Field::RawCast(untag()->data());
8213}
UntaggedFunction::Kind kind() const
Definition object.h:3329
static ObjectPtr RawCast(ObjectPtr obj)
Definition object.h:325
#define ASSERT(E)
raw_obj untag() -> num_entries()) VARIABLE_COMPRESSED_VISITOR(Array, Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(TypedData, TypedData::ElementSizeInBytes(raw_obj->GetClassId()) *Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(Record, RecordShape(raw_obj->untag() ->shape()).num_fields()) VARIABLE_NULL_VISITOR(CompressedStackMaps, CompressedStackMaps::PayloadSizeOf(raw_obj)) VARIABLE_NULL_VISITOR(OneByteString, Smi::Value(raw_obj->untag() ->length())) VARIABLE_NULL_VISITOR(TwoByteString, Smi::Value(raw_obj->untag() ->length())) intptr_t UntaggedField::VisitFieldPointers(FieldPtr raw_obj, ObjectPointerVisitor *visitor)

◆ AddFunctionServiceId()

void dart::Function::AddFunctionServiceId ( const JSONObject obj) const

Definition at line 280 of file object_service.cc.

280 {
281 Class& cls = Class::Handle(Owner());
282 // Special kinds of functions use indices in their respective lists.
283 intptr_t id = -1;
284 const char* selector = nullptr;
285 // Regular functions known to their owner use their name (percent-encoded).
286 String& name = String::Handle(this->name());
287
290 selector = "closures";
291 } else if (IsImplicitClosureFunction()) {
292 id = cls.FindImplicitClosureFunctionIndex(*this);
293 selector = "implicit_closures";
295 id = cls.FindInvocationDispatcherFunctionIndex(*this);
296 selector = "dispatchers";
297 } else if (IsFieldInitializer()) {
299 const char* encoded_field_name = String::EncodeIRI(name);
300 if (cls.IsTopLevel()) {
301 const auto& library = Library::Handle(cls.library());
302 const auto& private_key = String::Handle(library.private_key());
303 jsobj.AddFixedServiceId("libraries/%s/field_inits/%s",
304 private_key.ToCString(), encoded_field_name);
305 } else {
306 jsobj.AddFixedServiceId("classes/%" Pd "/field_inits/%s", cls.id(),
307 encoded_field_name);
308 }
309 return;
310 }
311 if (id != -1) {
312 ASSERT(selector != nullptr);
313 if (cls.IsTopLevel()) {
314 const auto& library = Library::Handle(cls.library());
315 const auto& private_key = String::Handle(library.private_key());
316 jsobj.AddFixedServiceId("libraries/%s/%s/%" Pd "",
317 private_key.ToCString(), selector, id);
318 } else {
319 jsobj.AddFixedServiceId("classes/%" Pd "/%s/%" Pd "", cls.id(), selector,
320 id);
321 }
322 return;
323 }
324 Thread* thread = Thread::Current();
325 if (Resolver::ResolveFunction(thread->zone(), cls, name) == ptr()) {
326 const char* encoded_name = String::EncodeIRI(name);
327 if (cls.IsTopLevel()) {
328 const auto& library = Library::Handle(cls.library());
329 const auto& private_key = String::Handle(library.private_key());
330 jsobj.AddFixedServiceId("libraries/%s/functions/%s",
331 private_key.ToCString(), encoded_name);
332 } else {
333 jsobj.AddFixedServiceId("classes/%" Pd "/functions/%s", cls.id(),
334 encoded_name);
335 }
336 return;
337 }
338 // Oddball functions (not known to their owner) fall back to use the object
339 // id ring. Current known examples are signature functions of closures
340 // and stubs like 'megamorphic_call_miss'.
341 jsobj.AddServiceId(*this);
342}
static intptr_t FindClosureIndex(const Function &needle)
static StringPtr NameFromInit(const String &init_name)
Definition object.cc:11877
bool IsImplicitClosureFunction() const
Definition object.h:3883
bool IsNoSuchMethodDispatcher() const
Definition object.h:3268
bool IsFieldInitializer() const
Definition object.h:3865
bool IsInvokeFieldDispatcher() const
Definition object.h:3276
bool IsNonImplicitClosureFunction() const
Definition object.h:3891
ClassPtr Owner() const
Definition object.cc:10899
friend class Class
Definition object.h:4281
ObjectPtr ptr() const
Definition object.h:332
static Object & Handle()
Definition object.h:407
friend class Thread
Definition object.h:1025
static FunctionPtr ResolveFunction(Zone *zone, const Class &receiver_class, const String &function_name)
Definition resolver.cc:180
static const char * EncodeIRI(const String &str)
Definition object.cc:23997
static Thread * Current()
Definition thread.h:361
#define Pd
Definition globals.h:408

◆ AreValidArgumentCounts()

bool dart::Function::AreValidArgumentCounts ( intptr_t  num_type_arguments,
intptr_t  num_arguments,
intptr_t  num_named_arguments,
String error_message 
) const

Definition at line 9308 of file object.cc.

9311 {
9312 if ((num_type_arguments != 0) &&
9313 (num_type_arguments != NumTypeParameters())) {
9314 if (error_message != nullptr) {
9315 const intptr_t kMessageBufferSize = 64;
9316 char message_buffer[kMessageBufferSize];
9317 Utils::SNPrint(message_buffer, kMessageBufferSize,
9318 "%" Pd " type arguments passed, but %" Pd " expected",
9319 num_type_arguments, NumTypeParameters());
9320 // Allocate in old space because it can be invoked in background
9321 // optimizing compilation.
9322 *error_message = String::New(message_buffer, Heap::kOld);
9323 }
9324 return false; // Too many type arguments.
9325 }
9326 if (num_named_arguments > NumOptionalNamedParameters()) {
9327 if (error_message != nullptr) {
9328 const intptr_t kMessageBufferSize = 64;
9329 char message_buffer[kMessageBufferSize];
9330 Utils::SNPrint(message_buffer, kMessageBufferSize,
9331 "%" Pd " named passed, at most %" Pd " expected",
9332 num_named_arguments, NumOptionalNamedParameters());
9333 // Allocate in old space because it can be invoked in background
9334 // optimizing compilation.
9335 *error_message = String::New(message_buffer, Heap::kOld);
9336 }
9337 return false; // Too many named arguments.
9338 }
9339 const intptr_t num_pos_args = num_arguments - num_named_arguments;
9340 const intptr_t num_opt_pos_params = NumOptionalPositionalParameters();
9341 const intptr_t num_pos_params = num_fixed_parameters() + num_opt_pos_params;
9342 if (num_pos_args > num_pos_params) {
9343 if (error_message != nullptr) {
9344 const intptr_t kMessageBufferSize = 64;
9345 char message_buffer[kMessageBufferSize];
9346 // Hide implicit parameters to the user.
9347 const intptr_t num_hidden_params = NumImplicitParameters();
9348 Utils::SNPrint(message_buffer, kMessageBufferSize,
9349 "%" Pd "%s passed, %s%" Pd " expected",
9350 num_pos_args - num_hidden_params,
9351 num_opt_pos_params > 0 ? " positional" : "",
9352 num_opt_pos_params > 0 ? "at most " : "",
9353 num_pos_params - num_hidden_params);
9354 // Allocate in old space because it can be invoked in background
9355 // optimizing compilation.
9356 *error_message = String::New(message_buffer, Heap::kOld);
9357 }
9358 return false; // Too many fixed and/or positional arguments.
9359 }
9360 if (num_pos_args < num_fixed_parameters()) {
9361 if (error_message != nullptr) {
9362 const intptr_t kMessageBufferSize = 64;
9363 char message_buffer[kMessageBufferSize];
9364 // Hide implicit parameters to the user.
9365 const intptr_t num_hidden_params = NumImplicitParameters();
9366 Utils::SNPrint(message_buffer, kMessageBufferSize,
9367 "%" Pd "%s passed, %s%" Pd " expected",
9368 num_pos_args - num_hidden_params,
9369 num_opt_pos_params > 0 ? " positional" : "",
9370 num_opt_pos_params > 0 ? "at least " : "",
9371 num_fixed_parameters() - num_hidden_params);
9372 // Allocate in old space because it can be invoked in background
9373 // optimizing compilation.
9374 *error_message = String::New(message_buffer, Heap::kOld);
9375 }
9376 return false; // Too few fixed and/or positional arguments.
9377 }
9378 return true;
9379}
intptr_t NumOptionalNamedParameters() const
Definition object.cc:8932
intptr_t NumOptionalPositionalParameters() const
Definition object.cc:8929
intptr_t NumTypeParameters() const
Definition object.cc:8905
intptr_t NumImplicitParameters() const
Definition object.cc:9286
intptr_t num_fixed_parameters() const
Definition object.cc:8914
@ kOld
Definition heap.h:39
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition object.cc:23777
static int SNPrint(char *str, size_t size, const char *format,...) PRINTF_ATTRIBUTE(3

◆ AreValidArguments() [1/2]

bool dart::Function::AreValidArguments ( const ArgumentsDescriptor args_desc,
String error_message 
) const

Definition at line 9391 of file object.cc.

9392 {
9393 const intptr_t num_type_arguments = args_desc.TypeArgsLen();
9394 const intptr_t num_arguments = args_desc.Count();
9395 const intptr_t num_named_arguments = args_desc.NamedCount();
9396
9397 if (!AreValidArgumentCounts(num_type_arguments, num_arguments,
9398 num_named_arguments, error_message)) {
9399 return false;
9400 }
9401 // Verify that all argument names are valid parameter names.
9402 Thread* thread = Thread::Current();
9403 Zone* zone = thread->zone();
9404 String& argument_name = String::Handle(zone);
9405 String& parameter_name = String::Handle(zone);
9406 const intptr_t num_positional_args = num_arguments - num_named_arguments;
9407 const intptr_t num_parameters = NumParameters();
9408 for (intptr_t i = 0; i < num_named_arguments; i++) {
9409 argument_name = args_desc.NameAt(i);
9410 ASSERT(argument_name.IsSymbol());
9411 bool found = false;
9412 for (intptr_t j = num_positional_args; j < num_parameters; j++) {
9413 parameter_name = ParameterNameAt(j);
9414 ASSERT(parameter_name.IsSymbol());
9415 if (argument_name.Equals(parameter_name)) {
9416 found = true;
9417 break;
9418 }
9419 }
9420 if (!found) {
9421 if (error_message != nullptr) {
9422 const intptr_t kMessageBufferSize = 64;
9423 char message_buffer[kMessageBufferSize];
9424 Utils::SNPrint(message_buffer, kMessageBufferSize,
9425 "no optional formal parameter named '%s'",
9426 argument_name.ToCString());
9427 *error_message = String::New(message_buffer);
9428 }
9429 return false;
9430 }
9431 }
9432 // Verify that all required named parameters are filled.
9433 for (intptr_t j = num_parameters - NumOptionalNamedParameters();
9434 j < num_parameters; j++) {
9435 if (IsRequiredAt(j)) {
9436 parameter_name = ParameterNameAt(j);
9437 ASSERT(parameter_name.IsSymbol());
9438 bool found = false;
9439 for (intptr_t i = 0; i < num_named_arguments; i++) {
9440 argument_name = args_desc.NameAt(i);
9441 ASSERT(argument_name.IsSymbol());
9442 if (argument_name.Equals(parameter_name)) {
9443 found = true;
9444 break;
9445 }
9446 }
9447 if (!found) {
9448 if (error_message != nullptr) {
9449 const intptr_t kMessageBufferSize = 64;
9450 char message_buffer[kMessageBufferSize];
9451 Utils::SNPrint(message_buffer, kMessageBufferSize,
9452 "missing required named parameter '%s'",
9453 parameter_name.ToCString());
9454 *error_message = String::New(message_buffer);
9455 }
9456 return false;
9457 }
9458 }
9459 }
9460 return true;
9461}
StringPtr ParameterNameAt(intptr_t index) const
Definition object.cc:8660
bool IsRequiredAt(intptr_t index) const
Definition object.cc:8799
bool AreValidArgumentCounts(intptr_t num_type_arguments, intptr_t num_arguments, intptr_t num_named_arguments, String *error_message) const
Definition object.cc:9308
intptr_t NumParameters() const
Definition object.cc:8935

◆ AreValidArguments() [2/2]

bool dart::Function::AreValidArguments ( intptr_t  num_type_arguments,
intptr_t  num_arguments,
const Array argument_names,
String error_message 
) const

Definition at line 9381 of file object.cc.

9384 {
9385 const Array& args_desc_array = Array::Handle(ArgumentsDescriptor::NewBoxed(
9386 num_type_arguments, num_arguments, argument_names, Heap::kNew));
9387 ArgumentsDescriptor args_desc(args_desc_array);
9388 return AreValidArguments(args_desc, error_message);
9389}
static ArrayPtr NewBoxed(intptr_t type_args_len, intptr_t num_arguments, const Array &optional_arguments_names, Heap::Space space=Heap::kOld)
Definition dart_entry.h:83
bool AreValidArguments(intptr_t num_type_arguments, intptr_t num_arguments, const Array &argument_names, String *error_message) const
Definition object.cc:9381
@ kNew
Definition heap.h:38

◆ AssignFfiCallbackId()

void dart::Function::AssignFfiCallbackId ( int32_t  callback_id) const

Definition at line 8402 of file object.cc.

8402 {
8404
8405 const auto& obj = Object::Handle(data());
8406 ASSERT(!obj.IsNull());
8407 const auto& trampoline_data = FfiTrampolineData::Cast(obj);
8408
8409 ASSERT(trampoline_data.callback_id() == -1);
8410 trampoline_data.set_callback_id(callback_id);
8411}
bool IsFfiCallbackTrampoline() const
Definition object.h:3918

◆ AttachCode()

void dart::Function::AttachCode ( const Code value) const

Definition at line 7985 of file object.cc.

7985 {
7986 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
7987 // Finish setting up code before activating it.
7988 value.set_owner(*this);
7989 SetInstructions(value);
7990 ASSERT(Function::Handle(value.function()).IsNull() ||
7991 (value.function() == this->ptr()));
7992}
void SetInstructions(const Code &value) const
Definition object.cc:7967
static IsolateGroup * Current()
Definition isolate.h:534
bool IsNull() const
Definition object.h:363
uint8_t value

◆ awaiter_link()

Function::AwaiterLink dart::Function::awaiter_link ( ) const

Definition at line 8125 of file object.cc.

8125 {
8126 if (IsClosureFunction()) {
8127 const Object& obj = Object::Handle(untag()->data());
8128 ASSERT(!obj.IsNull());
8129 return ClosureData::Cast(obj).awaiter_link();
8130 }
8131 UNREACHABLE();
8132 return {};
8133}
#define UNREACHABLE()
Definition assert.h:248
bool IsClosureFunction() const
Definition object.h:3871

◆ CanBeInlined()

bool dart::Function::CanBeInlined ( ) const

Definition at line 9257 of file object.cc.

9257 {
9258 if (ForceOptimize()) {
9260 // We currently don't support inlining FFI trampolines. Some of them
9261 // are naturally non-inlinable because they contain a try/catch block,
9262 // but this condition is broader than strictly necessary.
9263 // The work necessary for inlining FFI trampolines is tracked by
9264 // http://dartbug.com/45055.
9265 return false;
9266 }
9267 if (CompilerState::Current().is_aot()) {
9268 return true;
9269 }
9270 // Inlining of force-optimized functions requires target function to be
9271 // idempotent becase if deoptimization is needed in inlined body, the
9272 // execution of the force-optimized will be restarted at the beginning of
9273 // the function.
9275 return IsIdempotent();
9276 }
9277
9278 if (HasBreakpoint()) {
9279 return false;
9280 }
9281
9282 return is_inlinable();
9283}
static CompilerState & Current()
bool IsPreferInline() const
Definition object.cc:9093
bool IsFfiCallClosure() const
Definition object.cc:9125
bool IsIdempotent() const
Definition object.cc:9100
bool ForceOptimize() const
Definition object.cc:9075
bool is_ffi_native() const
Definition object.cc:8600
bool HasBreakpoint() const
Definition object.cc:7948

◆ CheckSourceFingerprint()

bool dart::Function::CheckSourceFingerprint ( int32_t  fp,
const char *  kind = nullptr 
) const

Definition at line 11362 of file object.cc.

11362 {
11363#if !defined(DEBUG)
11364 return true; // Only check on debug.
11365#endif
11366
11367#if !defined(DART_PRECOMPILED_RUNTIME)
11368 // Check that the function is marked as recognized via the vm:recognized
11369 // pragma. This is so that optimizations that change the signature will know
11370 // not to touch it.
11371 if (kind != nullptr && !MethodRecognizer::IsMarkedAsRecognized(*this, kind)) {
11373 "Recognized method %s should be marked with: "
11374 "@pragma(\"vm:recognized\", \"%s\")\n",
11376 return false;
11377 }
11378#endif
11379
11380 if (IsolateGroup::Current()->obfuscate() || FLAG_precompiled_mode ||
11382 return true; // The kernel structure has been altered, skip checking.
11383 }
11384
11385 if (SourceFingerprint() != fp) {
11386 // This output can be copied into a file, then used with sed
11387 // to replace the old values.
11388 // sed -i.bak -f /tmp/newkeys \
11389 // runtime/vm/compiler/recognized_methods_list.h
11390 THR_Print("s/0x%08x/0x%08x/\n", fp, SourceFingerprint());
11391 return false;
11392 }
11393 return true;
11394}
static Snapshot::Kind vm_snapshot_kind()
Definition dart.h:95
int32_t SourceFingerprint() const
Definition object.cc:11227
const char * ToQualifiedCString() const
Definition object.cc:9834
static bool IsMarkedAsRecognized(const Function &function, const char *kind=nullptr)
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
#define THR_Print(format,...)
Definition log.h:20
const uint32_t fp

◆ ClearCode()

void dart::Function::ClearCode ( ) const

Definition at line 8006 of file object.cc.

8006 {
8007#if defined(DART_PRECOMPILED_RUNTIME)
8008 UNREACHABLE();
8009#else
8010 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
8011 untag()->set_unoptimized_code(Code::null());
8012 SetInstructions(StubCode::LazyCompile());
8013#endif // defined(DART_PRECOMPILED_RUNTIME)
8014}
static ObjectPtr null()
Definition object.h:433

◆ ClearCodeSafe()

void dart::Function::ClearCodeSafe ( ) const

Definition at line 8016 of file object.cc.

8016 {
8017#if defined(DART_PRECOMPILED_RUNTIME)
8018 UNREACHABLE();
8019#else
8020 untag()->set_unoptimized_code(Code::null());
8021
8022 SetInstructionsSafe(StubCode::LazyCompile());
8023#endif // defined(DART_PRECOMPILED_RUNTIME)
8024}
void SetInstructionsSafe(const Code &value) const
Definition object.cc:7978

◆ ClearICDataArray()

void dart::Function::ClearICDataArray ( ) const

Definition at line 11334 of file object.cc.

11334 {
11335 set_ic_data_array(Array::null_array());
11336}

◆ code_offset()

static intptr_t dart::Function::code_offset ( )
inlinestatic

Definition at line 3176 of file object.h.

3176{ return OFFSET_OF(UntaggedFunction, code_); }
friend class UntaggedFunction
Definition object.h:4285
#define OFFSET_OF(type, field)
Definition globals.h:138

◆ COMPILE_ASSERT() [1/2]

dart::Function::COMPILE_ASSERT ( kNumTagBits<=  kBitsPerByte *sizeof(decltype(UntaggedFunction::kind_tag_)))

◆ COMPILE_ASSERT() [2/2]

dart::Function::COMPILE_ASSERT ( )

◆ context_scope()

ContextScopePtr dart::Function::context_scope ( ) const

Definition at line 8106 of file object.cc.

8106 {
8107 if (IsClosureFunction()) {
8108 const Object& obj = Object::Handle(untag()->data());
8109 ASSERT(!obj.IsNull());
8110 return ClosureData::Cast(obj).context_scope();
8111 }
8112 return ContextScope::null();
8113}

◆ CreateDynamicInvocationForwarder()

FunctionPtr dart::Function::CreateDynamicInvocationForwarder ( const String mangled_name) const

Definition at line 4260 of file object.cc.

4261 {
4262 Thread* thread = Thread::Current();
4263 Zone* zone = thread->zone();
4264
4265 Function& forwarder = Function::Handle(zone);
4266 forwarder ^= Object::Clone(*this, Heap::kOld);
4267
4268 forwarder.reset_unboxed_parameters_and_return();
4269
4270 forwarder.set_name(mangled_name);
4271 forwarder.set_is_native(false);
4272 // TODO(dartbug.com/37737): Currently, we intentionally keep the recognized
4273 // kind when creating the dynamic invocation forwarder.
4274 forwarder.set_kind(UntaggedFunction::kDynamicInvocationForwarder);
4275 forwarder.set_modifier(UntaggedFunction::kNoModifier);
4276 forwarder.set_is_debuggable(false);
4277
4278 // TODO(vegorov) for error reporting reasons it is better to make this
4279 // function visible and instead use a TailCall to invoke the target.
4280 // Our TailCall instruction is not ready for such usage though it
4281 // blocks inlining and can't take Function-s only Code objects.
4282 forwarder.set_is_visible(false);
4283
4284 forwarder.ClearICDataArray();
4285 forwarder.ClearCode();
4286 forwarder.set_usage_counter(0);
4287 forwarder.set_deoptimization_counter(0);
4288 forwarder.set_optimized_instruction_count(0);
4289 forwarder.set_inlining_depth(0);
4290 forwarder.set_optimized_call_site_count(0);
4291
4292 forwarder.InheritKernelOffsetFrom(*this);
4293 forwarder.SetForwardingTarget(*this);
4294
4295 return forwarder.ptr();
4296}
static ObjectPtr Clone(const Object &orig, Heap::Space space, bool load_with_relaxed_atomics=false)
Definition object.cc:2960

◆ CreateDynamicInvocationForwarderName()

StringPtr dart::Function::CreateDynamicInvocationForwarderName ( const String name)
static

Definition at line 4255 of file object.cc.

4255 {
4256 return Symbols::FromConcat(Thread::Current(), Symbols::DynamicPrefix(), name);
4257}
static StringPtr FromConcat(Thread *thread, const String &str1, const String &str2)
Definition symbols.cc:235

◆ CreateMethodExtractor()

FunctionPtr dart::Function::CreateMethodExtractor ( const String getter_name) const

Definition at line 4017 of file object.cc.

4017 {
4018 Thread* thread = Thread::Current();
4019 Zone* zone = thread->zone();
4020 ASSERT(Field::IsGetterName(getter_name));
4021 const Function& closure_function =
4023
4024 const Class& owner = Class::Handle(zone, closure_function.Owner());
4025 FunctionType& signature = FunctionType::Handle(zone, FunctionType::New());
4026 const Function& extractor = Function::Handle(
4027 zone,
4028 Function::New(signature,
4029 String::Handle(zone, Symbols::New(thread, getter_name)),
4030 UntaggedFunction::kMethodExtractor,
4031 false, // Not static.
4032 false, // Not const.
4033 is_abstract(),
4034 false, // Not external.
4035 false, // Not native.
4036 owner, TokenPosition::kMethodExtractor));
4037
4038 // Initialize signature: receiver is a single fixed parameter.
4039 const intptr_t kNumParameters = 1;
4040 signature.set_num_fixed_parameters(kNumParameters);
4041 signature.SetNumOptionalParameters(0, false);
4042 signature.set_parameter_types(Object::synthetic_getter_parameter_types());
4043#if !defined(DART_PRECOMPILED_RUNTIME)
4044 extractor.set_positional_parameter_names(
4045 Object::synthetic_getter_parameter_names());
4046#endif
4047 signature.set_result_type(Object::dynamic_type());
4048
4049 extractor.InheritKernelOffsetFrom(*this);
4050
4051 extractor.set_extracted_method_closure(closure_function);
4052 extractor.set_is_debuggable(false);
4053 extractor.set_is_visible(false);
4054
4055 signature ^= ClassFinalizer::FinalizeType(signature);
4056 extractor.SetSignature(signature);
4057
4058 owner.AddFunction(extractor);
4059
4060 return extractor.ptr();
4061}
static AbstractTypePtr FinalizeType(const AbstractType &type, FinalizationKind finalization=kCanonicalize)
static bool IsGetterName(const String &function_name)
Definition object.cc:11882
static FunctionTypePtr New(intptr_t num_parent_type_arguments=0, Nullability nullability=Nullability::kLegacy, Heap::Space space=Heap::kOld)
Definition object.cc:11682
static FunctionPtr New(const FunctionType &signature, const String &name, UntaggedFunction::Kind kind, bool is_static, bool is_const, bool is_abstract, bool is_external, bool is_native, const Object &owner, TokenPosition token_pos, Heap::Space space=Heap::kOld)
Definition object.cc:10301
FunctionPtr ImplicitClosureFunction() const
Definition object.cc:10443
static StringPtr New(Thread *thread, const char *cstr)
Definition symbols.h:722

◆ CreateNameArray()

void dart::Function::CreateNameArray ( Heap::Space  space = Heap::kOld) const

Definition at line 8735 of file object.cc.

8735 {
8736#if defined(DART_PRECOMPILED_RUNTIME)
8737 UNREACHABLE();
8738#else
8739 const intptr_t num_positional_params =
8741 if (num_positional_params == 0) {
8742 set_positional_parameter_names(Object::empty_array());
8743 } else {
8744 set_positional_parameter_names(
8745 Array::Handle(Array::New(num_positional_params, space)));
8746 }
8747#endif
8748}
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
Definition object.h:10933

◆ CurrentCode()

CodePtr dart::Function::CurrentCode ( ) const
inline

Definition at line 3157 of file object.h.

3157{ return CurrentCodeOf(ptr()); }
static CodePtr CurrentCodeOf(const FunctionPtr function)
Definition object.h:3161

◆ CurrentCodeOf()

static CodePtr dart::Function::CurrentCodeOf ( const FunctionPtr  function)
inlinestatic

Definition at line 3161 of file object.h.

3161 {
3162 return function->untag()->code();
3163 }
Dart_NativeFunction function
Definition fuchsia.cc:51

◆ data_offset()

static intptr_t dart::Function::data_offset ( )
inlinestatic

Definition at line 4104 of file object.h.

4104{ return OFFSET_OF(UntaggedFunction, data_); }

◆ default_type_arguments_instantiation_mode()

InstantiationMode dart::Function::default_type_arguments_instantiation_mode ( ) const

Definition at line 8246 of file object.cc.

8246 {
8247 if (!IsClosureFunction()) {
8248 UNREACHABLE();
8249 }
8250 return ClosureData::DefaultTypeArgumentsInstantiationMode(
8251 ClosureData::RawCast(data()));
8252}

◆ DefaultTypeArguments()

TypeArgumentsPtr dart::Function::DefaultTypeArguments ( Zone zone) const

Definition at line 8239 of file object.cc.

8239 {
8241 return Object::empty_type_arguments().ptr();
8242 }
8243 return TypeParameters::Handle(zone, type_parameters()).defaults();
8244}
TypeParametersPtr type_parameters() const
Definition object.h:3109

◆ DemangleDynamicInvocationForwarderName()

StringPtr dart::Function::DemangleDynamicInvocationForwarderName ( const String name)
static

Definition at line 4248 of file object.cc.

4248 {
4249 const intptr_t kDynamicPrefixLength = 4; // "dyn:"
4250 ASSERT(Symbols::DynamicPrefix().Length() == kDynamicPrefixLength);
4251 return Symbols::New(Thread::Current(), name, kDynamicPrefixLength,
4252 name.Length() - kDynamicPrefixLength);
4253}

◆ DictionaryName()

virtual StringPtr dart::Function::DictionaryName ( ) const
inlinevirtual

Reimplemented from dart::Object.

Definition at line 2985 of file object.h.

2985{ return name(); }

◆ DoArgumentTypesMatch() [1/3]

ObjectPtr dart::Function::DoArgumentTypesMatch ( const Array args,
const ArgumentsDescriptor arg_names 
) const

Definition at line 9563 of file object.cc.

9565 {
9566#if defined(DART_PRECOMPILED_RUNTIME)
9567 if (signature() == FunctionType::null()) {
9568 // Precompiler deleted signature because of missing entry point pragma.
9569 return EntryPointMemberInvocationError(*this);
9570 }
9571#endif
9572 Thread* thread = Thread::Current();
9573 Zone* zone = thread->zone();
9574
9575 auto& receiver = Instance::Handle(zone);
9577 receiver ^= args.At(args_desc.FirstArgIndex());
9578 }
9579 const auto& instantiator_type_arguments = TypeArguments::Handle(
9580 zone, RetrieveInstantiatorTypeArguments(zone, *this, receiver));
9581 return Function::DoArgumentTypesMatch(args, args_desc,
9582 instantiator_type_arguments);
9583}
ObjectPtr DoArgumentTypesMatch(const Array &args, const ArgumentsDescriptor &arg_names) const
Definition object.cc:9563
bool HasThisParameter() const
Definition object.h:3349
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
DART_WARN_UNUSED_RESULT ErrorPtr EntryPointMemberInvocationError(const Object &member)
Definition object.cc:27288
static TypeArgumentsPtr RetrieveInstantiatorTypeArguments(Zone *zone, const Function &function, const Instance &receiver)
Definition object.cc:9545

◆ DoArgumentTypesMatch() [2/3]

ObjectPtr dart::Function::DoArgumentTypesMatch ( const Array args,
const ArgumentsDescriptor arg_names,
const TypeArguments instantiator_type_args 
) const

Definition at line 9585 of file object.cc.

9588 {
9589#if defined(DART_PRECOMPILED_RUNTIME)
9590 if (signature() == FunctionType::null()) {
9591 // Precompiler deleted signature because of missing entry point pragma.
9592 return EntryPointMemberInvocationError(*this);
9593 }
9594#endif
9595 Thread* thread = Thread::Current();
9596 Zone* zone = thread->zone();
9597
9598 auto& receiver = Instance::Handle(zone);
9600 receiver ^= args.At(args_desc.FirstArgIndex());
9601 }
9602
9603 const auto& function_type_arguments = TypeArguments::Handle(
9604 zone, RetrieveFunctionTypeArguments(thread, zone, *this, receiver,
9605 instantiator_type_arguments, args,
9606 args_desc));
9608 args, args_desc, instantiator_type_arguments, function_type_arguments);
9609}
static TypeArgumentsPtr RetrieveFunctionTypeArguments(Thread *thread, Zone *zone, const Function &function, const Instance &receiver, const TypeArguments &instantiator_type_args, const Array &args, const ArgumentsDescriptor &args_desc)
Definition object.cc:9467

◆ DoArgumentTypesMatch() [3/3]

ObjectPtr dart::Function::DoArgumentTypesMatch ( const Array args,
const ArgumentsDescriptor arg_names,
const TypeArguments instantiator_type_args,
const TypeArguments function_type_args 
) const

Definition at line 9611 of file object.cc.

9615 {
9616#if defined(DART_PRECOMPILED_RUNTIME)
9617 if (signature() == FunctionType::null()) {
9618 // Precompiler deleted signature because of missing entry point pragma.
9619 return EntryPointMemberInvocationError(*this);
9620 }
9621#endif
9622 Thread* thread = Thread::Current();
9623 Zone* zone = thread->zone();
9624
9625 // Perform any non-covariant bounds checks on the provided function type
9626 // arguments to make sure they are appropriate subtypes of the bounds.
9627 const intptr_t kNumLocalTypeArgs = NumTypeParameters();
9628 if (kNumLocalTypeArgs > 0) {
9629 const intptr_t kNumParentTypeArgs = NumParentTypeArguments();
9630 ASSERT(function_type_arguments.HasCount(kNumParentTypeArgs +
9631 kNumLocalTypeArgs));
9632 const auto& params = TypeParameters::Handle(zone, type_parameters());
9633 // No checks are needed if all bounds are dynamic.
9634 if (!params.AllDynamicBounds()) {
9635 auto& param = AbstractType::Handle(zone);
9636 auto& bound = AbstractType::Handle(zone);
9637 for (intptr_t i = 0; i < kNumLocalTypeArgs; i++) {
9638 bound = params.BoundAt(i);
9639 // Only perform non-covariant checks where the bound is not
9640 // the top type.
9641 if (params.IsGenericCovariantImplAt(i) ||
9642 bound.IsTopTypeForSubtyping()) {
9643 continue;
9644 }
9645 param = TypeParameterAt(i);
9647 &param, &bound, instantiator_type_arguments,
9648 function_type_arguments)) {
9649 const auto& names = Array::Handle(zone, params.names());
9650 auto& name = String::Handle(zone);
9651 name ^= names.At(i);
9652 return Error::RawCast(
9653 ThrowTypeError(token_pos(), param, bound, name));
9654 }
9655 }
9656 }
9657 } else {
9658 ASSERT(function_type_arguments.HasCount(NumParentTypeArguments()));
9659 }
9660
9661 AbstractType& type = AbstractType::Handle(zone);
9662 Instance& argument = Instance::Handle(zone);
9663
9664 auto check_argument = [](const Instance& argument, const AbstractType& type,
9665 const TypeArguments& instantiator_type_args,
9666 const TypeArguments& function_type_args) -> bool {
9667 // If the argument type is the top type, no need to check.
9668 if (type.IsTopTypeForSubtyping()) return true;
9669 if (argument.IsNull()) {
9670 return Instance::NullIsAssignableTo(type, instantiator_type_args,
9671 function_type_args);
9672 }
9673 return argument.IsAssignableTo(type, instantiator_type_args,
9674 function_type_args);
9675 };
9676
9677 // Check types of the provided arguments against the expected parameter types.
9678 const intptr_t arg_offset = args_desc.FirstArgIndex();
9679 // Only check explicit arguments.
9680 const intptr_t arg_start = arg_offset + NumImplicitParameters();
9681 const intptr_t end_positional_args = arg_offset + args_desc.PositionalCount();
9682 for (intptr_t arg_index = arg_start; arg_index < end_positional_args;
9683 ++arg_index) {
9684 argument ^= args.At(arg_index);
9685 // Adjust for type arguments when they're present.
9686 const intptr_t param_index = arg_index - arg_offset;
9687 type = ParameterTypeAt(param_index);
9688 if (!check_argument(argument, type, instantiator_type_arguments,
9689 function_type_arguments)) {
9690 auto& name = String::Handle(zone, ParameterNameAt(param_index));
9691 if (!type.IsInstantiated()) {
9692 type =
9693 type.InstantiateFrom(instantiator_type_arguments,
9694 function_type_arguments, kAllFree, Heap::kNew);
9695 }
9696 return ThrowTypeError(token_pos(), argument, type, name);
9697 }
9698 }
9699
9700 const intptr_t num_named_arguments = args_desc.NamedCount();
9701 if (num_named_arguments == 0) {
9702 return Error::null();
9703 }
9704
9705 const int num_parameters = NumParameters();
9706 const int num_fixed_params = num_fixed_parameters();
9707
9708 String& argument_name = String::Handle(zone);
9709 String& parameter_name = String::Handle(zone);
9710
9711 // Check types of named arguments against expected parameter type.
9712 for (intptr_t named_index = 0; named_index < num_named_arguments;
9713 named_index++) {
9714 argument_name = args_desc.NameAt(named_index);
9715 ASSERT(argument_name.IsSymbol());
9716 argument ^= args.At(arg_offset + args_desc.PositionAt(named_index));
9717
9718 // Try to find the named parameter that matches the provided argument.
9719 // Even when annotated with @required, named parameters are still stored
9720 // as if they were optional and so come after the fixed parameters.
9721 // Currently O(n^2) as there's no guarantee from either the CFE or the
9722 // VM that named parameters and named arguments are sorted in the same way.
9723 intptr_t param_index = num_fixed_params;
9724 for (; param_index < num_parameters; param_index++) {
9725 parameter_name = ParameterNameAt(param_index);
9726 ASSERT(parameter_name.IsSymbol());
9727
9728 if (!parameter_name.Equals(argument_name)) continue;
9729
9730 type = ParameterTypeAt(param_index);
9731 if (!check_argument(argument, type, instantiator_type_arguments,
9732 function_type_arguments)) {
9733 auto& name = String::Handle(zone, ParameterNameAt(param_index));
9734 if (!type.IsInstantiated()) {
9735 type = type.InstantiateFrom(instantiator_type_arguments,
9736 function_type_arguments, kAllFree,
9737 Heap::kNew);
9738 }
9739 return ThrowTypeError(token_pos(), argument, type, name);
9740 }
9741 break;
9742 }
9743 // Only should fail if AreValidArguments returns a false positive.
9744 ASSERT(param_index < num_parameters);
9745 }
9746 return Error::null();
9747}
static bool InstantiateAndTestSubtype(AbstractType *subtype, AbstractType *supertype, const TypeArguments &instantiator_type_args, const TypeArguments &function_type_args)
Definition object.cc:4342
intptr_t NumParentTypeArguments() const
Definition object.cc:8908
TokenPosition token_pos() const
Definition object.h:3426
AbstractTypePtr ParameterTypeAt(intptr_t index) const
Definition object.cc:8638
TypeParameterPtr TypeParameterAt(intptr_t index, Nullability nullability=Nullability::kNonNullable) const
Definition object.cc:8939
static bool NullIsAssignableTo(const AbstractType &other)
Definition object.cc:20715
const EmbeddedViewParams * params
static const char *const names[]
Definition symbols.cc:24
static ObjectPtr ThrowTypeError(const TokenPosition token_pos, const Instance &src_value, const AbstractType &dst_type, const String &dst_name)
Definition object.cc:4551
@ kAllFree
Definition object.h:2920

◆ DropUncompiledImplicitClosureFunction()

void dart::Function::DropUncompiledImplicitClosureFunction ( ) const

Definition at line 10665 of file object.cc.

10665 {
10666 if (implicit_closure_function() != Function::null()) {
10667 const Function& func = Function::Handle(implicit_closure_function());
10668 if (!func.HasCode()) {
10669 set_implicit_closure_function(Function::Handle());
10670 }
10671 }
10672}

◆ end_token_pos()

TokenPosition dart::Function::end_token_pos ( ) const
inline

Definition at line 3435 of file object.h.

3435 {
3436#if defined(DART_PRECOMPILED_RUNTIME)
3437 return TokenPosition::kNoSource;
3438#else
3439 return untag()->end_token_pos_;
3440#endif
3441 }

◆ EnsureHasCode()

CodePtr dart::Function::EnsureHasCode ( ) const

Definition at line 11396 of file object.cc.

11396 {
11397 if (HasCode()) return CurrentCode();
11398 Thread* thread = Thread::Current();
11399 ASSERT(thread->IsDartMutatorThread());
11400 DEBUG_ASSERT(thread->TopErrorHandlerIsExitFrame());
11401 Zone* zone = thread->zone();
11402 const Object& result =
11403 Object::Handle(zone, Compiler::CompileFunction(thread, *this));
11404 if (result.IsError()) {
11405 if (result.ptr() == Object::out_of_memory_error().ptr()) {
11407 UNREACHABLE();
11408 }
11409 if (result.IsLanguageError()) {
11410 Exceptions::ThrowCompileTimeError(LanguageError::Cast(result));
11411 UNREACHABLE();
11412 }
11413 Exceptions::PropagateError(Error::Cast(result));
11414 UNREACHABLE();
11415 }
11416 // Compiling in unoptimized mode should never fail if there are no errors.
11419 return CurrentCode();
11420}
#define DEBUG_ASSERT(cond)
Definition assert.h:321
#define RELEASE_ASSERT(cond)
Definition assert.h:327
static ObjectPtr CompileFunction(Thread *thread, const Function &function)
Definition compiler.cc:825
static DART_NORETURN void ThrowOOM()
static DART_NORETURN void ThrowCompileTimeError(const LanguageError &error)
static DART_NORETURN void PropagateError(const Error &error)
CodePtr CurrentCode() const
Definition object.h:3157
bool HasCode() const
Definition object.cc:7994
CodePtr unoptimized_code() const
Definition object.h:3165
GAsyncResult * result

◆ EnsureHasCompiledUnoptimizedCode()

void dart::Function::EnsureHasCompiledUnoptimizedCode ( ) const

Definition at line 8026 of file object.cc.

8026 {
8028 Thread* thread = Thread::Current();
8029 ASSERT(thread->IsDartMutatorThread());
8030 // TODO(35224): DEBUG_ASSERT(thread->TopErrorHandlerIsExitFrame());
8031 Zone* zone = thread->zone();
8032
8033 const Error& error =
8034 Error::Handle(zone, Compiler::EnsureUnoptimizedCode(thread, *this));
8035 if (!error.IsNull()) {
8037 }
8038}
static ErrorPtr EnsureUnoptimizedCode(Thread *thread, const Function &function)
Definition compiler.cc:855
const uint8_t uint32_t uint32_t GError ** error

◆ entry_point()

uword dart::Function::entry_point ( ) const
inline

Definition at line 3178 of file object.h.

3178{ return EntryPointOf(ptr()); }
static uword EntryPointOf(const FunctionPtr function)
Definition object.h:3179

◆ entry_point_offset()

static intptr_t dart::Function::entry_point_offset ( CodeEntryKind  entry_kind = CodeEntryKind::kNormal)
inlinestatic

Definition at line 3183 of file object.h.

3184 {
3185 switch (entry_kind) {
3187 return OFFSET_OF(UntaggedFunction, entry_point_);
3189 return OFFSET_OF(UntaggedFunction, unchecked_entry_point_);
3190 default:
3191 UNREACHABLE();
3192 }
3193 }

◆ EntryPointOf()

static uword dart::Function::EntryPointOf ( const FunctionPtr  function)
inlinestatic

Definition at line 3179 of file object.h.

3179 {
3180 return function->untag()->entry_point_;
3181 }

◆ extracted_method_closure()

FunctionPtr dart::Function::extracted_method_closure ( ) const

Definition at line 8178 of file object.cc.

8178 {
8179 ASSERT(kind() == UntaggedFunction::kMethodExtractor);
8180 const Object& obj = Object::Handle(untag()->data());
8181 ASSERT(obj.IsFunction());
8182 return Function::Cast(obj).ptr();
8183}

◆ FfiCallbackExceptionalReturn()

InstancePtr dart::Function::FfiCallbackExceptionalReturn ( ) const

Definition at line 8449 of file object.cc.

8449 {
8451 const Object& obj = Object::Handle(data());
8452 ASSERT(!obj.IsNull());
8453 return FfiTrampolineData::Cast(obj).callback_exceptional_return();
8454}

◆ FfiCallbackId()

int32_t dart::Function::FfiCallbackId ( ) const

Definition at line 8390 of file object.cc.

8390 {
8392
8393 const auto& obj = Object::Handle(data());
8394 ASSERT(!obj.IsNull());
8395 const auto& trampoline_data = FfiTrampolineData::Cast(obj);
8396
8397 ASSERT(trampoline_data.callback_id() != -1);
8398
8399 return trampoline_data.callback_id();
8400}

◆ FfiCallbackTarget()

FunctionPtr dart::Function::FfiCallbackTarget ( ) const

Definition at line 8435 of file object.cc.

8435 {
8437 const Object& obj = Object::Handle(data());
8438 ASSERT(!obj.IsNull());
8439 return FfiTrampolineData::Cast(obj).callback_target();
8440}

◆ FfiCSignature()

FunctionTypePtr dart::Function::FfiCSignature ( ) const

Definition at line 8322 of file object.cc.

8322 {
8323 auto* const zone = Thread::Current()->zone();
8325 const Object& obj = Object::Handle(zone, data());
8326 ASSERT(!obj.IsNull());
8327 return FfiTrampolineData::Cast(obj).c_signature();
8328 }
8329 auto& pragma_value = Instance::Handle(zone);
8330 if (is_ffi_native()) {
8331 pragma_value = GetNativeAnnotation();
8332 } else if (IsFfiCallClosure()) {
8333 pragma_value = GetFfiCallClosurePragmaValue();
8334 } else {
8335 UNREACHABLE();
8336 }
8337 const auto& type_args =
8338 TypeArguments::Handle(zone, pragma_value.GetTypeArguments());
8339 ASSERT(type_args.Length() == 1);
8340 const auto& native_type =
8341 FunctionType::Cast(AbstractType::ZoneHandle(zone, type_args.TypeAt(0)));
8342 return native_type.ptr();
8343}
InstancePtr GetFfiCallClosurePragmaValue() const
Definition object.cc:9132
InstancePtr GetNativeAnnotation() const
Definition object.cc:8578
static Object & ZoneHandle()
Definition object.h:419
Zone * zone() const

◆ FfiCSignatureContainsHandles()

bool dart::Function::FfiCSignatureContainsHandles ( ) const

Definition at line 8345 of file object.cc.

8345 {
8346 const FunctionType& c_signature = FunctionType::Handle(FfiCSignature());
8347 return c_signature.ContainsHandles();
8348}
FunctionTypePtr FfiCSignature() const
Definition object.cc:8322

◆ FfiCSignatureReturnsStruct()

bool dart::Function::FfiCSignatureReturnsStruct ( ) const

Definition at line 8364 of file object.cc.

8364 {
8366 Zone* zone = Thread::Current()->zone();
8367 const auto& c_signature = FunctionType::Handle(zone, FfiCSignature());
8368 const auto& type = AbstractType::Handle(zone, c_signature.result_type());
8369 if (IsFfiTypeClassId(type.type_class_id())) {
8370 return false;
8371 }
8372 const auto& cls = Class::Handle(zone, type.type_class());
8373 const auto& superClass = Class::Handle(zone, cls.SuperClass());
8374 const bool is_abi_specific_int =
8375 String::Handle(zone, superClass.UserVisibleName())
8376 .Equals(Symbols::AbiSpecificInteger());
8377 if (is_abi_specific_int) {
8378 return false;
8379 }
8380#ifdef DEBUG
8381 const bool is_struct = String::Handle(zone, superClass.UserVisibleName())
8382 .Equals(Symbols::Struct());
8383 const bool is_union = String::Handle(zone, superClass.UserVisibleName())
8384 .Equals(Symbols::Union());
8385 ASSERT(is_struct || is_union);
8386#endif
8387 return true;
8388}
bool IsFfiTypeClassId(intptr_t index)
Definition class_id.h:513

◆ FfiIsLeaf()

bool dart::Function::FfiIsLeaf ( ) const

Definition at line 8413 of file object.cc.

8413 {
8414 Zone* zone = Thread::Current()->zone();
8415 auto& pragma_value = Instance::Handle(zone);
8416 if (is_ffi_native()) {
8417 pragma_value = GetNativeAnnotation();
8418 } else if (IsFfiCallClosure()) {
8419 pragma_value = GetFfiCallClosurePragmaValue();
8420 } else {
8421 UNREACHABLE();
8422 }
8423 const auto& pragma_value_class = Class::Handle(zone, pragma_value.clazz());
8424 const auto& pragma_value_fields =
8425 Array::Handle(zone, pragma_value_class.fields());
8426 ASSERT(pragma_value_fields.Length() >= 1);
8427 const auto& is_leaf_field = Field::Handle(
8428 zone,
8429 Field::RawCast(pragma_value_fields.At(pragma_value_fields.Length() - 1)));
8430 ASSERT(is_leaf_field.name() == Symbols::isLeaf().ptr());
8431 return Bool::Handle(zone, Bool::RawCast(pragma_value.GetField(is_leaf_field)))
8432 .value();
8433}

◆ FindICData()

ICDataPtr dart::Function::FindICData ( intptr_t  deopt_id) const

Definition at line 11338 of file object.cc.

11338 {
11339 const Array& array = Array::Handle(ic_data_array());
11340 ICData& ic_data = ICData::Handle();
11341 for (intptr_t i = ICDataArrayIndices::kFirstICData; i < array.Length(); i++) {
11342 ic_data ^= array.At(i);
11343 if (ic_data.deopt_id() == deopt_id) {
11344 return ic_data.ptr();
11345 }
11346 }
11347 return ICData::null();
11348}
ArrayPtr ic_data_array() const
Definition object.cc:11330
static constexpr intptr_t kFirstICData
Definition object.h:4041

◆ ForceOptimize()

bool dart::Function::ForceOptimize ( ) const

Definition at line 9075 of file object.cc.

9075 {
9079 return true;
9080 }
9081
9082 if (!has_pragma()) return false;
9083
9084 const bool has_vm_pragma = Library::FindPragma(
9085 Thread::Current(), false, *this, Symbols::vm_force_optimize());
9086 if (!has_vm_pragma) return false;
9087
9088 // For run_vm_tests and runtime/tests/vm allow marking arbitrary functions as
9089 // force-optimize via `@pragma('vm:force-optimize')`.
9090 return InVmTests(*this);
9091}
bool IsTypedDataViewFactory() const
Definition object.cc:9015
bool IsUnmodifiableTypedDataViewFactory() const
Definition object.cc:9038
bool RecognizedKindForceOptimize() const
Definition object.cc:9144
static bool FindPragma(Thread *T, bool only_core, const Object &object, const String &pragma_name, bool multiple=false, Object *options=nullptr)
Definition object.cc:4201
static bool InVmTests(const Function &function)
Definition object.cc:9061

◆ ForwardingTarget()

FunctionPtr dart::Function::ForwardingTarget ( ) const

Definition at line 8481 of file object.cc.

8481 {
8482 ASSERT(kind() == UntaggedFunction::kDynamicInvocationForwarder);
8484}
static ObjectPtr Unwrap(ObjectPtr obj)
Definition object.h:6640

◆ GetCoverageArray()

ArrayPtr dart::Function::GetCoverageArray ( ) const

Definition at line 11318 of file object.cc.

11318 {
11319 const Array& arr = Array::Handle(ic_data_array());
11320 if (arr.IsNull()) {
11321 return Array::null();
11322 }
11324}
static constexpr intptr_t kCoverageData
Definition object.h:4040

◆ GetDynamicInvocationForwarder()

FunctionPtr dart::Function::GetDynamicInvocationForwarder ( const String mangled_name,
bool  allow_add = true 
) const

Definition at line 4298 of file object.cc.

4300 {
4302 auto thread = Thread::Current();
4303 auto zone = thread->zone();
4304 const Class& owner = Class::Handle(zone, Owner());
4305 Function& result = Function::Handle(zone);
4306
4307 // First we'll try to find it without using locks.
4308 result = owner.GetInvocationDispatcher(
4309 mangled_name, Array::null_array(),
4310 UntaggedFunction::kDynamicInvocationForwarder,
4311 /*create_if_absent=*/false);
4312 if (!result.IsNull()) return result.ptr();
4313
4314 const bool needs_dyn_forwarder =
4315 kernel::NeedsDynamicInvocationForwarder(*this);
4316 if (!needs_dyn_forwarder) {
4317 return ptr();
4318 }
4319
4320 if (!allow_add) {
4321 return Function::null();
4322 }
4323
4324 // If we failed to find it and possibly need to create it, use a write lock.
4325 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
4326
4327 // Try to find it again & return if it was added in the mean time.
4328 result = owner.GetInvocationDispatcher(
4329 mangled_name, Array::null_array(),
4330 UntaggedFunction::kDynamicInvocationForwarder,
4331 /*create_if_absent=*/false);
4332 if (!result.IsNull()) return result.ptr();
4333
4334 // Otherwise create it & add it.
4336 owner.AddInvocationDispatcher(mangled_name, Array::null_array(), result);
4337 return result.ptr();
4338}
FunctionPtr CreateDynamicInvocationForwarder(const String &mangled_name) const
Definition object.cc:4260
static bool IsDynamicInvocationForwarderName(const String &name)
Definition object.cc:4240

◆ GetFfiCallbackKind()

FfiCallbackKind dart::Function::GetFfiCallbackKind ( ) const

Definition at line 8463 of file object.cc.

8463 {
8465 const Object& obj = Object::Handle(data());
8466 ASSERT(!obj.IsNull());
8467 return FfiTrampolineData::Cast(obj).ffi_function_kind();
8468}

◆ GetFfiCallClosurePragmaValue()

InstancePtr dart::Function::GetFfiCallClosurePragmaValue ( ) const

Definition at line 9132 of file object.cc.

9132 {
9134 Thread* thread = Thread::Current();
9135 Zone* zone = thread->zone();
9136 auto& pragma_value = Object::Handle(zone);
9137 Library::FindPragma(thread, /*only_core=*/false, *this,
9138 Symbols::vm_ffi_call_closure(),
9139 /*multiple=*/false, &pragma_value);
9140 ASSERT(!pragma_value.IsNull());
9141 return Instance::Cast(pragma_value).ptr();
9142}

◆ GetMethodExtractor()

FunctionPtr dart::Function::GetMethodExtractor ( const String getter_name) const

Definition at line 4063 of file object.cc.

4063 {
4064 ASSERT(Field::IsGetterName(getter_name));
4065 const Function& closure_function =
4067 const Class& owner = Class::Handle(closure_function.Owner());
4068 Thread* thread = Thread::Current();
4069 if (owner.EnsureIsFinalized(thread) != Error::null()) {
4070 return Function::null();
4071 }
4072 IsolateGroup* group = thread->isolate_group();
4073 Function& result = Function::Handle(
4074 Resolver::ResolveDynamicFunction(thread->zone(), owner, getter_name));
4075 if (result.IsNull()) {
4076 SafepointWriteRwLocker ml(thread, group->program_lock());
4077 result = owner.LookupDynamicFunctionUnsafe(getter_name);
4078 if (result.IsNull()) {
4079 result = CreateMethodExtractor(getter_name);
4080 }
4081 }
4082 ASSERT(result.kind() == UntaggedFunction::kMethodExtractor);
4083 return result.ptr();
4084}
FunctionPtr CreateMethodExtractor(const String &getter_name) const
Definition object.cc:4017
static FunctionPtr ResolveDynamicFunction(Zone *zone, const Class &receiver_class, const String &function_name)
Definition resolver.cc:189

◆ GetNativeAnnotation()

InstancePtr dart::Function::GetNativeAnnotation ( ) const

Definition at line 8578 of file object.cc.

8578 {
8580 Zone* zone = Thread::Current()->zone();
8581 auto& pragma_value = Object::Handle(zone);
8582 Library::FindPragma(dart::Thread::Current(), /*only_core=*/false,
8583 Object::Handle(zone, ptr()),
8584 String::Handle(zone, Symbols::vm_ffi_native().ptr()),
8585 /*multiple=*/false, &pragma_value);
8586 auto const& native_instance = Instance::Cast(pragma_value);
8587 ASSERT(!native_instance.IsNull());
8588#if defined(DEBUG)
8589 const auto& native_class = Class::Handle(zone, native_instance.clazz());
8590 ASSERT(String::Handle(zone, native_class.UserVisibleName())
8591 .Equals(Symbols::FfiNative()));
8592#endif
8593 return native_instance.ptr();
8594}

◆ GetOutermostFunction()

FunctionPtr dart::Function::GetOutermostFunction ( ) const

Definition at line 8265 of file object.cc.

8265 {
8266 FunctionPtr parent = parent_function();
8267 if (parent == Object::null()) {
8268 return ptr();
8269 }
8270 Function& function = Function::Handle();
8271 do {
8272 function = parent;
8273 parent = function.parent_function();
8274 } while (parent != Object::null());
8275 return function.ptr();
8276}
FunctionPtr parent_function() const
Definition object.cc:8225

◆ GetSource()

StringPtr dart::Function::GetSource ( ) const

Definition at line 11177 of file object.cc.

11177 {
11178 if (IsImplicitConstructor() || is_synthetic()) {
11179 // We may need to handle more cases when the restrictions on mixins are
11180 // relaxed. In particular we might start associating some source with the
11181 // forwarding constructors when it becomes possible to specify a particular
11182 // constructor from the mixin to use.
11183 return String::null();
11184 }
11185 Zone* zone = Thread::Current()->zone();
11186 const Script& func_script = Script::Handle(zone, script());
11187
11188 intptr_t from_line, from_col;
11189 if (!func_script.GetTokenLocation(token_pos(), &from_line, &from_col)) {
11190 return String::null();
11191 }
11192 intptr_t to_line, to_col;
11193 if (!func_script.GetTokenLocation(end_token_pos(), &to_line, &to_col)) {
11194 return String::null();
11195 }
11196 intptr_t to_length = func_script.GetTokenLength(end_token_pos());
11197 if (to_length < 0) {
11198 return String::null();
11199 }
11200
11201 if (to_length == 1) {
11202 // Handle special cases for end tokens of closures (where we exclude the
11203 // last token):
11204 // (1) "foo(() => null, bar);": End token is `,', but we don't print it.
11205 // (2) "foo(() => null);": End token is ')`, but we don't print it.
11206 // (3) "var foo = () => null;": End token is `;', but in this case the
11207 // token semicolon belongs to the assignment so we skip it.
11208 const String& src = String::Handle(func_script.Source());
11209 if (src.IsNull() || src.Length() == 0) {
11210 return Symbols::OptimizedOut().ptr();
11211 }
11212 uint16_t end_char = src.CharAt(end_token_pos().Pos());
11213 if ((end_char == ',') || // Case 1.
11214 (end_char == ')') || // Case 2.
11215 (end_char == ';' && String::Handle(zone, name())
11216 .Equals("<anonymous closure>"))) { // Case 3.
11217 to_length = 0;
11218 }
11219 }
11220
11221 return func_script.GetSnippet(from_line, from_col, to_line,
11222 to_col + to_length);
11223}
bool IsImplicitConstructor() const
Definition object.cc:10276
ScriptPtr script() const
Definition object.cc:10939
TokenPosition end_token_pos() const
Definition object.h:3435
static bool Equals(const Object &expected, const Object &actual)

◆ has_unboxed_double_return()

bool dart::Function::has_unboxed_double_return ( ) const
inline

Definition at line 3799 of file object.h.

3799 {
3800#if !defined(DART_PRECOMPILED_RUNTIME)
3801 return untag()->unboxed_parameters_info_.IsUnboxedDouble(0);
3802#else
3803 return false;
3804#endif // !defined(DART_PRECOMPILED_RUNTIME)
3805 }

◆ has_unboxed_integer_return()

bool dart::Function::has_unboxed_integer_return ( ) const
inline

Definition at line 3791 of file object.h.

3791 {
3792#if !defined(DART_PRECOMPILED_RUNTIME)
3793 return untag()->unboxed_parameters_info_.IsUnboxedInteger(0);
3794#else
3795 return false;
3796#endif // !defined(DART_PRECOMPILED_RUNTIME)
3797 }

◆ has_unboxed_record_return()

bool dart::Function::has_unboxed_record_return ( ) const
inline

Definition at line 3807 of file object.h.

3807 {
3808#if !defined(DART_PRECOMPILED_RUNTIME)
3809 return untag()->unboxed_parameters_info_.IsUnboxedRecord(0);
3810#else
3811 return false;
3812#endif // !defined(DART_PRECOMPILED_RUNTIME)
3813 }

◆ has_unboxed_return()

bool dart::Function::has_unboxed_return ( ) const
inline

Definition at line 3783 of file object.h.

3783 {
3784#if !defined(DART_PRECOMPILED_RUNTIME)
3785 return untag()->unboxed_parameters_info_.IsUnboxed(0);
3786#else
3787 return false;
3788#endif // !defined(DART_PRECOMPILED_RUNTIME)
3789 }

◆ HasAwaiterLink()

bool dart::Function::HasAwaiterLink ( ) const
inline

Definition at line 3219 of file object.h.

3219 {
3220 return IsClosureFunction() &&
3221 (awaiter_link().depth != UntaggedClosureData::kNoAwaiterLinkDepth);
3222 }
AwaiterLink awaiter_link() const
Definition object.cc:8125

◆ HasBreakpoint()

bool dart::Function::HasBreakpoint ( ) const

Definition at line 7948 of file object.cc.

7948 {
7949#if defined(PRODUCT)
7950 return false;
7951#else
7952 auto thread = Thread::Current();
7953 return thread->isolate_group()->debugger()->HasBreakpoint(thread, *this);
7954#endif
7955}

◆ HasCode() [1/2]

bool dart::Function::HasCode ( ) const

Definition at line 7994 of file object.cc.

7994 {
7995 NoSafepointScope no_safepoint;
7996 ASSERT(untag()->code() != Code::null());
7997 return untag()->code() != StubCode::LazyCompile().ptr();
7998}

◆ HasCode() [2/2]

bool dart::Function::HasCode ( FunctionPtr  function)
static

Definition at line 8000 of file object.cc.

8000 {
8001 NoSafepointScope no_safepoint;
8002 ASSERT(function->untag()->code() != Code::null());
8003 return function->untag()->code() != StubCode::LazyCompile().ptr();
8004}

◆ HasDynamicCallers()

bool dart::Function::HasDynamicCallers ( Zone zone) const

Definition at line 11460 of file object.cc.

11460 {
11461#if !defined(DART_PRECOMPILED_RUNTIME)
11462 // Issue(dartbug.com/42719):
11463 // Right now the metadata of _Closure.call says there are no dynamic callers -
11464 // even though there can be. To be conservative we return true.
11465 if ((name() == Symbols::GetCall().ptr() || name() == Symbols::call().ptr()) &&
11467 return true;
11468 }
11469
11470 // Use the results of TFA to determine whether this function is ever
11471 // called dynamically, i.e. using switchable calls.
11472 kernel::ProcedureAttributesMetadata metadata;
11473 metadata = kernel::ProcedureAttributesOf(*this, zone);
11475 // Dynamic method call through field/getter involves dynamic call of
11476 // the field/getter.
11477 return metadata.getter_called_dynamically ||
11478 metadata.method_or_setter_called_dynamically;
11479 } else {
11480 return metadata.method_or_setter_called_dynamically;
11481 }
11482#else
11483 UNREACHABLE();
11484 return true;
11485#endif
11486}
bool IsClosureClass() const
Definition object.h:1579
bool IsImplicitGetterFunction() const
Definition object.h:3842
bool IsGetterFunction() const
Definition object.h:3837
bool IsMethodExtractor() const
Definition object.h:3264

◆ HasGenericParent()

bool dart::Function::HasGenericParent ( ) const
inline

Definition at line 3123 of file object.h.

3123{ return NumParentTypeArguments() > 0; }

◆ Hash()

uword dart::Function::Hash ( ) const
virtual

Definition at line 7937 of file object.cc.

7937 {
7939 if (IsClosureFunction()) {
7940 hash = hash ^ token_pos().Hash();
7941 }
7942 if (Owner()->IsClass()) {
7944 }
7945 return hash;
7946}
static uint32_t hash(const SkShaderBase::GradientInfo &v)
uint32_t Hash() const
Definition object.cc:5652
static uword HashRawSymbol(const StringPtr symbol)
Definition object.h:10226
uintptr_t uword
Definition globals.h:501

◆ HasImplicitClosureFunction()

bool dart::Function::HasImplicitClosureFunction ( ) const
inline

Definition at line 3306 of file object.h.

3306 {
3307 return implicit_closure_function() != null();
3308 }

◆ HasInstantiatedSignature()

bool dart::Function::HasInstantiatedSignature ( Genericity  genericity = kAny,
intptr_t  num_free_fun_type_params = kAllFree 
) const

Definition at line 10843 of file object.cc.

10845 {
10846 return FunctionType::Handle(signature())
10847 .IsInstantiated(genericity, num_free_fun_type_params);
10848}

◆ HasOptimizedCode()

bool dart::Function::HasOptimizedCode ( ) const

Definition at line 11032 of file object.cc.

11032 {
11033 return HasCode() && Code::Handle(CurrentCode()).is_optimized();
11034}

◆ HasOptionalNamedParameters()

bool dart::Function::HasOptionalNamedParameters ( ) const

Definition at line 8920 of file object.cc.

8920 {
8921 return FunctionType::HasOptionalNamedParameters(signature());
8922}
bool HasOptionalNamedParameters() const
Definition object.h:9589

◆ HasOptionalParameters()

bool dart::Function::HasOptionalParameters ( ) const

Definition at line 8917 of file object.cc.

8917 {
8918 return FunctionType::HasOptionalParameters(signature());
8919}
bool HasOptionalParameters() const
Definition object.h:9583

◆ HasOptionalPositionalParameters()

bool dart::Function::HasOptionalPositionalParameters ( ) const

Definition at line 8923 of file object.cc.

8923 {
8925}
bool HasOptionalPositionalParameters() const
Definition object.h:9597

◆ HasParent()

bool dart::Function::HasParent ( ) const
inline

Definition at line 3910 of file object.h.

3910{ return parent_function() != Function::null(); }

◆ HasRequiredNamedParameters()

bool dart::Function::HasRequiredNamedParameters ( ) const

Definition at line 8789 of file object.cc.

8789 {
8790#if defined(DART_PRECOMPILED_RUNTIME)
8791 if (signature() == FunctionType::null()) {
8792 // Signatures for functions with required named parameters are not dropped.
8793 return false;
8794 }
8795#endif
8796 return FunctionType::Handle(signature()).HasRequiredNamedParameters();
8797}

◆ HasSavedArgumentsDescriptor()

bool dart::Function::HasSavedArgumentsDescriptor ( ) const
inline

Definition at line 3253 of file object.h.

3253 {
3255 }

◆ HasThisParameter()

bool dart::Function::HasThisParameter ( ) const
inline

Definition at line 3349 of file object.h.

3349 {
3350 return IsDynamicFunction(/*allow_abstract=*/true) ||
3351 IsGenerativeConstructor() || (IsFieldInitializer() && !is_static());
3352 }
bool IsDynamicFunction(bool allow_abstract=false) const
Definition object.h:3354
bool IsGenerativeConstructor() const
Definition object.h:3343

◆ HasUnboxedParameters()

bool dart::Function::HasUnboxedParameters ( ) const
inline

Definition at line 3816 of file object.h.

3816 {
3817 return untag()->unboxed_parameters_info_.HasUnboxedParameters();
3818 }

◆ HasUnboxedReturnValue()

bool dart::Function::HasUnboxedReturnValue ( ) const
inline

Definition at line 3819 of file object.h.

3819{ return has_unboxed_return(); }
bool has_unboxed_return() const
Definition object.h:3783

◆ ic_data_array()

ArrayPtr dart::Function::ic_data_array ( ) const

Definition at line 11330 of file object.cc.

11330 {
11331 return untag()->ic_data_array<std::memory_order_acquire>();
11332}

◆ ImplicitClosureFunction()

FunctionPtr dart::Function::ImplicitClosureFunction ( ) const

Definition at line 10443 of file object.cc.

10443 {
10444 // Return the existing implicit closure function if any.
10445 if (implicit_closure_function() != Function::null()) {
10446 return implicit_closure_function();
10447 }
10448
10449#if defined(DART_PRECOMPILED_RUNTIME)
10450 // In AOT mode all implicit closures are pre-created.
10451 FATAL("Cannot create implicit closure in AOT!");
10452 return Function::null();
10453#else
10455 Thread* thread = Thread::Current();
10456 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
10457
10458 if (implicit_closure_function() != Function::null()) {
10459 return implicit_closure_function();
10460 }
10461
10462 // Create closure function.
10463 Zone* zone = thread->zone();
10464 const String& closure_name = String::Handle(zone, name());
10465 const Function& closure_function = Function::Handle(
10466 zone, NewImplicitClosureFunction(closure_name, *this, token_pos()));
10467
10468 // Set closure function's context scope.
10469 if (is_static() || IsConstructor()) {
10470 closure_function.set_context_scope(Object::empty_context_scope());
10471 } else {
10472 const ContextScope& context_scope = ContextScope::Handle(
10474 closure_function.set_context_scope(context_scope);
10475 }
10476
10477 FunctionType& closure_signature =
10478 FunctionType::Handle(zone, closure_function.signature());
10479
10480 const auto& cls = Class::Handle(zone, Owner());
10481
10482 if (!is_static() && !IsConstructor() &&
10484 closure_function.set_awaiter_link({0, 0});
10485 }
10486
10487 const intptr_t num_type_params =
10488 IsConstructor() ? cls.NumTypeParameters() : NumTypeParameters();
10489
10490 TypeArguments& instantiator_type_arguments = TypeArguments::Handle(zone);
10491 TypeArguments& function_type_arguments = TypeArguments::Handle(zone);
10492
10493 FunctionTypeMapping* function_type_mapping = nullptr;
10494 FunctionTypeMapping scope(zone, &function_type_mapping,
10495 FunctionType::Handle(zone, signature()),
10496 closure_signature);
10497
10498 auto transform_type = [&](AbstractType& type) {
10499 if (num_type_params > 0) {
10500 if (IsConstructor()) {
10501 type = type.UpdateFunctionTypes(num_type_params, kAllFree, Heap::kOld,
10502 nullptr);
10503 if (!type.IsInstantiated(kCurrentClass)) {
10504 type = type.InstantiateFrom(
10505 instantiator_type_arguments, function_type_arguments,
10506 kNoneFree /* avoid truncating parent type args */, Heap::kOld);
10507 }
10508 } else {
10509 type = type.UpdateFunctionTypes(0, kNoneFree, Heap::kOld,
10510 function_type_mapping);
10511 }
10512 }
10513 };
10514
10515 auto transform_type_args = [&](TypeArguments& type_args) {
10516 ASSERT(num_type_params > 0);
10517 if (!type_args.IsNull()) {
10518 if (IsConstructor()) {
10519 type_args = type_args.UpdateFunctionTypes(num_type_params, kAllFree,
10520 Heap::kOld, nullptr);
10521 if (!type_args.IsInstantiated(kCurrentClass)) {
10522 type_args = type_args.InstantiateFrom(
10523 instantiator_type_arguments, function_type_arguments,
10524 kNoneFree /* avoid truncating parent type args */, Heap::kOld);
10525 }
10526 } else {
10527 type_args = type_args.UpdateFunctionTypes(0, kNoneFree, Heap::kOld,
10528 function_type_mapping);
10529 }
10530 }
10531 };
10532
10533 // Set closure function's type parameters.
10534 if (num_type_params > 0) {
10535 const TypeParameters& old_type_params = TypeParameters::Handle(
10536 zone, IsConstructor() ? cls.type_parameters() : type_parameters());
10537 const TypeParameters& new_type_params =
10539 // No need to set names that are ignored in a signature, however, the
10540 // length of the names array defines the number of type parameters.
10541 new_type_params.set_names(Array::Handle(zone, old_type_params.names()));
10542 new_type_params.set_flags(Array::Handle(zone, old_type_params.flags()));
10543
10544 closure_signature.SetTypeParameters(new_type_params);
10545 ASSERT(closure_signature.NumTypeParameters() == num_type_params);
10546
10547 TypeArguments& type_args = TypeArguments::Handle(zone);
10548 type_args = TypeArguments::New(num_type_params);
10549 TypeParameter& type_param = TypeParameter::Handle(zone);
10550 for (intptr_t i = 0; i < num_type_params; i++) {
10551 type_param = closure_signature.TypeParameterAt(i);
10552 type_args.SetTypeAt(i, type_param);
10553 }
10554
10555 if (IsConstructor()) {
10556 instantiator_type_arguments =
10557 type_args.ToInstantiatorTypeArguments(thread, cls);
10558 } else {
10559 ASSERT(NumTypeArguments() == type_args.Length());
10560 function_type_arguments = type_args.ptr();
10561 }
10562
10563 type_args = old_type_params.bounds();
10564 transform_type_args(type_args);
10565 new_type_params.set_bounds(type_args);
10566
10567 type_args = old_type_params.defaults();
10568 transform_type_args(type_args);
10569 new_type_params.set_defaults(type_args);
10570 }
10571
10572 // Set closure function's result type.
10573 AbstractType& result_type = AbstractType::Handle(zone);
10574 if (IsConstructor()) {
10575 result_type = cls.DeclarationType();
10576 } else {
10577 result_type = this->result_type();
10578 }
10579 transform_type(result_type);
10580 closure_signature.set_result_type(result_type);
10581
10582 // Set closure function's end token to this end token.
10583 closure_function.set_end_token_pos(end_token_pos());
10584
10585 // The closurized method stub just calls into the original method and should
10586 // therefore be skipped by the debugger and in stack traces.
10587 closure_function.set_is_debuggable(false);
10588 closure_function.set_is_visible(false);
10589
10590 // Set closure function's formal parameters to this formal parameters,
10591 // removing the receiver if this is an instance method and adding the closure
10592 // object as first parameter.
10593 const int kClosure = 1;
10594 const int num_implicit_params = NumImplicitParameters();
10595 const int num_fixed_params =
10596 kClosure - num_implicit_params + num_fixed_parameters();
10597 const int num_opt_params = NumOptionalParameters();
10598 const bool has_opt_pos_params = HasOptionalPositionalParameters();
10599 const int num_params = num_fixed_params + num_opt_params;
10600 const int num_pos_params = has_opt_pos_params ? num_params : num_fixed_params;
10601 closure_signature.set_num_fixed_parameters(num_fixed_params);
10602 closure_signature.SetNumOptionalParameters(num_opt_params,
10603 has_opt_pos_params);
10604 closure_signature.set_parameter_types(
10605 Array::Handle(zone, Array::New(num_params, Heap::kOld)));
10606 closure_function.CreateNameArray();
10607 closure_signature.CreateNameArrayIncludingFlags();
10608 AbstractType& param_type = AbstractType::Handle(zone);
10609 String& param_name = String::Handle(zone);
10610 // Add implicit closure object parameter.
10611 param_type = Type::DynamicType();
10612 closure_signature.SetParameterTypeAt(0, param_type);
10613 closure_function.SetParameterNameAt(0, Symbols::ClosureParameter());
10614 for (int i = kClosure; i < num_pos_params; i++) {
10615 param_type = ParameterTypeAt(num_implicit_params - kClosure + i);
10616 transform_type(param_type);
10617 closure_signature.SetParameterTypeAt(i, param_type);
10618 param_name = ParameterNameAt(num_implicit_params - kClosure + i);
10619 // Set the name in the function for positional parameters.
10620 closure_function.SetParameterNameAt(i, param_name);
10621 }
10622 for (int i = num_pos_params; i < num_params; i++) {
10623 param_type = ParameterTypeAt(num_implicit_params - kClosure + i);
10624 transform_type(param_type);
10625 closure_signature.SetParameterTypeAt(i, param_type);
10626 param_name = ParameterNameAt(num_implicit_params - kClosure + i);
10627 // Set the name in the signature for named parameters.
10628 closure_signature.SetParameterNameAt(i, param_name);
10629 if (IsRequiredAt(num_implicit_params - kClosure + i)) {
10630 closure_signature.SetIsRequiredAt(i);
10631 }
10632 }
10633 closure_signature.FinalizeNameArray();
10634 closure_function.InheritKernelOffsetFrom(*this);
10635
10636 if (!is_static() && !IsConstructor()) {
10637 // Change covariant parameter types to Object?.
10638 BitVector is_covariant(zone, NumParameters());
10639 BitVector is_generic_covariant_impl(zone, NumParameters());
10640 kernel::ReadParameterCovariance(*this, &is_covariant,
10641 &is_generic_covariant_impl);
10642
10643 ObjectStore* object_store = IsolateGroup::Current()->object_store();
10644 const auto& object_type =
10645 Type::Handle(zone, object_store->nullable_object_type());
10646 ASSERT(object_type.IsCanonical());
10647 for (intptr_t i = kClosure; i < num_params; ++i) {
10648 const intptr_t original_param_index = num_implicit_params - kClosure + i;
10649 if (is_covariant.Contains(original_param_index) ||
10650 is_generic_covariant_impl.Contains(original_param_index)) {
10651 closure_signature.SetParameterTypeAt(i, object_type);
10652 }
10653 }
10654 }
10655 ASSERT(!closure_signature.IsFinalized());
10656 closure_signature ^= ClassFinalizer::FinalizeType(closure_signature);
10657 closure_function.SetSignature(closure_signature);
10658 set_implicit_closure_function(closure_function);
10659 ASSERT(closure_function.IsImplicitClosureFunction());
10661 return closure_function.ptr();
10662#endif // defined(DART_PRECOMPILED_RUNTIME)
10663}
intptr_t NumOptionalParameters() const
Definition object.cc:8926
intptr_t NumTypeArguments() const
Definition object.cc:8911
bool HasOptionalPositionalParameters() const
Definition object.cc:8923
static FunctionPtr NewImplicitClosureFunction(const String &name, const Function &parent, TokenPosition token_pos)
Definition object.cc:10416
bool IsConstructor() const
Definition object.h:3340
ContextScopePtr context_scope() const
Definition object.cc:8106
bool HasImplicitClosureFunction() const
Definition object.h:3306
AbstractTypePtr result_type() const
Definition object.h:3079
ObjectStore * object_store() const
Definition isolate.h:505
static ContextScopePtr CreateImplicitClosureScope(const Function &func)
Definition scopes.cc:580
static bool IsPossibleAwaiterLink(const Class &cls)
static TypeArgumentsPtr New(intptr_t len, Heap::Space space=Heap::kOld)
Definition object.cc:7733
static TypeParametersPtr New(Heap::Space space=Heap::kOld)
Definition object.cc:6778
static TypePtr DynamicType()
Definition object.cc:21866
#define FATAL(error)
@ kNoneFree
Definition object.h:2906
@ kCurrentClass
Definition object.h:2230

◆ ImplicitClosureTarget()

FunctionPtr dart::Function::ImplicitClosureTarget ( Zone zone) const

Definition at line 10792 of file object.cc.

10792 {
10793 const auto& parent = Function::Handle(zone, parent_function());
10794 const auto& func_name = String::Handle(zone, parent.name());
10795 const auto& owner = Class::Handle(zone, parent.Owner());
10796 Thread* thread = Thread::Current();
10797 const auto& error = owner.EnsureIsFinalized(thread);
10798 ASSERT(error == Error::null());
10799 auto& target =
10800 Function::Handle(zone, Resolver::ResolveFunction(zone, owner, func_name));
10801
10802 if (!target.IsNull() && (target.ptr() != parent.ptr())) {
10803 DEBUG_ASSERT(IsolateGroup::Current()->HasAttemptedReload());
10804 if ((target.is_static() != parent.is_static()) ||
10805 (target.kind() != parent.kind())) {
10807 }
10808 }
10809
10810 return target.ptr();
10811}
uint32_t * target

◆ ImplicitInstanceClosure()

ClosurePtr dart::Function::ImplicitInstanceClosure ( const Instance receiver) const

Definition at line 10780 of file object.cc.

10780 {
10782 Zone* zone = Thread::Current()->zone();
10783 TypeArguments& instantiator_type_arguments = TypeArguments::Handle(zone);
10785 instantiator_type_arguments = receiver.GetTypeArguments();
10786 }
10787 ASSERT(!HasGenericParent()); // No generic parent function.
10788 return Closure::New(instantiator_type_arguments,
10789 Object::null_type_arguments(), *this, receiver);
10790}
static ClosurePtr New(const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const Function &function, const Object &context, Heap::Space space=Heap::kNew)
Definition object.cc:26021
bool HasInstantiatedSignature(Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
Definition object.cc:10843
bool HasGenericParent() const
Definition object.h:3123

◆ ImplicitStaticClosure()

ClosurePtr dart::Function::ImplicitStaticClosure ( ) const

Definition at line 10758 of file object.cc.

10758 {
10760 if (implicit_static_closure() != Closure::null()) {
10761 return implicit_static_closure();
10762 }
10763
10764 auto thread = Thread::Current();
10765 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
10766
10767 if (implicit_static_closure() != Closure::null()) {
10768 return implicit_static_closure();
10769 }
10770
10771 Zone* zone = thread->zone();
10772 const auto& closure =
10773 Closure::Handle(zone, Closure::New(Object::null_type_arguments(),
10774 Object::null_type_arguments(), *this,
10775 Object::null_object(), Heap::kOld));
10776 set_implicit_static_closure(closure);
10777 return implicit_static_closure();
10778}
bool IsImplicitStaticClosureFunction() const
Definition object.h:3897
std::function< void()> closure
Definition closure.h:14

◆ InheritKernelOffsetFrom() [1/2]

void dart::Function::InheritKernelOffsetFrom ( const Field src) const

Definition at line 10917 of file object.cc.

10917 {
10918#if defined(DART_PRECOMPILED_RUNTIME)
10919 UNREACHABLE();
10920#else
10921 set_kernel_offset(src.kernel_offset());
10922#endif
10923}
void set_kernel_offset(intptr_t value) const
Definition object.h:3538

◆ InheritKernelOffsetFrom() [2/2]

void dart::Function::InheritKernelOffsetFrom ( const Function src) const

Definition at line 10909 of file object.cc.

10909 {
10910#if defined(DART_PRECOMPILED_RUNTIME)
10911 UNREACHABLE();
10912#else
10913 StoreNonPointer(&untag()->kernel_offset_, src.untag()->kernel_offset_);
10914#endif
10915}
void StoreNonPointer(const FieldType *addr, ValueType value) const
Definition object.h:819

◆ InstallOptimizedCode()

void dart::Function::InstallOptimizedCode ( const Code code) const

Definition at line 7957 of file object.cc.

7957 {
7958 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
7959 // We may not have previous code if FLAG_precompile is set.
7960 // Hot-reload may have already disabled the current code.
7961 if (HasCode() && !Code::Handle(CurrentCode()).IsDisabled()) {
7962 Code::Handle(CurrentCode()).DisableDartCode();
7963 }
7964 AttachCode(code);
7965}
void AttachCode(const Code &value) const
Definition object.cc:7985

◆ InstanceSize()

static intptr_t dart::Function::InstanceSize ( )
inlinestatic

Definition at line 3965 of file object.h.

3965 {
3967 }
static constexpr intptr_t RoundedAllocationSize(intptr_t size)
Definition object.h:758

◆ InternalSignature()

StringPtr dart::Function::InternalSignature ( ) const

Definition at line 10674 of file object.cc.

10674 {
10675#if defined(DART_PRECOMPILED_RUNTIME)
10676 if (signature() == FunctionType::null()) {
10677 return String::null();
10678 }
10679#endif
10680 Thread* thread = Thread::Current();
10681 ZoneTextBuffer printer(thread->zone());
10682 const FunctionType& sig = FunctionType::Handle(signature());
10683 sig.Print(kInternalName, &printer);
10684 return Symbols::New(thread, printer.buffer());
10685}
@ kInternalName
Definition object.h:622

◆ is_ffi_native()

bool dart::Function::is_ffi_native ( ) const

Definition at line 8600 of file object.cc.

8600 {
8601 return is_native() && is_external();
8602}

◆ is_old_native()

bool dart::Function::is_old_native ( ) const

Definition at line 8596 of file object.cc.

8596 {
8597 return is_native() && !is_external();
8598}

◆ is_optimizable()

bool dart::Function::is_optimizable ( ) const
inline

Definition at line 4178 of file object.h.

4178 {
4179#if defined(DART_PRECOMPILED_RUNTIME)
4180 return false;
4181#else
4182 return untag()->packed_fields_.Read<UntaggedFunction::PackedOptimizable>();
4183#endif
4184 }

◆ is_sticky_specialization()

bool dart::Function::is_sticky_specialization ( ) const

Definition at line 8544 of file object.cc.

8544 {
8545 ASSERT(kind() == UntaggedFunction::kIrregexpFunction);
8546 const Array& pair = Array::Cast(Object::Handle(data()));
8548}
static constexpr bool decode(intptr_t value)
Definition bitfield.h:173
intptr_t Value() const
Definition object.h:9969

◆ is_unboxed_double_parameter_at()

bool dart::Function::is_unboxed_double_parameter_at ( intptr_t  index) const
inline

Definition at line 3773 of file object.h.

3773 {
3774#if !defined(DART_PRECOMPILED_RUNTIME)
3775 ASSERT(index >= 0);
3776 index++; // position 0 is reserved for the return value
3777 return untag()->unboxed_parameters_info_.IsUnboxedDouble(index);
3778#else
3779 return false;
3780#endif // !defined(DART_PRECOMPILED_RUNTIME)
3781 }

◆ is_unboxed_integer_parameter_at()

bool dart::Function::is_unboxed_integer_parameter_at ( intptr_t  index) const
inline

Definition at line 3763 of file object.h.

3763 {
3764#if !defined(DART_PRECOMPILED_RUNTIME)
3765 ASSERT(index >= 0);
3766 index++; // position 0 is reserved for the return value
3767 return untag()->unboxed_parameters_info_.IsUnboxedInteger(index);
3768#else
3769 return false;
3770#endif // !defined(DART_PRECOMPILED_RUNTIME)
3771 }

◆ is_unboxed_parameter_at()

bool dart::Function::is_unboxed_parameter_at ( intptr_t  index) const
inline

Definition at line 3753 of file object.h.

3753 {
3754#if !defined(DART_PRECOMPILED_RUNTIME)
3755 ASSERT(index >= 0);
3756 index++; // position 0 is reserved for the return value
3757 return untag()->unboxed_parameters_info_.IsUnboxed(index);
3758#else
3759 return false;
3760#endif // !defined(DART_PRECOMPILED_RUNTIME)
3761 }

◆ is_visible()

static bool dart::Function::is_visible ( FunctionPtr  f)
inlinestatic

Definition at line 4163 of file object.h.

4163 {
4164 return f.untag()->kind_tag_.Read<VisibleBit>();
4165 }

◆ IsAsyncFunction()

bool dart::Function::IsAsyncFunction ( ) const
inline

Definition at line 3942 of file object.h.

3942 {
3944 }
UntaggedFunction::AsyncModifier modifier() const
Definition object.h:3334

◆ IsAsyncGenerator()

bool dart::Function::IsAsyncGenerator ( ) const
inline

Definition at line 3952 of file object.h.

3952 {
3954 }

◆ IsCachableIdempotent()

bool dart::Function::IsCachableIdempotent ( ) const

Definition at line 9113 of file object.cc.

9113 {
9114 if (!has_pragma()) return false;
9115
9116 const bool has_vm_pragma =
9117 Library::FindPragma(Thread::Current(), /*only_core=*/false, *this,
9118 Symbols::vm_cachable_idempotent());
9119 if (!has_vm_pragma) return false;
9120
9121 // For run_vm_tests and runtime/tests/vm allow marking arbitrary functions.
9122 return InVmTests(*this);
9123}

◆ IsClosureFunction()

bool dart::Function::IsClosureFunction ( ) const
inline

Definition at line 3871 of file object.h.

3871 {
3873 return (k == UntaggedFunction::kClosureFunction) ||
3874 (k == UntaggedFunction::kImplicitClosureFunction);
3875 }

◆ IsConstructor()

bool dart::Function::IsConstructor ( ) const
inline

Definition at line 3340 of file object.h.

3340 {
3341 return kind() == UntaggedFunction::kConstructor;
3342 }

◆ IsDispatcherOrImplicitAccessor()

bool dart::Function::IsDispatcherOrImplicitAccessor ( ) const
inline

Definition at line 3822 of file object.h.

3822 {
3823 switch (kind()) {
3824 case UntaggedFunction::kImplicitGetter:
3825 case UntaggedFunction::kImplicitSetter:
3826 case UntaggedFunction::kImplicitStaticGetter:
3827 case UntaggedFunction::kNoSuchMethodDispatcher:
3828 case UntaggedFunction::kInvokeFieldDispatcher:
3829 case UntaggedFunction::kDynamicInvocationForwarder:
3830 return true;
3831 default:
3832 return false;
3833 }
3834 }

◆ IsDynamicClosureCallDispatcher() [1/2]

bool dart::Function::IsDynamicClosureCallDispatcher ( ) const
inline

Definition at line 3288 of file object.h.

3288 {
3289 if (!IsDynamicInvokeFieldDispatcher()) return false;
3291 }
bool IsDynamicClosureCallDispatcher() const
Definition object.h:3288
bool IsDynamicInvokeFieldDispatcher() const
Definition object.h:3280

◆ IsDynamicClosureCallDispatcher() [2/2]

bool dart::Function::IsDynamicClosureCallDispatcher ( Thread thread) const

Definition at line 10434 of file object.cc.

10434 {
10435 if (!IsInvokeFieldDispatcher()) return false;
10436 if (thread->isolate_group()->object_store()->closure_class() != Owner()) {
10437 return false;
10438 }
10439 const auto& handle = String::Handle(thread->zone(), name());
10440 return handle.Equals(Symbols::DynamicCall());
10441}

◆ IsDynamicFunction()

bool dart::Function::IsDynamicFunction ( bool  allow_abstract = false) const
inline

Definition at line 3354 of file object.h.

3354 {
3355 if (is_static() || (!allow_abstract && is_abstract())) {
3356 return false;
3357 }
3358 switch (kind()) {
3359 case UntaggedFunction::kRegularFunction:
3360 case UntaggedFunction::kGetterFunction:
3361 case UntaggedFunction::kSetterFunction:
3362 case UntaggedFunction::kImplicitGetter:
3363 case UntaggedFunction::kImplicitSetter:
3364 case UntaggedFunction::kMethodExtractor:
3365 case UntaggedFunction::kNoSuchMethodDispatcher:
3366 case UntaggedFunction::kInvokeFieldDispatcher:
3367 case UntaggedFunction::kDynamicInvocationForwarder:
3368 case UntaggedFunction::kRecordFieldGetter:
3369 return true;
3370 case UntaggedFunction::kClosureFunction:
3371 case UntaggedFunction::kImplicitClosureFunction:
3372 case UntaggedFunction::kConstructor:
3373 case UntaggedFunction::kImplicitStaticGetter:
3374 case UntaggedFunction::kFieldInitializer:
3375 case UntaggedFunction::kIrregexpFunction:
3376 return false;
3377 default:
3378 UNREACHABLE();
3379 return false;
3380 }
3381 }

◆ IsDynamicInvocationForwarder()

bool dart::Function::IsDynamicInvocationForwarder ( ) const
inline

Definition at line 3294 of file object.h.

3294 {
3295 return kind() == UntaggedFunction::kDynamicInvocationForwarder;
3296 }

◆ IsDynamicInvocationForwarderName() [1/2]

bool dart::Function::IsDynamicInvocationForwarderName ( const String name)
static

Definition at line 4240 of file object.cc.

4240 {
4242}

◆ IsDynamicInvocationForwarderName() [2/2]

bool dart::Function::IsDynamicInvocationForwarderName ( StringPtr  name)
static

Definition at line 4244 of file object.cc.

4244 {
4245 return String::StartsWith(name, Symbols::DynamicPrefix().ptr());
4246}
bool StartsWith(const String &other) const
Definition object.h:10277

◆ IsDynamicInvokeFieldDispatcher()

bool dart::Function::IsDynamicInvokeFieldDispatcher ( ) const
inline

Definition at line 3280 of file object.h.

3280 {
3281 return IsInvokeFieldDispatcher() &&
3283 }

◆ IsFactory()

bool dart::Function::IsFactory ( ) const
inline

Definition at line 3347 of file object.h.

3347{ return IsConstructor() && is_static(); }

◆ IsFfiCallbackTrampoline() [1/2]

bool dart::Function::IsFfiCallbackTrampoline ( ) const
inline

Definition at line 3918 of file object.h.

3918 {
3919 return kind() == UntaggedFunction::kFfiTrampoline;
3920 }

◆ IsFfiCallbackTrampoline() [2/2]

static bool dart::Function::IsFfiCallbackTrampoline ( FunctionPtr  function)
inlinestatic

Definition at line 3921 of file object.h.

3921 {
3922 NoSafepointScope no_safepoint;
3923 return function->untag()->kind_tag_.Read<KindBits>() ==
3924 UntaggedFunction::kFfiTrampoline;
3925 }

◆ IsFfiCallClosure()

bool dart::Function::IsFfiCallClosure ( ) const

Definition at line 9125 of file object.cc.

9125 {
9126 if (!IsNonImplicitClosureFunction()) return false;
9127 if (!has_pragma()) return false;
9128 return Library::FindPragma(Thread::Current(), /*only_core=*/false, *this,
9129 Symbols::vm_ffi_call_closure());
9130}

◆ IsFieldInitializer()

bool dart::Function::IsFieldInitializer ( ) const
inline

Definition at line 3865 of file object.h.

3865 {
3866 return kind() == UntaggedFunction::kFieldInitializer;
3867 }

◆ IsGenerativeConstructor()

bool dart::Function::IsGenerativeConstructor ( ) const
inline

Definition at line 3343 of file object.h.

3343 {
3344 return IsConstructor() && !is_static();
3345 }

◆ IsGeneric()

bool dart::Function::IsGeneric ( ) const

Definition at line 8902 of file object.cc.

8902 {
8903 return FunctionType::IsGeneric(signature());
8904}
bool IsGeneric() const
Definition object.h:9727

◆ IsGetterFunction()

bool dart::Function::IsGetterFunction ( ) const
inline

Definition at line 3837 of file object.h.

3837 {
3838 return kind() == UntaggedFunction::kGetterFunction;
3839 }

◆ IsIdempotent()

bool dart::Function::IsIdempotent ( ) const

Definition at line 9100 of file object.cc.

9100 {
9101 if (!has_pragma()) return false;
9102
9103#if defined(TESTING)
9104 const bool kAllowOnlyForCoreLibFunctions = false;
9105#else
9106 const bool kAllowOnlyForCoreLibFunctions = true;
9107#endif // defined(TESTING)
9108
9109 return Library::FindPragma(Thread::Current(), kAllowOnlyForCoreLibFunctions,
9110 *this, Symbols::vm_idempotent());
9111}

◆ IsImplicitClosureFunction() [1/2]

bool dart::Function::IsImplicitClosureFunction ( ) const
inline

Definition at line 3883 of file object.h.

3883 {
3884 return kind() == UntaggedFunction::kImplicitClosureFunction;
3885 }

◆ IsImplicitClosureFunction() [2/2]

static bool dart::Function::IsImplicitClosureFunction ( FunctionPtr  func)
inlinestatic

Definition at line 3886 of file object.h.

3886 {
3887 return KindOf(func) == UntaggedFunction::kImplicitClosureFunction;
3888 }
static UntaggedFunction::Kind KindOf(FunctionPtr func)
Definition object.h:3330

◆ IsImplicitConstructor()

bool dart::Function::IsImplicitConstructor ( ) const

Definition at line 10276 of file object.cc.

10276 {
10277 return IsGenerativeConstructor() && (token_pos() == end_token_pos());
10278}

◆ IsImplicitGetterFunction()

bool dart::Function::IsImplicitGetterFunction ( ) const
inline

Definition at line 3842 of file object.h.

3842 {
3843 return kind() == UntaggedFunction::kImplicitGetter;
3844 }

◆ IsImplicitGetterOrSetter()

bool dart::Function::IsImplicitGetterOrSetter ( ) const
inline

Definition at line 3298 of file object.h.

3298 {
3299 return kind() == UntaggedFunction::kImplicitGetter ||
3300 kind() == UntaggedFunction::kImplicitSetter ||
3301 kind() == UntaggedFunction::kImplicitStaticGetter;
3302 }

◆ IsImplicitInstanceClosureFunction() [1/2]

bool dart::Function::IsImplicitInstanceClosureFunction ( ) const
inline

Definition at line 3904 of file object.h.

3904 {
3905 return IsImplicitClosureFunction() && !is_static();
3906 }

◆ IsImplicitInstanceClosureFunction() [2/2]

bool dart::Function::IsImplicitInstanceClosureFunction ( FunctionPtr  func)
static

Definition at line 10288 of file object.cc.

10288 {
10289 NoSafepointScope no_safepoint;
10290 uint32_t kind_tag = func->untag()->kind_tag_.load(std::memory_order_relaxed);
10291 return (KindBits::decode(kind_tag) ==
10292 UntaggedFunction::kImplicitClosureFunction) &&
10293 !StaticBit::decode(kind_tag);
10294}

◆ IsImplicitSetterFunction()

bool dart::Function::IsImplicitSetterFunction ( ) const
inline

Definition at line 3858 of file object.h.

3858 {
3859 return kind() == UntaggedFunction::kImplicitSetter;
3860 }

◆ IsImplicitStaticClosureFunction() [1/2]

bool dart::Function::IsImplicitStaticClosureFunction ( ) const
inline

Definition at line 3897 of file object.h.

3897 {
3898 return IsImplicitClosureFunction() && is_static();
3899 }

◆ IsImplicitStaticClosureFunction() [2/2]

bool dart::Function::IsImplicitStaticClosureFunction ( FunctionPtr  func)
static

Definition at line 10280 of file object.cc.

10280 {
10281 NoSafepointScope no_safepoint;
10282 uint32_t kind_tag = func->untag()->kind_tag_.load(std::memory_order_relaxed);
10283 return (KindBits::decode(kind_tag) ==
10284 UntaggedFunction::kImplicitClosureFunction) &&
10285 StaticBit::decode(kind_tag);
10286}

◆ IsImplicitStaticGetterFunction()

bool dart::Function::IsImplicitStaticGetterFunction ( ) const
inline

Definition at line 3848 of file object.h.

3848 {
3849 return kind() == UntaggedFunction::kImplicitStaticGetter;
3850 }

◆ IsInvokeFieldDispatcher()

bool dart::Function::IsInvokeFieldDispatcher ( ) const
inline

Definition at line 3276 of file object.h.

3276 {
3277 return kind() == UntaggedFunction::kInvokeFieldDispatcher;
3278 }

◆ IsIrregexpFunction()

bool dart::Function::IsIrregexpFunction ( ) const
inline

Definition at line 3878 of file object.h.

3878 {
3879 return kind() == UntaggedFunction::kIrregexpFunction;
3880 }

◆ IsLocalFunction()

bool dart::Function::IsLocalFunction ( ) const
inline

Definition at line 3913 of file object.h.

3913 {
3914 return !IsImplicitClosureFunction() && HasParent();
3915 }
bool HasParent() const
Definition object.h:3910

◆ IsMethodExtractor()

bool dart::Function::IsMethodExtractor ( ) const
inline

Definition at line 3264 of file object.h.

3264 {
3265 return kind() == UntaggedFunction::kMethodExtractor;
3266 }

◆ IsNonImplicitClosureFunction()

bool dart::Function::IsNonImplicitClosureFunction ( ) const
inline

Definition at line 3891 of file object.h.

3891 {
3893 }

◆ IsNoSuchMethodDispatcher()

bool dart::Function::IsNoSuchMethodDispatcher ( ) const
inline

Definition at line 3268 of file object.h.

3268 {
3269 return kind() == UntaggedFunction::kNoSuchMethodDispatcher;
3270 }

◆ IsOptimizable()

bool dart::Function::IsOptimizable ( ) const

Definition at line 8988 of file object.cc.

8988 {
8989 if (FLAG_precompiled_mode) {
8990 return true;
8991 }
8992 if (ForceOptimize()) return true;
8993 if (is_old_native()) {
8994 // Native methods don't need to be optimized.
8995 return false;
8996 }
8997 if (is_optimizable() && (script() != Script::null())) {
8998 // Additional check needed for implicit getters.
8999 return (unoptimized_code() == Object::null()) ||
9000 (Code::Handle(unoptimized_code()).Size() <
9001 FLAG_huge_method_cutoff_in_code_size);
9002 }
9003 return false;
9004}
bool is_old_native() const
Definition object.cc:8596
bool is_optimizable() const
Definition object.h:4178

◆ IsPreferInline()

bool dart::Function::IsPreferInline ( ) const

Definition at line 9093 of file object.cc.

9093 {
9094 if (!has_pragma()) return false;
9095
9096 return Library::FindPragma(Thread::Current(), /*only_core=*/false, *this,
9097 Symbols::vm_prefer_inline());
9098}

◆ IsPrivate()

bool dart::Function::IsPrivate ( ) const

Definition at line 10895 of file object.cc.

10895 {
10897}
static bool IsPrivate(const String &name)
Definition object.cc:14666

◆ IsRecognized()

bool dart::Function::IsRecognized ( ) const
inline

Definition at line 3604 of file object.h.

3604 {
3606 }
MethodRecognizer::Kind recognized_kind() const
Definition object.h:3599

◆ IsRecordFieldGetter()

bool dart::Function::IsRecordFieldGetter ( ) const
inline

Definition at line 3272 of file object.h.

3272 {
3273 return kind() == UntaggedFunction::kRecordFieldGetter;
3274 }

◆ IsRegularFunction()

bool dart::Function::IsRegularFunction ( ) const
inline

Definition at line 3260 of file object.h.

3260 {
3261 return kind() == UntaggedFunction::kRegularFunction;
3262 }

◆ IsRequiredAt()

bool dart::Function::IsRequiredAt ( intptr_t  index) const

Definition at line 8799 of file object.cc.

8799 {
8800#if defined(DART_PRECOMPILED_RUNTIME)
8801 if (signature() == FunctionType::null()) {
8802 // Signature is not dropped in aot when any named parameter is required.
8803 return false;
8804 }
8805#endif
8807 return false;
8808 }
8809 const FunctionType& sig = FunctionType::Handle(signature());
8810 return sig.IsRequiredAt(index);
8811}
bool HasOptionalNamedParameters() const
Definition object.cc:8920

◆ IsSetterFunction()

bool dart::Function::IsSetterFunction ( ) const
inline

Definition at line 3853 of file object.h.

3853 {
3854 return kind() == UntaggedFunction::kSetterFunction;
3855 }

◆ IsStaticFunction()

bool dart::Function::IsStaticFunction ( ) const
inline

Definition at line 3382 of file object.h.

3382 {
3383 if (!is_static()) {
3384 return false;
3385 }
3386 switch (kind()) {
3387 case UntaggedFunction::kRegularFunction:
3388 case UntaggedFunction::kGetterFunction:
3389 case UntaggedFunction::kSetterFunction:
3390 case UntaggedFunction::kImplicitGetter:
3391 case UntaggedFunction::kImplicitSetter:
3392 case UntaggedFunction::kImplicitStaticGetter:
3393 case UntaggedFunction::kFieldInitializer:
3394 case UntaggedFunction::kIrregexpFunction:
3395 return true;
3396 case UntaggedFunction::kClosureFunction:
3397 case UntaggedFunction::kImplicitClosureFunction:
3398 case UntaggedFunction::kConstructor:
3399 case UntaggedFunction::kMethodExtractor:
3400 case UntaggedFunction::kNoSuchMethodDispatcher:
3401 case UntaggedFunction::kInvokeFieldDispatcher:
3402 case UntaggedFunction::kDynamicInvocationForwarder:
3403 case UntaggedFunction::kFfiTrampoline:
3404 case UntaggedFunction::kRecordFieldGetter:
3405 return false;
3406 default:
3407 UNREACHABLE();
3408 return false;
3409 }
3410 }

◆ IsSuspendableFunction()

bool dart::Function::IsSuspendableFunction ( ) const
inline

Definition at line 3937 of file object.h.

3937 {
3939 }

◆ IsSyncGenerator()

bool dart::Function::IsSyncGenerator ( ) const
inline

Definition at line 3947 of file object.h.

3947 {
3949 }

◆ IsTypedDataViewFactory()

bool dart::Function::IsTypedDataViewFactory ( ) const

Definition at line 9015 of file object.cc.

9015 {
9016 switch (recognized_kind()) {
9017 case MethodRecognizer::kTypedData_ByteDataView_factory:
9018 case MethodRecognizer::kTypedData_Int8ArrayView_factory:
9019 case MethodRecognizer::kTypedData_Uint8ArrayView_factory:
9020 case MethodRecognizer::kTypedData_Uint8ClampedArrayView_factory:
9021 case MethodRecognizer::kTypedData_Int16ArrayView_factory:
9022 case MethodRecognizer::kTypedData_Uint16ArrayView_factory:
9023 case MethodRecognizer::kTypedData_Int32ArrayView_factory:
9024 case MethodRecognizer::kTypedData_Uint32ArrayView_factory:
9025 case MethodRecognizer::kTypedData_Int64ArrayView_factory:
9026 case MethodRecognizer::kTypedData_Uint64ArrayView_factory:
9027 case MethodRecognizer::kTypedData_Float32ArrayView_factory:
9028 case MethodRecognizer::kTypedData_Float64ArrayView_factory:
9029 case MethodRecognizer::kTypedData_Float32x4ArrayView_factory:
9030 case MethodRecognizer::kTypedData_Int32x4ArrayView_factory:
9031 case MethodRecognizer::kTypedData_Float64x2ArrayView_factory:
9032 return true;
9033 default:
9034 return false;
9035 }
9036}

◆ IsUnmodifiableTypedDataViewFactory()

bool dart::Function::IsUnmodifiableTypedDataViewFactory ( ) const

Definition at line 9038 of file object.cc.

9038 {
9039 switch (recognized_kind()) {
9040 case MethodRecognizer::kTypedData_UnmodifiableByteDataView_factory:
9041 case MethodRecognizer::kTypedData_UnmodifiableInt8ArrayView_factory:
9042 case MethodRecognizer::kTypedData_UnmodifiableUint8ArrayView_factory:
9043 case MethodRecognizer::kTypedData_UnmodifiableUint8ClampedArrayView_factory:
9044 case MethodRecognizer::kTypedData_UnmodifiableInt16ArrayView_factory:
9045 case MethodRecognizer::kTypedData_UnmodifiableUint16ArrayView_factory:
9046 case MethodRecognizer::kTypedData_UnmodifiableInt32ArrayView_factory:
9047 case MethodRecognizer::kTypedData_UnmodifiableUint32ArrayView_factory:
9048 case MethodRecognizer::kTypedData_UnmodifiableInt64ArrayView_factory:
9049 case MethodRecognizer::kTypedData_UnmodifiableUint64ArrayView_factory:
9050 case MethodRecognizer::kTypedData_UnmodifiableFloat32ArrayView_factory:
9051 case MethodRecognizer::kTypedData_UnmodifiableFloat64ArrayView_factory:
9052 case MethodRecognizer::kTypedData_UnmodifiableFloat32x4ArrayView_factory:
9053 case MethodRecognizer::kTypedData_UnmodifiableInt32x4ArrayView_factory:
9054 case MethodRecognizer::kTypedData_UnmodifiableFloat64x2ArrayView_factory:
9055 return true;
9056 default:
9057 return false;
9058 }
9059}

◆ kernel_offset()

intptr_t dart::Function::kernel_offset ( ) const
inline

Definition at line 3530 of file object.h.

3530 {
3531#if defined(DART_PRECOMPILED_RUNTIME)
3532 return 0;
3533#else
3534 return untag()->kernel_offset_;
3535#endif
3536 }

◆ KernelLibrary()

TypedDataViewPtr dart::Function::KernelLibrary ( ) const

Definition at line 10994 of file object.cc.

10994 {
10996 return info.KernelLibrary(KernelLibraryIndex());
10997}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
intptr_t KernelLibraryIndex() const
Definition object.cc:11006
KernelProgramInfoPtr KernelProgramInfo() const
Definition object.cc:10977

◆ KernelLibraryIndex()

intptr_t dart::Function::KernelLibraryIndex ( ) const

Definition at line 11006 of file object.cc.

11006 {
11009 return -1;
11010 }
11011 if (is_eval_function()) {
11012 const auto& fdata = Array::Handle(Array::RawCast(data()));
11013 return Smi::Value(static_cast<SmiPtr>(fdata.At(
11014 static_cast<intptr_t>(EvalFunctionData::kKernelLibraryIndex))));
11015 }
11016 if (IsClosureFunction()) {
11017 const auto& parent = Function::Handle(parent_function());
11018 ASSERT(!parent.IsNull());
11019 return parent.KernelLibraryIndex();
11020 }
11021
11022 const auto& obj = Object::Handle(untag()->owner());
11023 if (obj.IsClass()) {
11024 const auto& lib = Library::Handle(Class::Cast(obj).library());
11025 return lib.kernel_library_index();
11026 }
11027 ASSERT(obj.IsPatchClass());
11028 return PatchClass::Cast(obj).kernel_library_index();
11029}

◆ KernelLibraryOffset()

intptr_t dart::Function::KernelLibraryOffset ( ) const

Definition at line 10999 of file object.cc.

10999 {
11000 const intptr_t kernel_library_index = KernelLibraryIndex();
11001 if (kernel_library_index == -1) return 0;
11003 return info.KernelLibraryStartOffset(kernel_library_index);
11004}

◆ KernelProgramInfo()

KernelProgramInfoPtr dart::Function::KernelProgramInfo ( ) const

Definition at line 10977 of file object.cc.

10977 {
10978 if (is_eval_function()) {
10979 const auto& fdata = Array::Handle(Array::RawCast(data()));
10981 fdata.At(static_cast<intptr_t>(EvalFunctionData::kKernelProgramInfo)));
10982 }
10983 if (IsClosureFunction()) {
10984 const auto& parent = Function::Handle(parent_function());
10985 return parent.KernelProgramInfo();
10986 }
10987 const auto& owner = Object::Handle(RawOwner());
10988 if (owner.IsClass()) {
10989 return Class::Cast(owner).KernelProgramInfo();
10990 }
10991 return PatchClass::Cast(owner).kernel_program_info();
10992}
ObjectPtr RawOwner() const
Definition object.h:3063

◆ kind()

UntaggedFunction::Kind dart::Function::kind ( ) const
inline

Definition at line 3329 of file object.h.

3329{ return KindOf(ptr()); }

◆ kind_tag_offset()

static intptr_t dart::Function::kind_tag_offset ( )
inlinestatic

Definition at line 4106 of file object.h.

4106 {
4107 return OFFSET_OF(UntaggedFunction, kind_tag_);
4108 }

◆ KindOf()

static UntaggedFunction::Kind dart::Function::KindOf ( FunctionPtr  func)
inlinestatic

Definition at line 3330 of file object.h.

3330 {
3331 return func->untag()->kind_tag_.Read<KindBits>();
3332 }

◆ KindToCString()

const char * dart::Function::KindToCString ( UntaggedFunction::Kind  kind)
static

Definition at line 8477 of file object.cc.

8477 {
8479}
static const char * KindToCString(Kind k)

◆ MakesCopyOfParameters()

bool dart::Function::MakesCopyOfParameters ( ) const
inline

Definition at line 3494 of file object.h.

3494 {
3496 }
bool HasOptionalParameters() const
Definition object.cc:8917
bool IsSuspendableFunction() const
Definition object.h:3937

◆ maximum_unboxed_parameter_count()

static constexpr intptr_t dart::Function::maximum_unboxed_parameter_count ( )
inlinestaticconstexpr

Definition at line 3684 of file object.h.

3684 {
3685 // Subtracts one that represents the return value
3687 }

◆ MaxNumberOfParametersInRegisters()

intptr_t dart::Function::MaxNumberOfParametersInRegisters ( Zone zone) const

Definition at line 27324 of file object.cc.

27324 {
27325#if defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_ARM64) || \
27326 defined(TARGET_ARCH_ARM)
27327 if (!FLAG_precompiled_mode) {
27328 return 0;
27329 }
27330
27331 if (!FLAG_use_register_cc) {
27332 return 0;
27333 }
27334
27335 if (IsGeneric()) {
27336 return 0;
27337 }
27338
27339 switch (kind()) {
27340 case UntaggedFunction::kClosureFunction:
27341 case UntaggedFunction::kImplicitClosureFunction:
27342 case UntaggedFunction::kNoSuchMethodDispatcher:
27343 case UntaggedFunction::kInvokeFieldDispatcher:
27344 case UntaggedFunction::kDynamicInvocationForwarder:
27345 case UntaggedFunction::kMethodExtractor:
27346 case UntaggedFunction::kFfiTrampoline:
27347 case UntaggedFunction::kFieldInitializer:
27348 case UntaggedFunction::kIrregexpFunction:
27349 return 0;
27350
27351 default:
27352 break;
27353 }
27354
27355 const auto unboxing_metadata = kernel::UnboxingInfoMetadataOf(*this, zone);
27356 if (unboxing_metadata != nullptr &&
27357 unboxing_metadata->must_use_stack_calling_convention) {
27358 return 0;
27359 }
27360
27361 // Getters and setters have fixed signatures.
27362 switch (kind()) {
27363 case UntaggedFunction::kGetterFunction:
27364 case UntaggedFunction::kImplicitGetter:
27365 case UntaggedFunction::kSetterFunction:
27366 case UntaggedFunction::kImplicitSetter:
27367 return num_fixed_parameters();
27368
27369 default:
27370 break;
27371 }
27372
27373 if (unboxing_metadata != nullptr &&
27374 unboxing_metadata->has_overrides_with_less_direct_parameters) {
27375 // Receiver (`this`) can always be passed in the register because it is
27376 // never an optional or named parameter.
27377 return unboxing_metadata->unboxed_args_info.length() + 1;
27378 }
27379
27380 return num_fixed_parameters();
27381#endif
27382 return 0;
27383}
bool IsGeneric() const
Definition object.cc:8902

◆ MayHaveUncheckedEntryPoint()

bool dart::Function::MayHaveUncheckedEntryPoint ( ) const

Definition at line 11499 of file object.cc.

11499 {
11500 return FLAG_enable_multiple_entrypoints &&
11502}
bool NeedsTypeArgumentTypeChecks() const
Definition object.h:3412
bool NeedsArgumentTypeChecks() const
Definition object.h:3416

◆ modifier()

UntaggedFunction::AsyncModifier dart::Function::modifier ( ) const
inline

Definition at line 3334 of file object.h.

3334 {
3335 return untag()->kind_tag_.Read<ModifierBits>();
3336 }

◆ name()

StringPtr dart::Function::name ( ) const
inline

Definition at line 2972 of file object.h.

2972{ return untag()->name(); }

◆ NameCString()

const char * dart::Function::NameCString ( NameVisibility  name_visibility) const

Definition at line 11036 of file object.cc.

11036 {
11037 switch (name_visibility) {
11038 case kInternalName:
11039 return String::Handle(name()).ToCString();
11040 case kScrubbedName:
11041 case kUserVisibleName:
11042 return UserVisibleNameCString();
11043 }
11044 UNREACHABLE();
11045 return nullptr;
11046}
const char * UserVisibleNameCString() const
Definition object.cc:11048
@ kUserVisibleName
Definition object.h:645
@ kScrubbedName
Definition object.h:633
virtual const char * ToCString() const
Definition object.h:366

◆ native_name()

StringPtr dart::Function::native_name ( ) const

Definition at line 8564 of file object.cc.

8564 {
8565 ASSERT(is_native());
8566 const Object& obj = Object::Handle(data());
8567 ASSERT(obj.IsArray());
8568 return String::RawCast(Array::Cast(obj).At(0));
8569}

◆ NeedsArgumentTypeChecks()

bool dart::Function::NeedsArgumentTypeChecks ( ) const
inline

Definition at line 3416 of file object.h.

3416 {
3417 return !(is_static() || (kind() == UntaggedFunction::kConstructor));
3418 }

◆ NeedsMonomorphicCheckedEntry()

bool dart::Function::NeedsMonomorphicCheckedEntry ( Zone zone) const

Definition at line 11422 of file object.cc.

11422 {
11423#if !defined(DART_PRECOMPILED_RUNTIME)
11424 if (!IsDynamicFunction()) {
11425 return false;
11426 }
11427
11428 // For functions which need an args descriptor the switchable call sites will
11429 // transition directly to calling via a stub (and therefore never call the
11430 // monomorphic entry).
11431 //
11432 // See runtime_entry.cc:DEFINE_RUNTIME_ENTRY(UnlinkedCall)
11434 return false;
11435 }
11436
11437 // All dyn:* forwarders are called via SwitchableCalls and all except the ones
11438 // with `PrologueNeedsArgumentsDescriptor()` transition into monomorphic
11439 // state.
11441 return true;
11442 }
11443
11444 // AOT mode uses table dispatch.
11445 // In JIT mode all instance calls use switchable calls.
11446 if (!FLAG_precompiled_mode) {
11447 return true;
11448 }
11449
11450 // Only if there are dynamic callers and if we didn't create a dyn:* forwarder
11451 // for it do we need the monomorphic checked entry.
11452 return HasDynamicCallers(zone) &&
11453 !kernel::NeedsDynamicInvocationForwarder(*this);
11454#else
11455 UNREACHABLE();
11456 return true;
11457#endif
11458}
bool PrologueNeedsArgumentsDescriptor() const
Definition object.cc:11488
bool HasDynamicCallers(Zone *zone) const
Definition object.cc:11460

◆ NeedsTypeArgumentTypeChecks()

bool dart::Function::NeedsTypeArgumentTypeChecks ( ) const
inline

Definition at line 3412 of file object.h.

3412 {
3413 return !(is_static() || (kind() == UntaggedFunction::kConstructor));
3414 }

◆ New()

FunctionPtr dart::Function::New ( const FunctionType signature,
const String name,
UntaggedFunction::Kind  kind,
bool  is_static,
bool  is_const,
bool  is_abstract,
bool  is_external,
bool  is_native,
const Object owner,
TokenPosition  token_pos,
Heap::Space  space = Heap::kOld 
)
static

Definition at line 10301 of file object.cc.

10311 {
10312 ASSERT(!owner.IsNull());
10313 ASSERT(!signature.IsNull());
10314 const Function& result = Function::Handle(Function::New(space));
10315 result.set_kind_tag(0);
10316 result.set_packed_fields(0);
10317 result.set_name(name);
10318 result.set_kind_tag(0); // Ensure determinism of uninitialized bits.
10319 result.set_kind(kind);
10320 result.set_recognized_kind(MethodRecognizer::kUnknown);
10322 result.set_is_static(is_static);
10323 result.set_is_const(is_const);
10324 result.set_is_abstract(is_abstract);
10325 result.set_is_external(is_external);
10326 result.set_is_native(is_native);
10327 result.set_is_reflectable(true); // Will be computed later.
10328 result.set_is_visible(true); // Will be computed later.
10329 result.set_is_debuggable(true); // Will be computed later.
10330 result.set_is_intrinsic(false);
10331 result.set_has_pragma(false);
10332 result.set_is_polymorphic_target(false);
10333 result.set_is_synthetic(false);
10334 NOT_IN_PRECOMPILED(result.set_state_bits(0));
10335 result.set_owner(owner);
10336 NOT_IN_PRECOMPILED(result.set_token_pos(token_pos));
10337 NOT_IN_PRECOMPILED(result.set_end_token_pos(token_pos));
10338 NOT_IN_PRECOMPILED(result.set_usage_counter(0));
10339 NOT_IN_PRECOMPILED(result.set_deoptimization_counter(0));
10340 NOT_IN_PRECOMPILED(result.set_optimized_instruction_count(0));
10341 NOT_IN_PRECOMPILED(result.set_optimized_call_site_count(0));
10342 NOT_IN_PRECOMPILED(result.set_inlining_depth(0));
10343 NOT_IN_PRECOMPILED(result.set_kernel_offset(0));
10344 result.set_is_optimizable(is_native ? false : true);
10345 result.set_is_inlinable(true);
10346 result.reset_unboxed_parameters_and_return();
10347 result.SetInstructionsSafe(StubCode::LazyCompile());
10348
10349 // See Function::set_data() for more information.
10350 if (kind == UntaggedFunction::kClosureFunction ||
10351 kind == UntaggedFunction::kImplicitClosureFunction) {
10352 ASSERT(space == Heap::kOld);
10353 const ClosureData& data = ClosureData::Handle(ClosureData::New());
10354 data.set_awaiter_link({});
10355 result.set_data(data);
10356 } else if (kind == UntaggedFunction::kFfiTrampoline) {
10357 const FfiTrampolineData& data =
10358 FfiTrampolineData::Handle(FfiTrampolineData::New());
10359 result.set_data(data);
10360 } else if (result.is_old_native()) {
10361 const auto& data =
10362 Array::Handle(Array::New(NativeFunctionData::kLength, Heap::kOld));
10363 result.set_data(data);
10364 } else {
10365 // Functions other than signature functions have no reason to be allocated
10366 // in new space.
10367 ASSERT(space == Heap::kOld);
10368 }
10369
10370 // Force-optimized functions are not debuggable because they cannot
10371 // deoptimize.
10372 if (result.ForceOptimize()) {
10373 result.set_is_debuggable(false);
10374 }
10375 signature.set_num_implicit_parameters(result.NumImplicitParameters());
10376 result.SetSignature(signature);
10378 result.set_positional_parameter_names(Object::empty_array()));
10379 return result.ptr();
10380}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
#define NOT_IN_PRECOMPILED(code)
Definition globals.h:100

◆ NewClosureFunction()

FunctionPtr dart::Function::NewClosureFunction ( const String name,
const Function parent,
TokenPosition  token_pos 
)
static

Definition at line 10406 of file object.cc.

10408 {
10409 // Use the owner defining the parent function and not the class containing it.
10410 const Object& parent_owner = Object::Handle(parent.RawOwner());
10411 return NewClosureFunctionWithKind(UntaggedFunction::kClosureFunction, name,
10412 parent, parent.is_static(), token_pos,
10413 parent_owner);
10414}
static FunctionPtr NewClosureFunctionWithKind(UntaggedFunction::Kind kind, const String &name, const Function &parent, bool is_static, TokenPosition token_pos, const Object &owner)
Definition object.cc:10382

◆ NewClosureFunctionWithKind()

FunctionPtr dart::Function::NewClosureFunctionWithKind ( UntaggedFunction::Kind  kind,
const String name,
const Function parent,
bool  is_static,
TokenPosition  token_pos,
const Object owner 
)
static

Definition at line 10382 of file object.cc.

10387 {
10388 ASSERT((kind == UntaggedFunction::kClosureFunction) ||
10389 (kind == UntaggedFunction::kImplicitClosureFunction));
10390 ASSERT(!parent.IsNull());
10391 ASSERT(!owner.IsNull());
10392 const FunctionType& signature = FunctionType::Handle(FunctionType::New(
10393 kind == UntaggedFunction::kClosureFunction ? parent.NumTypeArguments()
10394 : 0));
10395 const Function& result = Function::Handle(
10396 Function::New(signature, name, kind,
10397 /* is_static = */ is_static,
10398 /* is_const = */ false,
10399 /* is_abstract = */ false,
10400 /* is_external = */ false,
10401 /* is_native = */ false, owner, token_pos));
10402 result.set_parent_function(parent);
10403 return result.ptr();
10404}

◆ NewImplicitClosureFunction()

FunctionPtr dart::Function::NewImplicitClosureFunction ( const String name,
const Function parent,
TokenPosition  token_pos 
)
static

Definition at line 10416 of file object.cc.

10418 {
10419 // Use the owner defining the parent function and not the class containing it.
10420 const Object& parent_owner = Object::Handle(parent.RawOwner());
10422 UntaggedFunction::kImplicitClosureFunction, name, parent,
10423 parent.is_static() || parent.IsConstructor(), token_pos, parent_owner);
10424}

◆ num_fixed_parameters()

intptr_t dart::Function::num_fixed_parameters ( ) const

Definition at line 8914 of file object.cc.

8914 {
8915 return FunctionType::NumFixedParametersOf(signature());
8916}
static intptr_t NumFixedParametersOf(FunctionTypePtr ptr)
Definition object.h:9571

◆ NumImplicitParameters()

intptr_t dart::Function::NumImplicitParameters ( ) const

Definition at line 9286 of file object.cc.

9286 {
9287 const UntaggedFunction::Kind k = kind();
9288 if (k == UntaggedFunction::kConstructor) {
9289 // Type arguments for factory; instance for generative constructor.
9290 return 1;
9291 }
9292 if ((k == UntaggedFunction::kClosureFunction) ||
9293 (k == UntaggedFunction::kImplicitClosureFunction) ||
9294 (k == UntaggedFunction::kFfiTrampoline)) {
9295 return 1; // Closure object.
9296 }
9297 if (!is_static()) {
9298 // Closure functions defined inside instance (i.e. non-static) functions are
9299 // marked as non-static, but they do not have a receiver.
9300 // Closures are handled above.
9301 ASSERT((k != UntaggedFunction::kClosureFunction) &&
9302 (k != UntaggedFunction::kImplicitClosureFunction));
9303 return 1; // Receiver.
9304 }
9305 return 0; // No implicit parameters.
9306}

◆ NumOptionalNamedParameters()

intptr_t dart::Function::NumOptionalNamedParameters ( ) const

Definition at line 8932 of file object.cc.

8932 {
8934}
static intptr_t NumOptionalNamedParametersOf(FunctionTypePtr ptr)
Definition object.h:9618

◆ NumOptionalParameters()

intptr_t dart::Function::NumOptionalParameters ( ) const

Definition at line 8926 of file object.cc.

8926 {
8927 return FunctionType::NumOptionalParametersOf(signature());
8928}
static intptr_t NumOptionalParametersOf(FunctionTypePtr ptr)
Definition object.h:9601

◆ NumOptionalPositionalParameters()

intptr_t dart::Function::NumOptionalPositionalParameters ( ) const

Definition at line 8929 of file object.cc.

8929 {
8931}
static intptr_t NumOptionalPositionalParametersOf(FunctionTypePtr ptr)
Definition object.h:9611

◆ NumParameters()

intptr_t dart::Function::NumParameters ( ) const

Definition at line 8935 of file object.cc.

8935 {
8936 return FunctionType::NumParametersOf(signature());
8937}
static intptr_t NumParametersOf(FunctionTypePtr ptr)
Definition object.h:9625

◆ NumParentTypeArguments()

intptr_t dart::Function::NumParentTypeArguments ( ) const

Definition at line 8908 of file object.cc.

8908 {
8909 return FunctionType::NumParentTypeArgumentsOf(signature());
8910}
static intptr_t NumParentTypeArgumentsOf(FunctionTypePtr ptr)
Definition object.h:9545

◆ NumTypeArguments()

intptr_t dart::Function::NumTypeArguments ( ) const

Definition at line 8911 of file object.cc.

8911 {
8912 return FunctionType::NumTypeArgumentsOf(signature());
8913}
static intptr_t NumTypeArgumentsOf(FunctionTypePtr ptr)
Definition object.h:9560

◆ NumTypeParameters()

intptr_t dart::Function::NumTypeParameters ( ) const

Definition at line 8905 of file object.cc.

8905 {
8906 return FunctionType::NumTypeParametersOf(signature());
8907}
static intptr_t NumTypeParametersOf(FunctionTypePtr ptr)
Definition object.h:9554

◆ Owner()

ClassPtr dart::Function::Owner ( ) const

Definition at line 10899 of file object.cc.

10899 {
10900 ASSERT(untag()->owner() != Object::null());
10901 if (untag()->owner()->IsClass()) {
10902 return Class::RawCast(untag()->owner());
10903 }
10904 const Object& obj = Object::Handle(untag()->owner());
10905 ASSERT(obj.IsPatchClass());
10906 return PatchClass::Cast(obj).wrapped_class();
10907}

◆ packed_fields()

uint32_t dart::Function::packed_fields ( ) const
inline

Definition at line 3462 of file object.h.

3462 {
3463#if defined(DART_PRECOMPILED_RUNTIME)
3464 UNREACHABLE();
3465#else
3466 return untag()->packed_fields_;
3467#endif
3468 }

◆ parameter_types()

ArrayPtr dart::Function::parameter_types ( ) const
inline

Definition at line 3087 of file object.h.

3087 {
3088 return signature()->untag()->parameter_types();
3089 }

◆ ParameterNameAt()

StringPtr dart::Function::ParameterNameAt ( intptr_t  index) const

Definition at line 8660 of file object.cc.

8660 {
8661#if defined(DART_PRECOMPILED_RUNTIME)
8662 if (signature() == FunctionType::null()) {
8663 // Without the signature, we're guaranteed not to have any name information.
8664 return Symbols::OptimizedOut().ptr();
8665 }
8666#endif
8667 const intptr_t num_fixed = num_fixed_parameters();
8668 if (HasOptionalNamedParameters() && index >= num_fixed) {
8669 const Array& parameter_names =
8670 Array::Handle(signature()->untag()->named_parameter_names());
8671 return String::RawCast(parameter_names.At(index - num_fixed));
8672 }
8673#if defined(DART_PRECOMPILED_RUNTIME)
8674 return Symbols::OptimizedOut().ptr();
8675#else
8676 const Array& names = Array::Handle(untag()->positional_parameter_names());
8677 return String::RawCast(names.At(index));
8678#endif
8679}

◆ ParameterTypeAt()

AbstractTypePtr dart::Function::ParameterTypeAt ( intptr_t  index) const

Definition at line 8638 of file object.cc.

8638 {
8639 const Array& types = Array::Handle(parameter_types());
8640 return AbstractType::RawCast(types.At(index));
8641}
ArrayPtr parameter_types() const
Definition object.h:3087

◆ parent_function()

FunctionPtr dart::Function::parent_function ( ) const

Definition at line 8225 of file object.cc.

8225 {
8226 if (!IsClosureFunction()) return Function::null();
8227 Object& obj = Object::Handle(untag()->data());
8228 ASSERT(!obj.IsNull());
8229 return ClosureData::Cast(obj).parent_function();
8230}

◆ PRECOMPILER_WSR_FIELD_DECLARATION()

dart::Function::PRECOMPILER_WSR_FIELD_DECLARATION ( FunctionType  ,
signature   
)

◆ PrintName()

void dart::Function::PrintName ( const NameFormattingParams params,
BaseTextBuffer printer 
) const

Definition at line 11167 of file object.cc.

11168 {
11169 if (!IsLocalFunction()) {
11170 FunctionPrintNameHelper(*this, params, printer);
11171 return;
11172 }
11173 auto& fun = Function::Handle(ptr());
11174 FunctionPrintNameHelper(fun, params, printer);
11175}
bool IsLocalFunction() const
Definition object.h:3913
static void FunctionPrintNameHelper(const Function &fun, const NameFormattingParams &params, BaseTextBuffer *printer)
Definition object.cc:11095

◆ PrologueNeedsArgumentsDescriptor()

bool dart::Function::PrologueNeedsArgumentsDescriptor ( ) const

Definition at line 11488 of file object.cc.

11488 {
11489 // These functions have a saved compile-time arguments descriptor that is
11490 // used in lieu of the runtime arguments descriptor in generated IL.
11492 return false;
11493 }
11494 // The prologue of those functions need to examine the arg descriptor for
11495 // various purposes.
11496 return IsGeneric() || HasOptionalParameters();
11497}
bool HasSavedArgumentsDescriptor() const
Definition object.h:3253

◆ QualifiedScrubbedName()

StringPtr dart::Function::QualifiedScrubbedName ( ) const

Definition at line 11067 of file object.cc.

11067 {
11068 Thread* thread = Thread::Current();
11069 ZoneTextBuffer printer(thread->zone());
11070 PrintName(NameFormattingParams(kScrubbedName), &printer);
11071 return Symbols::New(thread, printer.buffer());
11072}
void PrintName(const NameFormattingParams &params, BaseTextBuffer *printer) const
Definition object.cc:11167

◆ QualifiedScrubbedNameCString()

const char * dart::Function::QualifiedScrubbedNameCString ( ) const

Definition at line 11074 of file object.cc.

11074 {
11075 Thread* thread = Thread::Current();
11076 ZoneTextBuffer printer(thread->zone());
11077 PrintName(NameFormattingParams(kScrubbedName), &printer);
11078 return printer.buffer();
11079}

◆ QualifiedUserVisibleName()

StringPtr dart::Function::QualifiedUserVisibleName ( ) const

Definition at line 11081 of file object.cc.

11081 {
11082 Thread* thread = Thread::Current();
11083 ZoneTextBuffer printer(thread->zone());
11084 PrintName(NameFormattingParams(kUserVisibleName), &printer);
11085 return Symbols::New(thread, printer.buffer());
11086}

◆ QualifiedUserVisibleNameCString()

const char * dart::Function::QualifiedUserVisibleNameCString ( ) const

Definition at line 11088 of file object.cc.

11088 {
11089 Thread* thread = Thread::Current();
11090 ZoneTextBuffer printer(thread->zone());
11091 PrintName(NameFormattingParams(kUserVisibleName), &printer);
11092 return printer.buffer();
11093}

◆ RawOwner()

ObjectPtr dart::Function::RawOwner ( ) const
inline

Definition at line 3063 of file object.h.

3063{ return untag()->owner(); }

◆ recognized_kind()

MethodRecognizer::Kind dart::Function::recognized_kind ( ) const
inline

Definition at line 3599 of file object.h.

3599 {
3600 return untag()->kind_tag_.Read<RecognizedBits>();
3601 }

◆ RecognizedKindForceOptimize()

bool dart::Function::RecognizedKindForceOptimize ( ) const

Definition at line 9144 of file object.cc.

9144 {
9145 switch (recognized_kind()) {
9146 // Uses unboxed/untagged data not supported in unoptimized, or uses
9147 // LoadIndexed/StoreIndexed/MemoryCopy instructions with typed data
9148 // arrays, which requires optimization for payload extraction.
9149 case MethodRecognizer::kObjectArrayGetIndexed:
9150 case MethodRecognizer::kGrowableArrayGetIndexed:
9151#define TYPED_DATA_GET_INDEXED_CASES(clazz) \
9152 case MethodRecognizer::k##clazz##ArrayGetIndexed: \
9153 FALL_THROUGH; \
9154 case MethodRecognizer::kExternal##clazz##ArrayGetIndexed: \
9155 FALL_THROUGH; \
9156 case MethodRecognizer::k##clazz##ArrayViewGetIndexed: \
9157 FALL_THROUGH;
9159#undef TYPED_DATA_GET_INDEXED_CASES
9160 case MethodRecognizer::kCopyRangeFromUint8ListToOneByteString:
9161 case MethodRecognizer::kFinalizerBase_getIsolateFinalizers:
9162 case MethodRecognizer::kFinalizerBase_setIsolate:
9163 case MethodRecognizer::kFinalizerBase_setIsolateFinalizers:
9164 case MethodRecognizer::kFinalizerEntry_getExternalSize:
9165 case MethodRecognizer::kExtensionStreamHasListener:
9166 case MethodRecognizer::kFfiLoadInt8:
9167 case MethodRecognizer::kFfiLoadInt16:
9168 case MethodRecognizer::kFfiLoadInt32:
9169 case MethodRecognizer::kFfiLoadInt64:
9170 case MethodRecognizer::kFfiLoadUint8:
9171 case MethodRecognizer::kFfiLoadUint16:
9172 case MethodRecognizer::kFfiLoadUint32:
9173 case MethodRecognizer::kFfiLoadUint64:
9174 case MethodRecognizer::kFfiLoadFloat:
9175 case MethodRecognizer::kFfiLoadFloatUnaligned:
9176 case MethodRecognizer::kFfiLoadDouble:
9177 case MethodRecognizer::kFfiLoadDoubleUnaligned:
9178 case MethodRecognizer::kFfiLoadPointer:
9179 case MethodRecognizer::kFfiStoreInt8:
9180 case MethodRecognizer::kFfiStoreInt16:
9181 case MethodRecognizer::kFfiStoreInt32:
9182 case MethodRecognizer::kFfiStoreInt64:
9183 case MethodRecognizer::kFfiStoreUint8:
9184 case MethodRecognizer::kFfiStoreUint16:
9185 case MethodRecognizer::kFfiStoreUint32:
9186 case MethodRecognizer::kFfiStoreUint64:
9187 case MethodRecognizer::kFfiStoreFloat:
9188 case MethodRecognizer::kFfiStoreFloatUnaligned:
9189 case MethodRecognizer::kFfiStoreDouble:
9190 case MethodRecognizer::kFfiStoreDoubleUnaligned:
9191 case MethodRecognizer::kFfiStorePointer:
9192 case MethodRecognizer::kFfiFromAddress:
9193 case MethodRecognizer::kFfiGetAddress:
9194 case MethodRecognizer::kFfiAsExternalTypedDataInt8:
9195 case MethodRecognizer::kFfiAsExternalTypedDataInt16:
9196 case MethodRecognizer::kFfiAsExternalTypedDataInt32:
9197 case MethodRecognizer::kFfiAsExternalTypedDataInt64:
9198 case MethodRecognizer::kFfiAsExternalTypedDataUint8:
9199 case MethodRecognizer::kFfiAsExternalTypedDataUint16:
9200 case MethodRecognizer::kFfiAsExternalTypedDataUint32:
9201 case MethodRecognizer::kFfiAsExternalTypedDataUint64:
9202 case MethodRecognizer::kFfiAsExternalTypedDataFloat:
9203 case MethodRecognizer::kFfiAsExternalTypedDataDouble:
9204 case MethodRecognizer::kGetNativeField:
9205 case MethodRecognizer::kRecord_fieldNames:
9206 case MethodRecognizer::kRecord_numFields:
9207 case MethodRecognizer::kStringBaseCodeUnitAt:
9208 case MethodRecognizer::kUtf8DecoderScan:
9209 case MethodRecognizer::kDouble_hashCode:
9210 case MethodRecognizer::kTypedList_GetInt8:
9211 case MethodRecognizer::kTypedList_SetInt8:
9212 case MethodRecognizer::kTypedList_GetUint8:
9213 case MethodRecognizer::kTypedList_SetUint8:
9214 case MethodRecognizer::kTypedList_GetInt16:
9215 case MethodRecognizer::kTypedList_SetInt16:
9216 case MethodRecognizer::kTypedList_GetUint16:
9217 case MethodRecognizer::kTypedList_SetUint16:
9218 case MethodRecognizer::kTypedList_GetInt32:
9219 case MethodRecognizer::kTypedList_SetInt32:
9220 case MethodRecognizer::kTypedList_GetUint32:
9221 case MethodRecognizer::kTypedList_SetUint32:
9222 case MethodRecognizer::kTypedList_GetInt64:
9223 case MethodRecognizer::kTypedList_SetInt64:
9224 case MethodRecognizer::kTypedList_GetUint64:
9225 case MethodRecognizer::kTypedList_SetUint64:
9226 case MethodRecognizer::kTypedList_GetFloat32:
9227 case MethodRecognizer::kTypedList_SetFloat32:
9228 case MethodRecognizer::kTypedList_GetFloat64:
9229 case MethodRecognizer::kTypedList_SetFloat64:
9230 case MethodRecognizer::kTypedList_GetInt32x4:
9231 case MethodRecognizer::kTypedList_SetInt32x4:
9232 case MethodRecognizer::kTypedList_GetFloat32x4:
9233 case MethodRecognizer::kTypedList_SetFloat32x4:
9234 case MethodRecognizer::kTypedList_GetFloat64x2:
9235 case MethodRecognizer::kTypedList_SetFloat64x2:
9236 case MethodRecognizer::kTypedData_memMove1:
9237 case MethodRecognizer::kTypedData_memMove2:
9238 case MethodRecognizer::kTypedData_memMove4:
9239 case MethodRecognizer::kTypedData_memMove8:
9240 case MethodRecognizer::kTypedData_memMove16:
9241 case MethodRecognizer::kMemCopy:
9242 // Prevent the GC from running so that the operation is atomic from
9243 // a GC point of view. Always double check implementation in
9244 // kernel_to_il.cc that no GC can happen in between the relevant IL
9245 // instructions.
9246 // TODO(https://dartbug.com/48527): Support inlining.
9247 case MethodRecognizer::kFinalizerBase_exchangeEntriesCollectedWithNull:
9248 // Both unboxed/untagged data and atomic-to-GC operation.
9249 case MethodRecognizer::kFinalizerEntry_allocate:
9250 return true;
9251 default:
9252 return false;
9253 }
9254}
#define DART_CLASS_LIST_TYPED_DATA(V)
Definition class_id.h:177
#define TYPED_DATA_GET_INDEXED_CASES(clazz)

◆ regexp()

RegExpPtr dart::Function::regexp ( ) const

Definition at line 8527 of file object.cc.

8527 {
8528 ASSERT(kind() == UntaggedFunction::kIrregexpFunction);
8529 const Array& pair = Array::Cast(Object::Handle(data()));
8530 return RegExp::RawCast(pair.At(0));
8531}

◆ reset_unboxed_parameters_and_return()

void dart::Function::reset_unboxed_parameters_and_return ( ) const
inline

Definition at line 3689 of file object.h.

3689 {
3690#if !defined(DART_PRECOMPILED_RUNTIME)
3691 StoreNonPointer(&untag()->unboxed_parameters_info_,
3692 UntaggedFunction::UnboxedParameterBitmap());
3693#endif // !defined(DART_PRECOMPILED_RUNTIME)
3694 }

◆ RestoreICDataMap()

void dart::Function::RestoreICDataMap ( ZoneGrowableArray< const ICData * > *  deopt_id_to_ic_data,
bool  clone_ic_data 
) const

Definition at line 11275 of file object.cc.

11277 {
11278#if !defined(DART_PRECOMPILED_RUNTIME)
11279 if (FLAG_force_clone_compiler_objects) {
11280 clone_ic_data = true;
11281 }
11282 ASSERT(deopt_id_to_ic_data->is_empty());
11283 Zone* zone = Thread::Current()->zone();
11284 const Array& saved_ic_data = Array::Handle(zone, ic_data_array());
11285 if (saved_ic_data.IsNull()) {
11286 // Could happen with not-yet compiled unoptimized code or force-optimized
11287 // functions.
11288 return;
11289 }
11290 const intptr_t saved_length = saved_ic_data.Length();
11291 ASSERT(saved_length > 0);
11292 if (saved_length > ICDataArrayIndices::kFirstICData) {
11293 const intptr_t restored_length =
11294 ICData::Cast(Object::Handle(zone, saved_ic_data.At(saved_length - 1)))
11295 .deopt_id() +
11296 1;
11297 deopt_id_to_ic_data->SetLength(restored_length);
11298 for (intptr_t i = 0; i < restored_length; i++) {
11299 (*deopt_id_to_ic_data)[i] = nullptr;
11300 }
11301 for (intptr_t i = ICDataArrayIndices::kFirstICData; i < saved_length; i++) {
11302 ICData& ic_data = ICData::ZoneHandle(zone);
11303 ic_data ^= saved_ic_data.At(i);
11304 if (clone_ic_data) {
11305 const ICData& original_ic_data = ICData::Handle(zone, ic_data.ptr());
11306 ic_data = ICData::Clone(ic_data);
11307 ic_data.SetOriginal(original_ic_data);
11308 }
11309 ASSERT(deopt_id_to_ic_data->At(ic_data.deopt_id()) == nullptr);
11310 (*deopt_id_to_ic_data)[ic_data.deopt_id()] = &ic_data;
11311 }
11312 }
11313#else // DART_PRECOMPILED_RUNTIME
11314 UNREACHABLE();
11315#endif // DART_PRECOMPILED_RUNTIME
11316}
static ICDataPtr Clone(const ICData &from)
Definition object.cc:17486

◆ result_type()

AbstractTypePtr dart::Function::result_type ( ) const
inline

Definition at line 3079 of file object.h.

3079 {
3080 return signature()->untag()->result_type();
3081 }

◆ SafeToClosurize()

bool dart::Function::SafeToClosurize ( ) const

Definition at line 10426 of file object.cc.

10426 {
10427#if defined(DART_PRECOMPILED_RUNTIME)
10429#else
10430 return true;
10431#endif
10432}

◆ saved_args_desc()

ArrayPtr dart::Function::saved_args_desc ( ) const

Definition at line 8191 of file object.cc.

8191 {
8192 if (kind() == UntaggedFunction::kDynamicInvocationForwarder) {
8193 return Array::null();
8194 }
8195 ASSERT(kind() == UntaggedFunction::kNoSuchMethodDispatcher ||
8196 kind() == UntaggedFunction::kInvokeFieldDispatcher);
8197 return Array::RawCast(untag()->data());
8198}

◆ SaveICDataMap()

void dart::Function::SaveICDataMap ( const ZoneGrowableArray< const ICData * > &  deopt_id_to_ic_data,
const Array edge_counters_array,
const Array coverage_array 
) const

Definition at line 11236 of file object.cc.

11239 {
11240#if !defined(DART_PRECOMPILED_RUNTIME)
11241 // Already installed nothing to do.
11242 if (ic_data_array() != Array::null()) {
11243 ASSERT(coverage_array.ptr() == GetCoverageArray());
11244 return;
11245 }
11246
11247 // Compute number of ICData objects to save.
11248 intptr_t count = 0;
11249 for (intptr_t i = 0; i < deopt_id_to_ic_data.length(); i++) {
11250 if (deopt_id_to_ic_data[i] != nullptr) {
11251 count++;
11252 }
11253 }
11254
11255 // Compress sparse deopt_id_to_ic_data mapping into a linear sequence of
11256 // ICData objects.
11257 const Array& array = Array::Handle(
11259 for (intptr_t i = 0, pos = ICDataArrayIndices::kFirstICData;
11260 i < deopt_id_to_ic_data.length(); i++) {
11261 if (deopt_id_to_ic_data[i] != nullptr) {
11262 ASSERT(i == deopt_id_to_ic_data[i]->deopt_id());
11263 array.SetAt(pos++, *deopt_id_to_ic_data[i]);
11264 }
11265 }
11266 array.SetAt(ICDataArrayIndices::kEdgeCounters, edge_counters_array);
11267 // Preserve coverage_array which is stored early after graph construction.
11268 array.SetAt(ICDataArrayIndices::kCoverageData, coverage_array);
11269 set_ic_data_array(array);
11270#else // DART_PRECOMPILED_RUNTIME
11271 UNREACHABLE();
11272#endif // DART_PRECOMPILED_RUNTIME
11273}
int count
SkPoint pos
ArrayPtr GetCoverageArray() const
Definition object.cc:11318
float length() const
static constexpr intptr_t kEdgeCounters
Definition object.h:4039

◆ script()

ScriptPtr dart::Function::script ( ) const

Definition at line 10939 of file object.cc.

10939 {
10940 // NOTE(turnidge): If you update this function, you probably want to
10941 // update Class::PatchFieldsAndFunctions() at the same time.
10943 const Function& target = Function::Handle(ForwardingTarget());
10944 return target.IsNull() ? Script::null() : target.script();
10945 }
10947 const auto& field = Field::Handle(accessor_field());
10948 return field.IsNull() ? Script::null() : field.Script();
10949 }
10950 if (is_eval_function()) {
10951 const auto& fdata = Array::Handle(Array::RawCast(data()));
10952 return Script::RawCast(
10953 fdata.At(static_cast<intptr_t>(EvalFunctionData::kScript)));
10954 }
10956 // Testing for position 0 is an optimization that relies on temporary
10957 // eval functions having token position 0.
10958 const Script& script = Script::Handle(eval_script());
10959 if (!script.IsNull()) {
10960 return script.ptr();
10961 }
10962 }
10963 const Object& obj = Object::Handle(untag()->owner());
10964 if (obj.IsPatchClass()) {
10965 return PatchClass::Cast(obj).script();
10966 }
10967 if (IsClosureFunction()) {
10968 const Function& function = Function::Handle(parent_function());
10969 if (function.IsNull()) return Script::null();
10970 return function.script();
10971 }
10972 ASSERT(obj.IsClass());
10973 return Class::Cast(obj).script();
10974}
FunctionPtr ForwardingTarget() const
Definition object.cc:8481
bool IsImplicitGetterOrSetter() const
Definition object.h:3298
FieldPtr accessor_field() const
Definition object.cc:8207
bool IsDynamicInvocationForwarder() const
Definition object.h:3294
static const TokenPosition kMinSource

◆ set_accessor_field()

void dart::Function::set_accessor_field ( const Field value) const

Definition at line 8215 of file object.cc.

8215 {
8216 ASSERT(kind() == UntaggedFunction::kImplicitGetter ||
8217 kind() == UntaggedFunction::kImplicitSetter ||
8218 kind() == UntaggedFunction::kImplicitStaticGetter ||
8219 kind() == UntaggedFunction::kFieldInitializer);
8220 // Top level classes may be finalized multiple times.
8221 ASSERT(untag()->data() == Object::null() || untag()->data() == value.ptr());
8222 set_data(value);
8223}

◆ set_awaiter_link()

void dart::Function::set_awaiter_link ( Function::AwaiterLink  link) const

Definition at line 8135 of file object.cc.

8135 {
8136 if (IsClosureFunction()) {
8137 const Object& obj = Object::Handle(untag()->data());
8138 ASSERT(!obj.IsNull());
8139 ClosureData::Cast(obj).set_awaiter_link(link);
8140 return;
8141 }
8142 UNREACHABLE();
8143}

◆ set_context_scope()

void dart::Function::set_context_scope ( const ContextScope value) const

Definition at line 8115 of file object.cc.

8115 {
8116 if (IsClosureFunction()) {
8117 const Object& obj = Object::Handle(untag()->data());
8118 ASSERT(!obj.IsNull());
8119 ClosureData::Cast(obj).set_context_scope(value);
8120 return;
8121 }
8122 UNREACHABLE();
8123}

◆ set_default_type_arguments_instantiation_mode()

void dart::Function::set_default_type_arguments_instantiation_mode ( InstantiationMode  value) const

Definition at line 8254 of file object.cc.

8255 {
8256 if (!IsClosureFunction()) {
8257 UNREACHABLE();
8258 }
8259 const auto& closure_data = ClosureData::Handle(ClosureData::RawCast(data()));
8260 ASSERT(!closure_data.IsNull());
8261 closure_data.set_default_type_arguments_instantiation_mode(value);
8262}

◆ set_end_token_pos()

void dart::Function::set_end_token_pos ( TokenPosition  value) const
inline

Definition at line 3442 of file object.h.

3442 {
3443#if defined(DART_PRECOMPILED_RUNTIME)
3444 UNREACHABLE();
3445#else
3446 StoreNonPointer(&untag()->end_token_pos_, value);
3447#endif
3448 }

◆ set_extracted_method_closure()

void dart::Function::set_extracted_method_closure ( const Function function) const

Definition at line 8185 of file object.cc.

8185 {
8186 ASSERT(kind() == UntaggedFunction::kMethodExtractor);
8187 ASSERT(untag()->data() == Object::null());
8188 set_data(value);
8189}

◆ set_is_optimizable()

void dart::Function::set_is_optimizable ( bool  value) const
inline

Definition at line 4185 of file object.h.

4185 {
4186#if defined(DART_PRECOMPILED_RUNTIME)
4187 UNREACHABLE();
4188#else
4189 untag()->packed_fields_.UpdateBool<UntaggedFunction::PackedOptimizable>(
4190 value);
4191#endif
4192 }

◆ set_kernel_offset()

void dart::Function::set_kernel_offset ( intptr_t  value) const
inline

Definition at line 3538 of file object.h.

3538 {
3539#if defined(DART_PRECOMPILED_RUNTIME)
3540 UNREACHABLE();
3541#else
3542 ASSERT(value >= 0);
3543 StoreNonPointer(&untag()->kernel_offset_, value);
3544#endif
3545 }

◆ set_modifier()

void dart::Function::set_modifier ( UntaggedFunction::AsyncModifier  value) const

Definition at line 8949 of file object.cc.

8949 {
8950 untag()->kind_tag_.Update<ModifierBits>(value);
8951}

◆ set_native_name()

void dart::Function::set_native_name ( const String name) const

Definition at line 8571 of file object.cc.

8571 {
8572 ASSERT(is_native());
8573 const auto& pair = Array::Cast(Object::Handle(data()));
8574 ASSERT(pair.At(0) == Object::null());
8575 pair.SetAt(NativeFunctionData::kNativeName, value);
8576}

◆ set_owner()

void dart::Function::set_owner ( const Object value) const

Definition at line 8522 of file object.cc.

8522 {
8523 ASSERT(!value.IsNull());
8524 untag()->set_owner(value.ptr());
8525}

◆ set_packed_fields()

void dart::Function::set_packed_fields ( uint32_t  packed_fields) const

Definition at line 8980 of file object.cc.

8980 {
8981#if defined(DART_PRECOMPILED_RUNTIME)
8982 UNREACHABLE();
8983#else
8984 StoreNonPointer(&untag()->packed_fields_, packed_fields);
8985#endif
8986}
uint32_t packed_fields() const
Definition object.h:3462

◆ set_recognized_kind()

void dart::Function::set_recognized_kind ( MethodRecognizer::Kind  value) const

Definition at line 8953 of file object.cc.

8953 {
8954 // Prevent multiple settings of kind.
8956 untag()->kind_tag_.Update<RecognizedBits>(value);
8957}
bool IsRecognized() const
Definition object.h:3604

◆ set_saved_args_desc()

void dart::Function::set_saved_args_desc ( const Array array) const

Definition at line 8200 of file object.cc.

8200 {
8201 ASSERT(kind() == UntaggedFunction::kNoSuchMethodDispatcher ||
8202 kind() == UntaggedFunction::kInvokeFieldDispatcher);
8203 ASSERT(untag()->data() == Object::null());
8204 set_data(value);
8205}

◆ set_token_pos()

void dart::Function::set_token_pos ( TokenPosition  value) const

Definition at line 8959 of file object.cc.

8959 {
8960#if defined(DART_PRECOMPILED_RUNTIME)
8961 UNREACHABLE();
8962#else
8964 StoreNonPointer(&untag()->token_pos_, token_pos);
8965#endif
8966}
bool IsClassifying() const

◆ set_unboxed_double_parameter_at()

void dart::Function::set_unboxed_double_parameter_at ( intptr_t  index) const
inline

Definition at line 3708 of file object.h.

3708 {
3709#if !defined(DART_PRECOMPILED_RUNTIME)
3710 ASSERT(index >= 0 && index < maximum_unboxed_parameter_count());
3711 index++; // position 0 is reserved for the return value
3712 const_cast<UntaggedFunction::UnboxedParameterBitmap*>(
3713 &untag()->unboxed_parameters_info_)
3714 ->SetUnboxedDouble(index);
3715
3716#else
3717 UNREACHABLE();
3718#endif // !defined(DART_PRECOMPILED_RUNTIME)
3719 }
static constexpr intptr_t maximum_unboxed_parameter_count()
Definition object.h:3684

◆ set_unboxed_double_return()

void dart::Function::set_unboxed_double_return ( ) const
inline

Definition at line 3731 of file object.h.

3731 {
3732#if !defined(DART_PRECOMPILED_RUNTIME)
3733 const_cast<UntaggedFunction::UnboxedParameterBitmap*>(
3734 &untag()->unboxed_parameters_info_)
3735 ->SetUnboxedDouble(0);
3736
3737#else
3738 UNREACHABLE();
3739#endif // !defined(DART_PRECOMPILED_RUNTIME)
3740 }

◆ set_unboxed_integer_parameter_at()

void dart::Function::set_unboxed_integer_parameter_at ( intptr_t  index) const
inline

Definition at line 3696 of file object.h.

3696 {
3697#if !defined(DART_PRECOMPILED_RUNTIME)
3698 ASSERT(index >= 0 && index < maximum_unboxed_parameter_count());
3699 index++; // position 0 is reserved for the return value
3700 const_cast<UntaggedFunction::UnboxedParameterBitmap*>(
3701 &untag()->unboxed_parameters_info_)
3702 ->SetUnboxedInteger(index);
3703#else
3704 UNREACHABLE();
3705#endif // !defined(DART_PRECOMPILED_RUNTIME)
3706 }

◆ set_unboxed_integer_return()

void dart::Function::set_unboxed_integer_return ( ) const
inline

Definition at line 3721 of file object.h.

3721 {
3722#if !defined(DART_PRECOMPILED_RUNTIME)
3723 const_cast<UntaggedFunction::UnboxedParameterBitmap*>(
3724 &untag()->unboxed_parameters_info_)
3725 ->SetUnboxedInteger(0);
3726#else
3727 UNREACHABLE();
3728#endif // !defined(DART_PRECOMPILED_RUNTIME)
3729 }

◆ set_unboxed_record_return()

void dart::Function::set_unboxed_record_return ( ) const
inline

Definition at line 3742 of file object.h.

3742 {
3743#if !defined(DART_PRECOMPILED_RUNTIME)
3744 const_cast<UntaggedFunction::UnboxedParameterBitmap*>(
3745 &untag()->unboxed_parameters_info_)
3746 ->SetUnboxedRecord(0);
3747
3748#else
3749 UNREACHABLE();
3750#endif // !defined(DART_PRECOMPILED_RUNTIME)
3751 }

◆ set_unoptimized_code()

void dart::Function::set_unoptimized_code ( const Code value) const

Definition at line 8096 of file object.cc.

8096 {
8097#if defined(DART_PRECOMPILED_RUNTIME)
8098 UNREACHABLE();
8099#else
8100 DEBUG_ASSERT(IsMutatorOrAtDeoptSafepoint());
8101 ASSERT(value.IsNull() || !value.is_optimized());
8102 untag()->set_unoptimized_code(value.ptr());
8103#endif
8104}

◆ SetDeoptReasonForAll()

void dart::Function::SetDeoptReasonForAll ( intptr_t  deopt_id,
ICData::DeoptReasonId  reason 
)

Definition at line 11350 of file object.cc.

11351 {
11352 const Array& array = Array::Handle(ic_data_array());
11353 ICData& ic_data = ICData::Handle();
11354 for (intptr_t i = ICDataArrayIndices::kFirstICData; i < array.Length(); i++) {
11355 ic_data ^= array.At(i);
11356 if (ic_data.deopt_id() == deopt_id) {
11357 ic_data.AddDeoptReason(reason);
11358 }
11359 }
11360}

◆ SetFfiCallbackExceptionalReturn()

void dart::Function::SetFfiCallbackExceptionalReturn ( const Instance value) const

Definition at line 8456 of file object.cc.

8456 {
8458 const Object& obj = Object::Handle(data());
8459 ASSERT(!obj.IsNull());
8460 FfiTrampolineData::Cast(obj).set_callback_exceptional_return(value);
8461}

◆ SetFfiCallbackKind()

void dart::Function::SetFfiCallbackKind ( FfiCallbackKind  value) const

Definition at line 8470 of file object.cc.

8470 {
8472 const Object& obj = Object::Handle(data());
8473 ASSERT(!obj.IsNull());
8474 FfiTrampolineData::Cast(obj).set_ffi_function_kind(value);
8475}

◆ SetFfiCallbackTarget()

void dart::Function::SetFfiCallbackTarget ( const Function target) const

Definition at line 8442 of file object.cc.

8442 {
8444 const Object& obj = Object::Handle(data());
8445 ASSERT(!obj.IsNull());
8446 FfiTrampolineData::Cast(obj).set_callback_target(target);
8447}

◆ SetFfiCSignature()

void dart::Function::SetFfiCSignature ( const FunctionType sig) const

Definition at line 8315 of file object.cc.

8315 {
8317 const Object& obj = Object::Handle(data());
8318 ASSERT(!obj.IsNull());
8319 FfiTrampolineData::Cast(obj).set_c_signature(sig);
8320}

◆ SetForwardingTarget()

void dart::Function::SetForwardingTarget ( const Function target) const

Definition at line 8486 of file object.cc.

8486 {
8487 ASSERT(kind() == UntaggedFunction::kDynamicInvocationForwarder);
8488 set_data(target);
8489}

◆ SetInstructions()

void dart::Function::SetInstructions ( const Code value) const

Definition at line 7967 of file object.cc.

7967 {
7968 // Ensure that nobody is executing this function when we install it.
7969 if (untag()->code() != Code::null() && HasCode()) {
7970 GcSafepointOperationScope safepoint(Thread::Current());
7971 SetInstructionsSafe(value);
7972 } else {
7973 ASSERT(IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
7974 SetInstructionsSafe(value);
7975 }
7976}

◆ SetInstructionsSafe()

void dart::Function::SetInstructionsSafe ( const Code value) const

Definition at line 7978 of file object.cc.

7978 {
7979 untag()->set_code(value.ptr());
7980 StoreNonPointer(&untag()->entry_point_, value.EntryPoint());
7981 StoreNonPointer(&untag()->unchecked_entry_point_,
7982 value.UncheckedEntryPoint());
7983}

◆ SetIsOptimizable()

void dart::Function::SetIsOptimizable ( bool  value) const

Definition at line 9006 of file object.cc.

9006 {
9007 ASSERT(!is_native());
9008 set_is_optimizable(value);
9009 if (!value) {
9010 set_is_inlinable(false);
9011 set_usage_counter(INT32_MIN);
9012 }
9013}
void set_is_optimizable(bool value) const
Definition object.h:4185

◆ SetKernelLibraryAndEvalScript()

void dart::Function::SetKernelLibraryAndEvalScript ( const Script script,
const class KernelProgramInfo kernel_program_info,
intptr_t  index 
) const

Definition at line 10925 of file object.cc.

10928 {
10929 Array& data_field = Array::Handle(
10930 Array::New(static_cast<intptr_t>(EvalFunctionData::kLength)));
10931 data_field.SetAt(static_cast<intptr_t>(EvalFunctionData::kScript), script);
10932 data_field.SetAt(static_cast<intptr_t>(EvalFunctionData::kKernelProgramInfo),
10933 kernel_program_info);
10934 data_field.SetAt(static_cast<intptr_t>(EvalFunctionData::kKernelLibraryIndex),
10935 Smi::Handle(Smi::New(index)));
10936 set_data(data_field);
10937}
static SmiPtr New(intptr_t value)
Definition object.h:9985

◆ SetOptimizedCallSiteCountClamped()

void dart::Function::SetOptimizedCallSiteCountClamped ( uintptr_t  value) const
inline

Definition at line 3557 of file object.h.

3557 {
3559 set_optimized_call_site_count(value);
3560 }
static constexpr intptr_t kMaxInstructionCount
Definition object.h:3550

◆ SetOptimizedInstructionCountClamped()

void dart::Function::SetOptimizedInstructionCountClamped ( uintptr_t  value) const
inline

Definition at line 3552 of file object.h.

3552 {
3554 set_optimized_instruction_count(value);
3555 }

◆ SetParameterNameAt()

void dart::Function::SetParameterNameAt ( intptr_t  index,
const String value 
) const

Definition at line 8681 of file object.cc.

8681 {
8682#if defined(DART_PRECOMPILED_RUNTIME)
8683 UNREACHABLE();
8684#else
8685 ASSERT(!value.IsNull() && value.IsSymbol());
8687 // These should be set on the signature, not the function.
8688 UNREACHABLE();
8689 }
8690 const Array& parameter_names =
8691 Array::Handle(untag()->positional_parameter_names());
8692 parameter_names.SetAt(index, value);
8693#endif
8694}

◆ SetRegExpData()

void dart::Function::SetRegExpData ( const RegExp regexp,
intptr_t  string_specialization_cid,
bool  sticky 
) const

Definition at line 8550 of file object.cc.

8552 {
8553 ASSERT(kind() == UntaggedFunction::kIrregexpFunction);
8555 ASSERT(data() == Object::null());
8556 const Array& pair = Array::Handle(Array::New(2, Heap::kOld));
8557 pair.SetAt(0, regexp);
8558 pair.SetAt(1, Smi::Handle(Smi::New(StickySpecialization::encode(sticky) |
8561 set_data(pair);
8562}
static constexpr intptr_t encode(bool value)
Definition bitfield.h:167
intptr_t string_specialization_cid() const
Definition object.cc:8538
RegExpPtr regexp() const
Definition object.cc:8527
bool IsStringClassId(intptr_t index)
Definition class_id.h:350

◆ SetSignature()

void dart::Function::SetSignature ( const FunctionType value) const

Definition at line 8604 of file object.cc.

8604 {
8605 set_signature(value);
8606 ASSERT(NumImplicitParameters() == value.num_implicit_parameters());
8607 if (IsClosureFunction() && value.IsGeneric()) {
8608 Zone* zone = Thread::Current()->zone();
8609 const TypeParameters& type_params =
8610 TypeParameters::Handle(zone, value.type_parameters());
8611 const TypeArguments& defaults =
8612 TypeArguments::Handle(zone, type_params.defaults());
8613 auto mode = defaults.GetInstantiationMode(zone, this);
8615 }
8616}
void set_default_type_arguments_instantiation_mode(InstantiationMode value) const
Definition object.cc:8254
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition switches.h:228

◆ SetUsageCounter()

void dart::Function::SetUsageCounter ( intptr_t  value) const
inline

Definition at line 4093 of file object.h.

4093 {
4094 if (usage_counter() > 0) {
4095 SetWasExecuted(true);
4096 }
4097 set_usage_counter(value);
4098 }
void SetWasExecuted(bool value) const
Definition object.h:4102

◆ SetWasExecuted()

void dart::Function::SetWasExecuted ( bool  value) const
inline

Definition at line 4102 of file object.h.

4102{ SetWasExecutedBit(value); }

◆ signature_offset()

static intptr_t dart::Function::signature_offset ( )
inlinestatic

Definition at line 3029 of file object.h.

3029 {
3030 return OFFSET_OF(UntaggedFunction, signature_);
3031 }

◆ SourceFingerprint()

int32_t dart::Function::SourceFingerprint ( ) const

Definition at line 11227 of file object.cc.

11227 {
11228#if !defined(DART_PRECOMPILED_RUNTIME)
11230 *this);
11231#else
11232 return 0;
11233#endif // !defined(DART_PRECOMPILED_RUNTIME)
11234}
static uint32_t CalculateFunctionFingerprint(const Function &func)

◆ SourceSize()

intptr_t dart::Function::SourceSize ( ) const

Definition at line 11504 of file object.cc.

11504 {
11505 const TokenPosition& start = token_pos();
11506 const TokenPosition& end = end_token_pos();
11507 if (!end.IsReal() || start.IsNoSource() || start.IsClassifying()) {
11508 // No source information, so just return 0.
11509 return 0;
11510 }
11511 if (start.IsSynthetic()) {
11512 // Try and approximate the source size using the parent's source size.
11513 const auto& parent = Function::Handle(parent_function());
11514 ASSERT(!parent.IsNull());
11515 const intptr_t parent_size = parent.SourceSize();
11516 if (parent_size == 0) {
11517 return parent_size;
11518 }
11519 // Parent must have a real ending position.
11520 return parent_size - (parent.end_token_pos().Pos() - end.Pos());
11521 }
11522 return end.Pos() - start.Pos();
11523}
glong glong end

◆ string_specialization_cid()

intptr_t dart::Function::string_specialization_cid ( ) const

Definition at line 8538 of file object.cc.

8538 {
8539 ASSERT(kind() == UntaggedFunction::kIrregexpFunction);
8540 const Array& pair = Array::Cast(Object::Handle(data()));
8542}

◆ SwitchToLazyCompiledUnoptimizedCode()

void dart::Function::SwitchToLazyCompiledUnoptimizedCode ( ) const

Definition at line 8065 of file object.cc.

8065 {
8066#if defined(DART_PRECOMPILED_RUNTIME)
8067 UNREACHABLE();
8068#else
8069 if (!HasOptimizedCode()) {
8070 return;
8071 }
8072
8073 Thread* thread = Thread::Current();
8074 Zone* zone = thread->zone();
8075 ASSERT(thread->IsDartMutatorThread());
8076
8077 const Code& current_code = Code::Handle(zone, CurrentCode());
8078 TIR_Print("Disabling optimized code for %s\n", ToCString());
8079 current_code.DisableDartCode();
8080
8081 const Code& unopt_code = Code::Handle(zone, unoptimized_code());
8082 if (unopt_code.IsNull()) {
8083 // Set the lazy compile stub code.
8084 TIR_Print("Switched to lazy compile stub for %s\n", ToCString());
8085 SetInstructions(StubCode::LazyCompile());
8086 return;
8087 }
8088
8089 TIR_Print("Switched to unoptimized code for %s\n", ToCString());
8090
8091 AttachCode(unopt_code);
8092 unopt_code.Enable();
8093#endif
8094}
bool HasOptimizedCode() const
Definition object.cc:11032
#define TIR_Print(format,...)

◆ SwitchToUnoptimizedCode()

void dart::Function::SwitchToUnoptimizedCode ( ) const

Definition at line 8040 of file object.cc.

8040 {
8043 Thread* thread = Thread::Current();
8045 thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
8046 Zone* zone = thread->zone();
8047 // TODO(35224): DEBUG_ASSERT(thread->TopErrorHandlerIsExitFrame());
8048 const Code& current_code = Code::Handle(zone, CurrentCode());
8049
8050 if (FLAG_trace_deoptimization_verbose) {
8051 THR_Print("Disabling optimized code: '%s' entry: %#" Px "\n",
8052 ToFullyQualifiedCString(), current_code.EntryPoint());
8053 }
8054 current_code.DisableDartCode();
8055 const Error& error =
8056 Error::Handle(zone, Compiler::EnsureUnoptimizedCode(thread, *this));
8057 if (!error.IsNull()) {
8059 }
8060 const Code& unopt_code = Code::Handle(zone, unoptimized_code());
8061 unopt_code.Enable();
8062 AttachCode(unopt_code);
8063}
const char * ToFullyQualifiedCString() const
Definition object.cc:9820
#define Px
Definition globals.h:410

◆ ToFullyQualifiedCString()

const char * dart::Function::ToFullyQualifiedCString ( ) const

Definition at line 9820 of file object.cc.

9820 {
9821 char* chars = nullptr;
9822 ConstructFunctionFullyQualifiedCString(*this, &chars, 0, true,
9824 return chars;
9825}
@ kQualifiedFunctionLibKindLibUrl
Definition object.cc:9755
static intptr_t ConstructFunctionFullyQualifiedCString(const Function &function, char **chars, intptr_t reserve_len, bool with_lib, QualifiedFunctionLibKind lib_kind)
Definition object.cc:9759

◆ token_pos()

TokenPosition dart::Function::token_pos ( ) const
inline

Definition at line 3426 of file object.h.

3426 {
3427#if defined(DART_PRECOMPILED_RUNTIME)
3428 return TokenPosition::kNoSource;
3429#else
3430 return untag()->token_pos_;
3431#endif
3432 }

◆ ToLibNamePrefixedQualifiedCString()

const char * dart::Function::ToLibNamePrefixedQualifiedCString ( ) const

Definition at line 9827 of file object.cc.

9827 {
9828 char* chars = nullptr;
9829 ConstructFunctionFullyQualifiedCString(*this, &chars, 0, true,
9831 return chars;
9832}
@ kQualifiedFunctionLibKindLibName
Definition object.cc:9756

◆ ToQualifiedCString()

const char * dart::Function::ToQualifiedCString ( ) const

Definition at line 9834 of file object.cc.

9834 {
9835 char* chars = nullptr;
9836 ConstructFunctionFullyQualifiedCString(*this, &chars, 0, false,
9838 return chars;
9839}

◆ type_parameters()

TypeParametersPtr dart::Function::type_parameters ( ) const
inline

Definition at line 3109 of file object.h.

3109 {
3110 return signature()->untag()->type_parameters();
3111 }

◆ TypeParameterAt()

TypeParameterPtr dart::Function::TypeParameterAt ( intptr_t  index,
Nullability  nullability = Nullability::kNonNullable 
) const

Definition at line 8939 of file object.cc.

8940 {
8941 const FunctionType& sig = FunctionType::Handle(signature());
8942 return sig.TypeParameterAt(index, nullability);
8943}

◆ unchecked_entry_point_offset()

static intptr_t dart::Function::unchecked_entry_point_offset ( )
inlinestatic

Definition at line 3195 of file object.h.

3195 {
3196 return OFFSET_OF(UntaggedFunction, unchecked_entry_point_);
3197 }

◆ unoptimized_code()

CodePtr dart::Function::unoptimized_code ( ) const
inline

Definition at line 3165 of file object.h.

3165 {
3166#if defined(DART_PRECOMPILED_RUNTIME)
3167 return static_cast<CodePtr>(Object::null());
3168#else
3169 return untag()->unoptimized_code();
3170#endif
3171 }

◆ UserVisibleName()

StringPtr dart::Function::UserVisibleName ( ) const

Definition at line 11057 of file object.cc.

11057 {
11058 if (FLAG_show_internal_names) {
11059 return name();
11060 }
11061 return Symbols::New(
11064 is_extension_member() || is_extension_type_member()));
11065}
static const char * ScrubName(const String &name, bool is_extension=false)
Definition object.cc:287

◆ UserVisibleNameCString()

const char * dart::Function::UserVisibleNameCString ( ) const

Definition at line 11048 of file object.cc.

11048 {
11049 if (FLAG_show_internal_names) {
11050 return String::Handle(name()).ToCString();
11051 }
11052 is_extension_type_member();
11054 is_extension_member() || is_extension_type_member());
11055}

◆ UserVisibleSignature()

StringPtr dart::Function::UserVisibleSignature ( ) const

Definition at line 10687 of file object.cc.

10687 {
10688#if defined(DART_PRECOMPILED_RUNTIME)
10689 if (signature() == FunctionType::null()) {
10690 return String::null();
10691 }
10692#endif
10693 Thread* thread = Thread::Current();
10694 ZoneTextBuffer printer(thread->zone());
10695 const FunctionType& sig = FunctionType::Handle(signature());
10696 sig.Print(kUserVisibleName, &printer);
10697 return Symbols::New(thread, printer.buffer());
10698}

◆ VerifyCallEntryPoint()

ErrorPtr dart::Function::VerifyCallEntryPoint ( ) const

Definition at line 27386 of file object.cc.

27386 {
27387 if (!FLAG_verify_entry_points) return Error::null();
27388
27389 const Class& cls = Class::Handle(Owner());
27390 const Library& lib = Library::Handle(cls.library());
27391 switch (kind()) {
27392 case UntaggedFunction::kRegularFunction:
27393 case UntaggedFunction::kSetterFunction:
27394 case UntaggedFunction::kConstructor:
27395 return dart::VerifyEntryPoint(lib, *this, *this,
27397 break;
27398 case UntaggedFunction::kGetterFunction:
27400 lib, *this, *this,
27402 break;
27403 case UntaggedFunction::kImplicitGetter:
27406 break;
27407 case UntaggedFunction::kImplicitSetter:
27410 case UntaggedFunction::kMethodExtractor:
27412 .VerifyClosurizedEntryPoint();
27413 break;
27414 default:
27415 return dart::VerifyEntryPoint(lib, *this, Object::Handle(), {});
27416 break;
27417 }
27418}
FunctionPtr extracted_method_closure() const
Definition object.cc:8178
DART_WARN_UNUSED_RESULT ErrorPtr VerifyEntryPoint(const Library &lib, const Object &member, const Object &annotated, std::initializer_list< EntryPointPragma > allowed_kinds)
Definition object.cc:27227

◆ VerifyClosurizedEntryPoint()

ErrorPtr dart::Function::VerifyClosurizedEntryPoint ( ) const

Definition at line 27420 of file object.cc.

27420 {
27421 if (!FLAG_verify_entry_points) return Error::null();
27422
27423 const Class& cls = Class::Handle(Owner());
27424 const Library& lib = Library::Handle(cls.library());
27425 switch (kind()) {
27426 case UntaggedFunction::kRegularFunction:
27427 return dart::VerifyEntryPoint(lib, *this, *this,
27429 case UntaggedFunction::kImplicitClosureFunction: {
27430 const Function& parent = Function::Handle(parent_function());
27431 return dart::VerifyEntryPoint(lib, parent, parent,
27433 }
27434 default:
27435 UNREACHABLE();
27436 }
27437}

◆ WasExecuted()

bool dart::Function::WasExecuted ( ) const
inline

Definition at line 4100 of file object.h.

4100{ return (usage_counter() > 0) || WasExecutedBit(); }

Friends And Related Symbol Documentation

◆ Class

friend class Class
friend

Definition at line 4281 of file object.h.

◆ ClassFinalizer

friend class ClassFinalizer
friend

Definition at line 4286 of file object.h.

◆ Parser

friend class Parser
friend

Definition at line 4282 of file object.h.

◆ Precompiler

friend class Precompiler
friend

Definition at line 4288 of file object.h.

◆ ProgramVisitor

friend class ProgramVisitor
friend

Definition at line 4289 of file object.h.

◆ Type

friend class Type
friend

Definition at line 4287 of file object.h.

◆ UntaggedFunction

friend class UntaggedFunction
friend

Definition at line 4285 of file object.h.

Member Data Documentation

◆ kMaxInstructionCount

constexpr intptr_t dart::Function::kMaxInstructionCount = (1 << 16) - 1
staticconstexpr

Definition at line 3550 of file object.h.


The documentation for this class was generated from the following files: