Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
dart::Code Class Reference

#include <object.h>

Inheritance diagram for dart::Code:
dart::Object

Classes

struct  ArrayTraits
 
class  EntryPointField
 
class  KindField
 
class  OffsetField
 

Public Types

enum  CallKind { kPcRelativeCall = 1 , kPcRelativeTTSCall = 2 , kPcRelativeTailCall = 3 , kCallViaCode = 4 }
 
enum  CallEntryPoint { kDefaultEntry , kUncheckedEntry }
 
enum  SCallTableEntry { kSCallTableKindAndOffset = 0 , kSCallTableCodeOrTypeTarget = 1 , kSCallTableFunctionTarget = 2 , kSCallTableEntryLength = 3 }
 
enum class  PoolAttachment { kAttachPool , kNotAttachPool }
 
using EntryKind = CodeEntryKind
 
- 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

InstructionsPtr active_instructions () const
 
InstructionsPtr instructions () const
 
ObjectPoolPtr object_pool () const
 
intptr_t pointer_offsets_length () const
 
bool is_optimized () const
 
void set_is_optimized (bool value) const
 
bool is_force_optimized () const
 
void set_is_force_optimized (bool value) const
 
bool is_alive () const
 
void set_is_alive (bool value) const
 
bool is_discarded () const
 
void set_is_discarded (bool value) const
 
bool HasMonomorphicEntry () const
 
uword PayloadStart () const
 
uword EntryPoint () const
 
uword UncheckedEntryPoint () const
 
uword MonomorphicEntryPoint () const
 
uword MonomorphicUncheckedEntryPoint () const
 
uword Size () const
 
ObjectPoolPtr GetObjectPool () const
 
bool ContainsInstructionAt (uword addr) const
 
bool HasBreakpoint () const
 
PcDescriptorsPtr pc_descriptors () const
 
void set_pc_descriptors (const PcDescriptors &descriptors) const
 
CodeSourceMapPtr code_source_map () const
 
void set_code_source_map (const CodeSourceMap &code_source_map) const
 
ArrayPtr deopt_info_array () const
 
void set_deopt_info_array (const Array &array) const
 
intptr_t num_variables () const
 
void set_num_variables (intptr_t num_variables) const
 
CompressedStackMapsPtr compressed_stackmaps () const
 
void set_compressed_stackmaps (const CompressedStackMaps &maps) const
 
void set_static_calls_target_table (const Array &value) const
 
ArrayPtr static_calls_target_table () const
 
TypedDataPtr GetDeoptInfoAtPc (uword pc, ICData::DeoptReasonId *deopt_reason, uint32_t *deopt_flags) const
 
FunctionPtr GetStaticCallTargetFunctionAt (uword pc) const
 
void SetStaticCallTargetCodeAt (uword pc, const Code &code) const
 
void SetStubCallTargetCodeAt (uword pc, const Code &code) const
 
void Disassemble (DisassemblyFormatter *formatter=nullptr) const
 
ObjectPtr return_address_metadata () const
 
void SetPrologueOffset (intptr_t offset) const
 
intptr_t GetPrologueOffset () const
 
ArrayPtr inlined_id_to_function () const
 
void set_inlined_id_to_function (const Array &value) const
 
void GetInlinedFunctionsAtInstruction (intptr_t pc_offset, GrowableArray< const Function * > *functions, GrowableArray< TokenPosition > *token_positions) const
 
void GetInlinedFunctionsAtReturnAddress (intptr_t pc_offset, GrowableArray< const Function * > *functions, GrowableArray< TokenPosition > *token_positions) const
 
 NOT_IN_PRODUCT (void PrintJSONInlineIntervals(JSONObject *object) const)
 
void DumpInlineIntervals () const
 
void DumpSourcePositions (bool relative_addresses=false) const
 
LocalVarDescriptorsPtr var_descriptors () const
 
void set_var_descriptors (const LocalVarDescriptors &value) const
 
LocalVarDescriptorsPtr GetLocalVarDescriptors () const
 
ExceptionHandlersPtr exception_handlers () const
 
void set_exception_handlers (const ExceptionHandlers &handlers) const
 
FunctionPtr function () const
 
ObjectPtr owner () const
 
void set_owner (const Object &owner) const
 
classid_t OwnerClassId () const
 
int32_t GetPointerOffsetAt (int index) const
 
TokenPosition GetTokenIndexOfPC (uword pc) const
 
uword GetPcForDeoptId (intptr_t deopt_id, UntaggedPcDescriptors::Kind kind) const
 
intptr_t GetDeoptIdForOsr (uword pc) const
 
uint32_t Hash () const
 
const char * Name () const
 
const char * QualifiedName (const NameFormattingParams &params) const
 
int64_t compile_timestamp () const
 
bool IsStubCode () const
 
bool IsAllocationStubCode () const
 
bool IsTypeTestStubCode () const
 
bool IsFunctionCode () const
 
bool IsUnknownDartCode () const
 
void DisableDartCode () const
 
void DisableStubCode (bool is_cls_parameterized) const
 
void Enable () const
 
bool IsDisabled () const
 
void set_object_pool (ObjectPoolPtr object_pool) const
 
- 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
 
virtual StringPtr DictionaryName () const
 
bool IsNew () const
 
bool IsOld () const
 
bool InVMIsolateHeap () const
 
void Print () const
 

Static Public Member Functions

static InstructionsPtr InstructionsOf (const CodePtr code)
 
static intptr_t instructions_offset ()
 
static intptr_t active_instructions_offset ()
 
static const char * EntryKindToCString (EntryKind kind)
 
static bool ParseEntryKind (const char *str, EntryKind *out)
 
static intptr_t entry_point_offset (EntryKind kind=EntryKind::kNormal)
 
static intptr_t object_pool_offset ()
 
static bool IsOptimized (CodePtr code)
 
static bool IsDiscarded (const CodePtr code)
 
static bool HasMonomorphicEntry (const CodePtr code)
 
static uword PayloadStartOf (const CodePtr code)
 
static uword EntryPointOf (const CodePtr code)
 
static uword UncheckedEntryPointOf (const CodePtr code)
 
static uword PayloadSizeOf (const CodePtr code)
 
static bool ContainsInstructionAt (const CodePtr code, uword pc)
 
static classid_t OwnerClassIdOf (CodePtr raw)
 
static intptr_t owner_offset ()
 
static intptr_t InstanceSize ()
 
static intptr_t InstanceSize (intptr_t len)
 
static CodePtr FinalizeCode (FlowGraphCompiler *compiler, compiler::Assembler *assembler, PoolAttachment pool_attachment, bool optimized, CodeStatistics *stats)
 
static void NotifyCodeObservers (const Code &code, bool optimized)
 
static void NotifyCodeObservers (const Function &function, const Code &code, bool optimized)
 
static void NotifyCodeObservers (const char *name, const Code &code, bool optimized)
 
static CodePtr FinalizeCodeAndNotify (const Function &function, FlowGraphCompiler *compiler, compiler::Assembler *assembler, PoolAttachment pool_attachment, bool optimized=false, CodeStatistics *stats=nullptr)
 
static CodePtr FinalizeCodeAndNotify (const char *name, FlowGraphCompiler *compiler, compiler::Assembler *assembler, PoolAttachment pool_attachment, bool optimized=false, CodeStatistics *stats=nullptr)
 
static CodePtr FindCode (uword pc, int64_t timestamp)
 
static CodePtr FindCodeUnsafe (uword pc)
 
static bool IsUnknownDartCode (CodePtr code)
 
static bool IsDisabled (CodePtr code)
 
- 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 kBytesPerElement
 
static constexpr intptr_t kMaxElements = kSmiMax / kBytesPerElement
 
- Static Public Attributes inherited from dart::Object
static constexpr intptr_t kHashBits = 30
 
static const ClassId kClassId = kObjectCid
 

Friends

class UntaggedObject
 
class UntaggedCode
 
struct RelocatorTestHelper
 
class Class
 
class CodeTestHelper
 
class StubCode
 
class Precompiler
 
class FunctionSerializationCluster
 
class CodeSerializationCluster
 
class CodeDeserializationCluster
 
class Deserializer
 
class MegamorphicCacheTable
 
class CodePatcher
 
class ProgramVisitor
 
class UntaggedFunction
 
class CallSiteResetter
 
class CodeKeyValueTrait
 
class InstanceCall
 
class StaticCall
 
void DumpStackFrame (intptr_t frame_index, uword pc, uword fp)
 

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 6761 of file object.h.

Member Typedef Documentation

◆ EntryKind

Definition at line 6788 of file object.h.

Member Enumeration Documentation

◆ CallEntryPoint

Enumerator
kDefaultEntry 
kUncheckedEntry 

Definition at line 6975 of file object.h.

6975 {
6978 };
@ kDefaultEntry
Definition: object.h:6976
@ kUncheckedEntry
Definition: object.h:6977

◆ CallKind

Enumerator
kPcRelativeCall 
kPcRelativeTTSCall 
kPcRelativeTailCall 
kCallViaCode 

Definition at line 6968 of file object.h.

6968 {
6969 kPcRelativeCall = 1,
6972 kCallViaCode = 4,
6973 };
@ kPcRelativeCall
Definition: object.h:6969
@ kPcRelativeTTSCall
Definition: object.h:6970
@ kCallViaCode
Definition: object.h:6972
@ kPcRelativeTailCall
Definition: object.h:6971

◆ PoolAttachment

enum class dart::Code::PoolAttachment
strong
Enumerator
kAttachPool 
kNotAttachPool 

Definition at line 6987 of file object.h.

6987 {
6988 kAttachPool,
6989 kNotAttachPool,
6990 };

◆ SCallTableEntry

Enumerator
kSCallTableKindAndOffset 
kSCallTableCodeOrTypeTarget 
kSCallTableFunctionTarget 
kSCallTableEntryLength 

Definition at line 6980 of file object.h.

6980 {
6985 };
@ kSCallTableEntryLength
Definition: object.h:6984
@ kSCallTableFunctionTarget
Definition: object.h:6983
@ kSCallTableCodeOrTypeTarget
Definition: object.h:6982
@ kSCallTableKindAndOffset
Definition: object.h:6981

Member Function Documentation

◆ active_instructions()

InstructionsPtr dart::Code::active_instructions ( ) const
inline

Definition at line 6764 of file object.h.

6764 {
6765#if defined(DART_PRECOMPILED_RUNTIME)
6766 UNREACHABLE();
6767 return nullptr;
6768#else
6769 return untag()->active_instructions();
6770#endif
6771 }
#define UNREACHABLE()
Definition: assert.h:248
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)
Definition: raw_object.cc:558

◆ active_instructions_offset()

static intptr_t dart::Code::active_instructions_offset ( )
inlinestatic

Definition at line 6783 of file object.h.

6783 {
6784 return OFFSET_OF(UntaggedCode, active_instructions_);
6785 }
friend class UntaggedCode
Definition: object.h:7276
#define OFFSET_OF(type, field)
Definition: globals.h:138

◆ code_source_map()

CodeSourceMapPtr dart::Code::code_source_map ( ) const
inline

Definition at line 6933 of file object.h.

6933 {
6934 return untag()->code_source_map();
6935 }

◆ compile_timestamp()

int64_t dart::Code::compile_timestamp ( ) const
inline

Definition at line 7230 of file object.h.

7230 {
7231#if defined(PRODUCT)
7232 return 0;
7233#else
7234 return untag()->compile_timestamp_;
7235#endif
7236 }

◆ compressed_stackmaps()

CompressedStackMapsPtr dart::Code::compressed_stackmaps ( ) const
inline

Definition at line 6963 of file object.h.

6963 {
6964 return untag()->compressed_stackmaps();
6965 }

◆ ContainsInstructionAt() [1/2]

static bool dart::Code::ContainsInstructionAt ( const CodePtr  code,
uword  pc 
)
inlinestatic

Definition at line 6920 of file object.h.

6920 {
6921 return UntaggedCode::ContainsPC(code, pc);
6922 }

◆ ContainsInstructionAt() [2/2]

bool dart::Code::ContainsInstructionAt ( uword  addr) const
inline

Definition at line 6915 of file object.h.

6915 {
6916 return ContainsInstructionAt(ptr(), addr);
6917 }
bool ContainsInstructionAt(uword addr) const
Definition: object.h:6915
ObjectPtr ptr() const
Definition: object.h:332

◆ deopt_info_array()

ArrayPtr dart::Code::deopt_info_array ( ) const
inline

Definition at line 6943 of file object.h.

6943 {
6944#if defined(DART_PRECOMPILED_RUNTIME)
6945 UNREACHABLE();
6946 return nullptr;
6947#else
6948 return untag()->deopt_info_array();
6949#endif
6950 }

◆ DisableDartCode()

void dart::Code::DisableDartCode ( ) const

Definition at line 18383 of file object.cc.

18383 {
18384 GcSafepointOperationScope safepoint(Thread::Current());
18387 const Code& new_code = StubCode::FixCallersTarget();
18388 SetActiveInstructions(Instructions::Handle(new_code.instructions()),
18389 new_code.UncheckedEntryPointOffset());
18390}
bool IsFunctionCode() const
Definition: object.cc:18374
InstructionsPtr active_instructions() const
Definition: object.h:6764
InstructionsPtr instructions() const
Definition: object.h:6774
static Object & Handle()
Definition: object.h:407
static Thread * Current()
Definition: thread.h:362
#define ASSERT(E)

◆ DisableStubCode()

void dart::Code::DisableStubCode ( bool  is_cls_parameterized) const

Definition at line 18392 of file object.cc.

18392 {
18393 GcSafepointOperationScope safepoint(Thread::Current());
18396 const Code& new_code = is_cls_parameterized
18397 ? StubCode::FixParameterizedAllocationStubTarget()
18398 : StubCode::FixAllocationStubTarget();
18399 SetActiveInstructions(Instructions::Handle(new_code.instructions()),
18400 new_code.UncheckedEntryPointOffset());
18401}
friend class StubCode
Definition: object.h:7384
bool IsAllocationStubCode() const
Definition: object.cc:18363

◆ Disassemble()

void dart::Code::Disassemble ( DisassemblyFormatter formatter = nullptr) const

Definition at line 17849 of file object.cc.

17849 {
17850#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)
17851 if (!FLAG_support_disassembler) {
17852 return;
17853 }
17854 const uword start = PayloadStart();
17855 if (formatter == nullptr) {
17856 Disassembler::Disassemble(start, start + Size(), *this);
17857 } else {
17858 Disassembler::Disassemble(start, start + Size(), formatter, *this);
17859 }
17860#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)
17861}
uword Size() const
Definition: object.h:6903
uword PayloadStart() const
Definition: object.h:6850
static void Disassemble(uword start, uword end, DisassemblyFormatter *formatter, const Code &code, const CodeComments *comments=nullptr)
uintptr_t uword
Definition: globals.h:501

◆ DumpInlineIntervals()

void dart::Code::DumpInlineIntervals ( ) const

Definition at line 18477 of file object.cc.

18477 {
18478 const CodeSourceMap& map = CodeSourceMap::Handle(code_source_map());
18479 if (map.IsNull()) {
18480 // Stub code.
18481 return;
18482 }
18483 const Array& id_map = Array::Handle(inlined_id_to_function());
18484 const Function& root = Function::Handle(function());
18485 CodeSourceMapReader reader(map, id_map, root);
18486 reader.DumpInlineIntervals(PayloadStart());
18487}
FunctionPtr function() const
Definition: object.h:7130
CodeSourceMapPtr code_source_map() const
Definition: object.h:6933
ArrayPtr inlined_id_to_function() const
Definition: object.cc:17949
string root
Definition: scale_cpu.py:20
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>
Definition: SkVx.h:680

◆ DumpSourcePositions()

void dart::Code::DumpSourcePositions ( bool  relative_addresses = false) const

Definition at line 18489 of file object.cc.

18489 {
18490 const CodeSourceMap& map = CodeSourceMap::Handle(code_source_map());
18491 if (map.IsNull()) {
18492 // Stub code.
18493 return;
18494 }
18495 const Array& id_map = Array::Handle(inlined_id_to_function());
18496 const Function& root = Function::Handle(function());
18497 CodeSourceMapReader reader(map, id_map, root);
18498 reader.DumpSourcePositions(relative_addresses ? 0 : PayloadStart());
18499}

◆ Enable()

void dart::Code::Enable ( ) const
inline

Definition at line 7252 of file object.h.

7252 {
7253 if (!IsDisabled()) return;
7254 ResetActiveInstructions();
7255 }
bool IsDisabled() const
Definition: object.h:7257

◆ entry_point_offset()

static intptr_t dart::Code::entry_point_offset ( EntryKind  kind = EntryKind::kNormal)
inlinestatic

Definition at line 6793 of file object.h.

6793 {
6794 switch (kind) {
6795 case EntryKind::kNormal:
6796 return OFFSET_OF(UntaggedCode, entry_point_);
6797 case EntryKind::kUnchecked:
6798 return OFFSET_OF(UntaggedCode, unchecked_entry_point_);
6799 case EntryKind::kMonomorphic:
6800 return OFFSET_OF(UntaggedCode, monomorphic_entry_point_);
6801 case EntryKind::kMonomorphicUnchecked:
6802 return OFFSET_OF(UntaggedCode, monomorphic_unchecked_entry_point_);
6803 default:
6804 UNREACHABLE();
6805 }
6806 }

◆ EntryKindToCString()

const char * dart::Code::EntryKindToCString ( EntryKind  kind)
static

Definition at line 17592 of file object.cc.

17592 {
17593 switch (kind) {
17594 case EntryKind::kNormal:
17595 return "Normal";
17596 case EntryKind::kUnchecked:
17597 return "Unchecked";
17598 case EntryKind::kMonomorphic:
17599 return "Monomorphic";
17600 case EntryKind::kMonomorphicUnchecked:
17601 return "MonomorphicUnchecked";
17602 default:
17603 UNREACHABLE();
17604 return nullptr;
17605 }
17606}

◆ EntryPoint()

uword dart::Code::EntryPoint ( ) const
inline

Definition at line 6864 of file object.h.

6864{ return EntryPointOf(ptr()); }
static uword EntryPointOf(const CodePtr code)
Definition: object.h:6865

◆ EntryPointOf()

static uword dart::Code::EntryPointOf ( const CodePtr  code)
inlinestatic

Definition at line 6865 of file object.h.

6865 {
6866#if defined(DART_PRECOMPILED_RUNTIME)
6867 return code->untag()->entry_point_;
6868#else
6870#endif
6871 }
static InstructionsPtr InstructionsOf(const CodePtr code)
Definition: object.h:6775
uword EntryPoint() const
Definition: object.h:5747

◆ exception_handlers()

ExceptionHandlersPtr dart::Code::exception_handlers ( ) const
inline

Definition at line 7116 of file object.h.

7116 {
7117 return untag()->exception_handlers();
7118 }

◆ FinalizeCode()

CodePtr dart::Code::FinalizeCode ( FlowGraphCompiler compiler,
compiler::Assembler assembler,
PoolAttachment  pool_attachment,
bool  optimized,
CodeStatistics stats 
)
static

Definition at line 18018 of file object.cc.

18022 {
18023 auto thread = Thread::Current();
18024 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
18025
18026 ASSERT(assembler != nullptr);
18027 ObjectPool& object_pool = ObjectPool::Handle();
18028
18029 if (pool_attachment == PoolAttachment::kAttachPool) {
18030 if (assembler->HasObjectPoolBuilder()) {
18031 object_pool =
18032 ObjectPool::NewFromBuilder(assembler->object_pool_builder());
18033 } else {
18034 object_pool = ObjectPool::empty_object_pool().ptr();
18035 }
18036 } else {
18037#if defined(DART_PRECOMPILER)
18038 if (assembler->HasObjectPoolBuilder() &&
18039 assembler->object_pool_builder().HasParent()) {
18040 // We are not going to write this pool into snapshot, but we will use
18041 // it to emit references from this code object to other objects in the
18042 // snapshot that it uses.
18043 object_pool =
18044 ObjectPool::NewFromBuilder(assembler->object_pool_builder());
18045 }
18046#endif // defined(DART_PRECOMPILER)
18047 }
18048
18049 // Allocate the Code and Instructions objects. Code is allocated first
18050 // because a GC during allocation of the code will leave the instruction
18051 // pages read-only.
18052 intptr_t pointer_offset_count = assembler->CountPointerOffsets();
18053 Code& code = Code::ZoneHandle(Code::New(pointer_offset_count));
18054#ifdef TARGET_ARCH_IA32
18055 assembler->GetSelfHandle() = code.ptr();
18056#endif
18057 Instructions& instrs = Instructions::ZoneHandle(Instructions::New(
18058 assembler->CodeSize(), assembler->has_monomorphic_entry(),
18059 assembler->should_be_aligned()));
18060
18061 {
18062 // Important: if GC is triggered at any point between Instructions::New
18063 // and here it would write protect instructions object that we are trying
18064 // to fill in.
18065 NoSafepointScope no_safepoint;
18066
18067 // Copy the instructions into the instruction area and apply all fixups.
18068 // Embedded pointers are still in handles at this point.
18069 MemoryRegion region(reinterpret_cast<void*>(instrs.PayloadStart()),
18070 instrs.Size());
18071 assembler->FinalizeInstructions(region);
18072
18073 const auto& pointer_offsets = assembler->GetPointerOffsets();
18074 ASSERT(pointer_offsets.length() == pointer_offset_count);
18075 ASSERT(code.pointer_offsets_length() == pointer_offsets.length());
18076
18077 // Set pointer offsets list in Code object and resolve all handles in
18078 // the instruction stream to raw objects.
18079 for (intptr_t i = 0; i < pointer_offsets.length(); i++) {
18080 intptr_t offset_in_instrs = pointer_offsets[i];
18081 code.SetPointerOffsetAt(i, offset_in_instrs);
18082 uword addr = region.start() + offset_in_instrs;
18083 ASSERT(instrs.PayloadStart() <= addr);
18084 ASSERT((instrs.PayloadStart() + instrs.Size()) > addr);
18085 const Object* object = LoadUnaligned(reinterpret_cast<Object**>(addr));
18086 ASSERT(object->IsOld());
18087 // N.B. The pointer is embedded in the Instructions object, but visited
18088 // through the Code object.
18089 code.StorePointerUnaligned(reinterpret_cast<ObjectPtr*>(addr),
18090 object->ptr(), thread);
18091 }
18092
18093 // Write protect instructions and, if supported by OS, use dual mapping
18094 // for execution.
18095 if (FLAG_write_protect_code) {
18096 uword address = UntaggedObject::ToAddr(instrs.ptr());
18097 VirtualMemory::Protect(reinterpret_cast<void*>(address),
18098 instrs.ptr()->untag()->HeapSize(),
18100 }
18101
18102 // Hook up Code and Instructions objects.
18103 const uword unchecked_offset = assembler->UncheckedEntryOffset();
18104 code.SetActiveInstructions(instrs, unchecked_offset);
18105 code.set_instructions(instrs);
18106 NOT_IN_PRECOMPILED(code.set_unchecked_offset(unchecked_offset));
18107 code.set_is_alive(true);
18108
18109 // Set object pool in Instructions object.
18110 if (!object_pool.IsNull()) {
18111 code.set_object_pool(object_pool.ptr());
18112 }
18113
18114#if defined(DART_PRECOMPILER)
18115 if (stats != nullptr) {
18116 stats->Finalize();
18117 instrs.set_stats(stats);
18118 }
18119#endif
18120
18121 CPU::FlushICache(instrs.PayloadStart(), instrs.Size());
18122 }
18123
18124#if defined(INCLUDE_IL_PRINTER)
18125 code.set_comments(CreateCommentsFrom(assembler));
18126#endif // defined(INCLUDE_IL_PRINTER)
18127
18128#ifndef PRODUCT
18129 code.set_compile_timestamp(OS::GetCurrentMonotonicMicros());
18130 if (assembler->prologue_offset() >= 0) {
18131 code.SetPrologueOffset(assembler->prologue_offset());
18132 } else {
18133 // No prologue was ever entered, optimistically assume nothing was ever
18134 // pushed onto the stack.
18135 code.SetPrologueOffset(assembler->CodeSize());
18136 }
18137#endif
18138 return code.ptr();
18139}
static void FlushICache(uword start, uword size)
ObjectPoolPtr object_pool() const
Definition: object.h:6808
static int64_t GetCurrentMonotonicMicros()
static ObjectPoolPtr NewFromBuilder(const compiler::ObjectPoolBuilder &builder)
Definition: object.cc:15676
static Object & ZoneHandle()
Definition: object.h:419
static uword ToAddr(const UntaggedObject *raw_obj)
Definition: raw_object.h:522
static void Protect(void *address, intptr_t size, Protection mode)
ClipOpAndAA opAA SkRegion region
Definition: SkRecords.h:238
static T LoadUnaligned(const T *ptr)
Definition: unaligned.h:14
dictionary stats
Definition: malisc.py:20
#define NOT_IN_PRECOMPILED(code)
Definition: globals.h:100

◆ FinalizeCodeAndNotify() [1/2]

CodePtr dart::Code::FinalizeCodeAndNotify ( const char *  name,
FlowGraphCompiler compiler,
compiler::Assembler assembler,
PoolAttachment  pool_attachment,
bool  optimized = false,
CodeStatistics stats = nullptr 
)
static

Definition at line 17998 of file object.cc.

18003 {
18004 auto thread = Thread::Current();
18005 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
18006
18007 const auto& code = Code::Handle(
18008 FinalizeCode(compiler, assembler, pool_attachment, optimized, stats));
18009 NotifyCodeObservers(name, code, optimized);
18010 return code.ptr();
18011}
static void NotifyCodeObservers(const Code &code, bool optimized)
Definition: object.cc:18141
static CodePtr FinalizeCode(FlowGraphCompiler *compiler, compiler::Assembler *assembler, PoolAttachment pool_attachment, bool optimized, CodeStatistics *stats)
Definition: object.cc:18018
const char *const name

◆ FinalizeCodeAndNotify() [2/2]

CodePtr dart::Code::FinalizeCodeAndNotify ( const Function function,
FlowGraphCompiler compiler,
compiler::Assembler assembler,
PoolAttachment  pool_attachment,
bool  optimized = false,
CodeStatistics stats = nullptr 
)
static

Definition at line 17983 of file object.cc.

17988 {
17989 auto thread = Thread::Current();
17990 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
17991
17992 const auto& code = Code::Handle(
17993 FinalizeCode(compiler, assembler, pool_attachment, optimized, stats));
17994 NotifyCodeObservers(function, code, optimized);
17995 return code.ptr();
17996}

◆ FindCode()

CodePtr dart::Code::FindCode ( uword  pc,
int64_t  timestamp 
)
static

Definition at line 18188 of file object.cc.

18188 {
18189 class SlowFindCodeVisitor : public ObjectVisitor {
18190 public:
18191 SlowFindCodeVisitor(uword pc, int64_t timestamp)
18192 : pc_(pc), timestamp_(timestamp), result_(Code::null()) {}
18193
18194 void VisitObject(ObjectPtr obj) {
18195 if (!obj->IsCode()) return;
18196 CodePtr code = static_cast<CodePtr>(obj);
18197 if (Code::PayloadStartOf(code) != pc_) return;
18198#if !defined(PRODUCT)
18199 if (code->untag()->compile_timestamp_ != timestamp_) return;
18200#endif
18201 ASSERT(result_ == Code::null());
18202 result_ = code;
18203 }
18204
18205 CodePtr result() const { return result_; }
18206
18207 private:
18208 uword pc_;
18209 int64_t timestamp_;
18210 CodePtr result_;
18211 };
18212
18213 HeapIterationScope iteration(Thread::Current());
18214 SlowFindCodeVisitor visitor(pc, timestamp);
18215 iteration.IterateVMIsolateObjects(&visitor);
18216 iteration.IterateOldObjectsNoImagePages(&visitor);
18217 return visitor.result();
18218}
static uword PayloadStartOf(const CodePtr code)
Definition: object.h:6851
static ObjectPtr null()
Definition: object.h:433
GAsyncResult * result

◆ FindCodeUnsafe()

CodePtr dart::Code::FindCodeUnsafe ( uword  pc)
static

Definition at line 18220 of file object.cc.

18220 {
18221 class FindCodeUnsafeVisitor : public ObjectVisitor {
18222 public:
18223 explicit FindCodeUnsafeVisitor(uword pc) : pc_(pc), result_(Code::null()) {}
18224
18225 void VisitObject(ObjectPtr obj) {
18226 if (obj->IsCode()) {
18227 CodePtr code = static_cast<CodePtr>(obj);
18229 result_ = code;
18230 }
18231 }
18232 }
18233
18234 CodePtr result() { return result_; }
18235
18236 private:
18237 uword pc_;
18238 CodePtr result_;
18239 };
18240
18241 IsolateGroup* group = IsolateGroup::Current();
18242 PageSpace* old_space = group->heap()->old_space();
18243 old_space->MakeIterable();
18244 FindCodeUnsafeVisitor visitor(pc);
18245 old_space->VisitObjectsUnsafe(&visitor);
18247 return visitor.result();
18248}
static IsolateGroup * vm_isolate_group()
Definition: dart.h:69
PageSpace * old_space()
Definition: heap.h:63
Heap * heap() const
Definition: isolate.h:296
static IsolateGroup * Current()
Definition: isolate.h:539
void VisitObjectsUnsafe(ObjectVisitor *visitor) const
Definition: pages.cc:673

◆ function()

FunctionPtr dart::Code::function ( ) const
inline

Definition at line 7130 of file object.h.

7130 {
7132 return Function::RawCast(owner());
7133 }
ObjectPtr owner() const
Definition: object.h:7135
static ObjectPtr RawCast(ObjectPtr obj)
Definition: object.h:325

◆ GetDeoptIdForOsr()

intptr_t dart::Code::GetDeoptIdForOsr ( uword  pc) const

Definition at line 18277 of file object.cc.

18277 {
18278 uword pc_offset = pc - PayloadStart();
18279 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
18280 PcDescriptors::Iterator iter(descriptors, UntaggedPcDescriptors::kOsrEntry);
18281 while (iter.MoveNext()) {
18282 if (iter.PcOffset() == pc_offset) {
18283 return iter.DeoptId();
18284 }
18285 }
18286 return DeoptId::kNone;
18287}
PcDescriptorsPtr pc_descriptors() const
Definition: object.h:6927
static constexpr intptr_t kNone
Definition: deopt_id.h:27

◆ GetDeoptInfoAtPc()

TypedDataPtr dart::Code::GetDeoptInfoAtPc ( uword  pc,
ICData::DeoptReasonId deopt_reason,
uint32_t *  deopt_flags 
) const

Definition at line 17740 of file object.cc.

17742 {
17743#if defined(DART_PRECOMPILED_RUNTIME)
17745 return TypedData::null();
17746#else
17748 const Instructions& instrs = Instructions::Handle(instructions());
17749 uword code_entry = instrs.PayloadStart();
17750 const Array& table = Array::Handle(deopt_info_array());
17751 if (table.IsNull()) {
17753 return TypedData::null();
17754 }
17755 // Linear search for the PC offset matching the target PC.
17757 Smi& offset = Smi::Handle();
17758 Smi& reason_and_flags = Smi::Handle();
17759 TypedData& info = TypedData::Handle();
17760 for (intptr_t i = 0; i < length; ++i) {
17761 DeoptTable::GetEntry(table, i, &offset, &info, &reason_and_flags);
17762 if (pc == (code_entry + offset.Value())) {
17763 ASSERT(!info.IsNull());
17764 *deopt_reason = DeoptTable::ReasonField::decode(reason_and_flags.Value());
17765 *deopt_flags = DeoptTable::FlagsField::decode(reason_and_flags.Value());
17766 return info.ptr();
17767 }
17768 }
17769 *deopt_reason = ICData::kDeoptUnknown;
17770 return TypedData::null();
17771#endif // defined(DART_PRECOMPILED_RUNTIME)
17772}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
SI F table(const skcms_Curve *curve, F v)
static constexpr ICData::DeoptReasonId decode(intptr_t value)
Definition: bitfield.h:171
ArrayPtr deopt_info_array() const
Definition: object.h:6943
bool is_optimized() const
Definition: object.h:6817
static Snapshot::Kind vm_snapshot_kind()
Definition: dart.h:95
static void GetEntry(const Array &table, intptr_t index, Smi *offset, TypedData *info, Smi *reason_and_flags)
static intptr_t GetLength(const Array &table)
size_t length
SeparatedVector2 offset

◆ GetInlinedFunctionsAtInstruction()

void dart::Code::GetInlinedFunctionsAtInstruction ( intptr_t  pc_offset,
GrowableArray< const Function * > *  functions,
GrowableArray< TokenPosition > *  token_positions 
) const

Definition at line 18449 of file object.cc.

18452 {
18453 const CodeSourceMap& map = CodeSourceMap::Handle(code_source_map());
18454 if (map.IsNull()) {
18456 return; // VM stub, allocation stub, or type testing stub.
18457 }
18458 const Array& id_map = Array::Handle(inlined_id_to_function());
18459 const Function& root = Function::Handle(function());
18460 CodeSourceMapReader reader(map, id_map, root);
18461 reader.GetInlinedFunctionsAt(pc_offset, functions, token_positions);
18462}

◆ GetInlinedFunctionsAtReturnAddress()

void dart::Code::GetInlinedFunctionsAtReturnAddress ( intptr_t  pc_offset,
GrowableArray< const Function * > *  functions,
GrowableArray< TokenPosition > *  token_positions 
) const
inline

Definition at line 7085 of file object.h.

7088 {
7089 GetInlinedFunctionsAtInstruction(pc_offset - 1, functions, token_positions);
7090 }
void GetInlinedFunctionsAtInstruction(intptr_t pc_offset, GrowableArray< const Function * > *functions, GrowableArray< TokenPosition > *token_positions) const
Definition: object.cc:18449

◆ GetLocalVarDescriptors()

LocalVarDescriptorsPtr dart::Code::GetLocalVarDescriptors ( ) const

Definition at line 17625 of file object.cc.

17625 {
17626 const LocalVarDescriptors& v = LocalVarDescriptors::Handle(var_descriptors());
17627 if (v.IsNull()) {
17628 ASSERT(!is_optimized());
17629 const Function& f = Function::Handle(function());
17630 ASSERT(!f.IsIrregexpFunction()); // Not yet implemented.
17632 }
17633 return var_descriptors();
17634}
LocalVarDescriptorsPtr var_descriptors() const
Definition: object.h:7096
static void ComputeLocalVarDescriptors(const Code &code)
Definition: compiler.cc:909

◆ GetObjectPool()

ObjectPoolPtr dart::Code::GetObjectPool ( ) const

Definition at line 17723 of file object.cc.

17723 {
17724#if defined(DART_PRECOMPILER) || defined(DART_PRECOMPILED_RUNTIME)
17725 if (FLAG_precompiled_mode) {
17726 return IsolateGroup::Current()->object_store()->global_object_pool();
17727 }
17728#endif
17729 return object_pool();
17730}
ObjectStore * object_store() const
Definition: isolate.h:510

◆ GetPcForDeoptId()

uword dart::Code::GetPcForDeoptId ( intptr_t  deopt_id,
UntaggedPcDescriptors::Kind  kind 
) const

Definition at line 18262 of file object.cc.

18263 {
18264 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
18265 PcDescriptors::Iterator iter(descriptors, kind);
18266 while (iter.MoveNext()) {
18267 if (iter.DeoptId() == deopt_id) {
18268 uword pc_offset = iter.PcOffset();
18269 uword pc = PayloadStart() + pc_offset;
18271 return pc;
18272 }
18273 }
18274 return 0;
18275}

◆ GetPointerOffsetAt()

int32_t dart::Code::GetPointerOffsetAt ( int  index) const
inline

Definition at line 7215 of file object.h.

7215 {
7216 NoSafepointScope no_safepoint;
7217 return *PointerOffsetAddrAt(index);
7218 }

◆ GetPrologueOffset()

intptr_t dart::Code::GetPrologueOffset ( ) const

Definition at line 17934 of file object.cc.

17934 {
17935#if defined(PRODUCT)
17936 UNREACHABLE();
17937 return -1;
17938#else
17939 const Object& object = Object::Handle(untag()->return_address_metadata());
17940 // In the future we may put something other than a smi in
17941 // |return_address_metadata_|.
17942 if (object.IsNull() || !object.IsSmi()) {
17943 return -1;
17944 }
17945 return Smi::Cast(object).Value();
17946#endif
17947}
ObjectPtr return_address_metadata() const
Definition: object.h:7055
bool IsNull() const
Definition: object.h:363
bool IsSmi(int64_t v)
Definition: runtime_api.cc:31

◆ GetStaticCallTargetFunctionAt()

FunctionPtr dart::Code::GetStaticCallTargetFunctionAt ( uword  pc) const

Definition at line 17800 of file object.cc.

17800 {
17801#if defined(DART_PRECOMPILED_RUNTIME)
17802 UNREACHABLE();
17803 return Function::null();
17804#else
17805 const intptr_t i = BinarySearchInSCallTable(pc);
17806 if (i < 0) {
17807 return Function::null();
17808 }
17809 const Array& array = Array::Handle(untag()->static_calls_target_table());
17810 StaticCallsTable entries(array);
17811 return entries[i].Get<kSCallTableFunctionTarget>();
17812#endif
17813}
ArrayPtr static_calls_target_table() const
Definition: object.h:6999
ArrayOfTuplesView< Code::SCallTableEntry, std::tuple< Smi, Object, Function > > StaticCallsTable
Definition: object.h:13546

◆ GetTokenIndexOfPC()

TokenPosition dart::Code::GetTokenIndexOfPC ( uword  pc) const

Definition at line 18250 of file object.cc.

18250 {
18251 uword pc_offset = pc - PayloadStart();
18252 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
18253 PcDescriptors::Iterator iter(descriptors, UntaggedPcDescriptors::kAnyKind);
18254 while (iter.MoveNext()) {
18255 if (iter.PcOffset() == pc_offset) {
18256 return iter.TokenPos();
18257 }
18258 }
18259 return TokenPosition::kNoSource;
18260}

◆ HasBreakpoint()

bool dart::Code::HasBreakpoint ( ) const

Definition at line 17732 of file object.cc.

17732 {
17733#if defined(PRODUCT)
17734 return false;
17735#else
17737#endif
17738}
bool HasBreakpointInCode(const Code &code)
Definition: debugger.cc:438
GroupDebugger * debugger() const
Definition: isolate.h:315

◆ Hash()

uint32_t dart::Code::Hash ( ) const

Definition at line 18295 of file object.cc.

18295 {
18296 // PayloadStart() is a tempting hash as Instructions are not moved by the
18297 // compactor, but Instructions are effectively moved between the process
18298 // creating an AppJIT/AOT snapshot and the process loading the snapshot.
18299 const Object& obj =
18301 if (obj.IsClass()) {
18302 return Class::Cast(obj).Hash();
18303 } else if (obj.IsAbstractType()) {
18304 return AbstractType::Cast(obj).Hash();
18305 } else if (obj.IsFunction()) {
18306 return Function::Cast(obj).Hash();
18307 } else {
18308 // E.g., VM stub.
18309 return 42;
18310 }
18311}
static ObjectPtr UnwrapIfTarget(ObjectPtr obj)
Definition: object.h:6676

◆ HasMonomorphicEntry() [1/2]

bool dart::Code::HasMonomorphicEntry ( ) const
inline

Definition at line 6839 of file object.h.

6839{ return HasMonomorphicEntry(ptr()); }
bool HasMonomorphicEntry() const
Definition: object.h:6839

◆ HasMonomorphicEntry() [2/2]

static bool dart::Code::HasMonomorphicEntry ( const CodePtr  code)
inlinestatic

Definition at line 6840 of file object.h.

6840 {
6841#if defined(DART_PRECOMPILED_RUNTIME)
6842 return code->untag()->entry_point_ !=
6843 code->untag()->monomorphic_entry_point_;
6844#else
6845 return Instructions::HasMonomorphicEntry(InstructionsOf(code));
6846#endif
6847 }

◆ inlined_id_to_function()

ArrayPtr dart::Code::inlined_id_to_function ( ) const

Definition at line 17949 of file object.cc.

17949 {
17950 return untag()->inlined_id_to_function();
17951}

◆ InstanceSize() [1/2]

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

Definition at line 7163 of file object.h.

7163 {
7164 ASSERT(sizeof(UntaggedCode) ==
7166 return 0;
7167 }
static int8_t data[kExtLength]
#define OFFSET_OF_RETURNED_VALUE(type, accessor)
Definition: globals.h:143

◆ InstanceSize() [2/2]

static intptr_t dart::Code::InstanceSize ( intptr_t  len)
inlinestatic

Definition at line 7168 of file object.h.

7168 {
7169 ASSERT(0 <= len && len <= kMaxElements);
7170 return RoundedAllocationSize(sizeof(UntaggedCode) +
7171 (len * kBytesPerElement));
7172 }
static constexpr intptr_t kBytesPerElement
Definition: object.h:7154
static constexpr intptr_t kMaxElements
Definition: object.h:7156
static constexpr intptr_t RoundedAllocationSize(intptr_t size)
Definition: object.h:758

◆ instructions()

InstructionsPtr dart::Code::instructions ( ) const
inline

Definition at line 6774 of file object.h.

6774{ return untag()->instructions(); }

◆ instructions_offset()

static intptr_t dart::Code::instructions_offset ( )
inlinestatic

Definition at line 6779 of file object.h.

6779 {
6780 return OFFSET_OF(UntaggedCode, instructions_);
6781 }

◆ InstructionsOf()

static InstructionsPtr dart::Code::InstructionsOf ( const CodePtr  code)
inlinestatic

Definition at line 6775 of file object.h.

6775 {
6776 return code->untag()->instructions();
6777 }

◆ is_alive()

bool dart::Code::is_alive ( ) const
inline

Definition at line 6830 of file object.h.

6830{ return AliveBit::decode(untag()->state_bits_); }
static DecodeResult decode(std::string path)
Definition: png_codec.cpp:124

◆ is_discarded()

bool dart::Code::is_discarded ( ) const
inline

Definition at line 6833 of file object.h.

6833{ return IsDiscarded(ptr()); }
static bool IsDiscarded(const CodePtr code)
Definition: object.h:6834

◆ is_force_optimized()

bool dart::Code::is_force_optimized ( ) const
inline

Definition at line 6825 of file object.h.

6825 {
6826 return ForceOptimizedBit::decode(untag()->state_bits_);
6827 }

◆ is_optimized()

bool dart::Code::is_optimized ( ) const
inline

Definition at line 6817 of file object.h.

6817 {
6818 return OptimizedBit::decode(untag()->state_bits_);
6819 }

◆ IsAllocationStubCode()

bool dart::Code::IsAllocationStubCode ( ) const

Definition at line 18363 of file object.cc.

18363 {
18364 return OwnerClassId() == kClassCid;
18365}
classid_t OwnerClassId() const
Definition: object.h:7140

◆ IsDisabled() [1/2]

bool dart::Code::IsDisabled ( ) const
inline

Definition at line 7257 of file object.h.

7257{ return IsDisabled(ptr()); }

◆ IsDisabled() [2/2]

static bool dart::Code::IsDisabled ( CodePtr  code)
inlinestatic

Definition at line 7258 of file object.h.

7258 {
7259#if defined(DART_PRECOMPILED_RUNTIME)
7260 UNREACHABLE();
7261 return false;
7262#else
7263 return code->untag()->instructions() !=
7264 code->untag()->active_instructions();
7265#endif
7266 }

◆ IsDiscarded()

static bool dart::Code::IsDiscarded ( const CodePtr  code)
inlinestatic

Definition at line 6834 of file object.h.

6834 {
6835 return DiscardedBit::decode(code->untag()->state_bits_);
6836 }

◆ IsFunctionCode()

bool dart::Code::IsFunctionCode ( ) const

Definition at line 18374 of file object.cc.

18374 {
18375 return OwnerClassId() == kFunctionCid;
18376}

◆ IsOptimized()

static bool dart::Code::IsOptimized ( CodePtr  code)
inlinestatic

Definition at line 6821 of file object.h.

6821 {
6822 return Code::OptimizedBit::decode(code->untag()->state_bits_);
6823 }

◆ IsStubCode()

bool dart::Code::IsStubCode ( ) const

Definition at line 18357 of file object.cc.

18357 {
18358 // We should _not_ unwrap any possible WSRs here, as the null value is never
18359 // wrapped by a WSR.
18360 return owner() == Object::null();
18361}

◆ IsTypeTestStubCode()

bool dart::Code::IsTypeTestStubCode ( ) const

Definition at line 18367 of file object.cc.

18367 {
18368 auto const cid = OwnerClassId();
18369 return cid == kAbstractTypeCid || cid == kTypeCid ||
18370 cid == kFunctionTypeCid || cid == kRecordTypeCid ||
18371 cid == kTypeParameterCid;
18372}
const intptr_t cid

◆ IsUnknownDartCode() [1/2]

bool dart::Code::IsUnknownDartCode ( ) const
inline

Definition at line 7245 of file object.h.

7245{ return IsUnknownDartCode(ptr()); }
bool IsUnknownDartCode() const
Definition: object.h:7245

◆ IsUnknownDartCode() [2/2]

bool dart::Code::IsUnknownDartCode ( CodePtr  code)
static

Definition at line 18378 of file object.cc.

18378 {
18380 (code == StubCode::UnknownDartCode().ptr());
18381}
static bool HasBeenInitialized()
Definition: stub_code.h:41

◆ MonomorphicEntryPoint()

uword dart::Code::MonomorphicEntryPoint ( ) const
inline

Definition at line 6886 of file object.h.

6886 {
6887#if defined(DART_PRECOMPILED_RUNTIME)
6888 return untag()->monomorphic_entry_point_;
6889#else
6891#endif
6892 }
uword MonomorphicEntryPoint() const
Definition: object.h:5746

◆ MonomorphicUncheckedEntryPoint()

uword dart::Code::MonomorphicUncheckedEntryPoint ( ) const
inline

Definition at line 6894 of file object.h.

6894 {
6895#if defined(DART_PRECOMPILED_RUNTIME)
6896 return untag()->monomorphic_unchecked_entry_point_;
6897#else
6898 return MonomorphicEntryPoint() + untag()->unchecked_offset_;
6899#endif
6900 }
uword MonomorphicEntryPoint() const
Definition: object.h:6886

◆ Name()

const char * dart::Code::Name ( ) const

Definition at line 18313 of file object.cc.

18313 {
18314 Zone* zone = Thread::Current()->zone();
18315 if (IsStubCode()) {
18316 // Regular stub.
18317 const char* name = StubCode::NameOfStub(EntryPoint());
18318 if (name == nullptr) {
18319 return "[unknown stub]"; // Not yet recorded.
18320 }
18321 return OS::SCreate(zone, "[Stub] %s", name);
18322 }
18323 const auto& obj =
18325 if (obj.IsClass()) {
18326 // Allocation stub.
18327 return OS::SCreate(zone, "[Stub] Allocate %s",
18328 Class::Cast(obj).ScrubbedNameCString());
18329 } else if (obj.IsAbstractType()) {
18330 // Type test stub.
18331 return OS::SCreate(zone, "[Stub] Type Test %s",
18332 AbstractType::Cast(obj).ToCString());
18333 } else if (obj.IsFunction()) {
18334 // Dart function.
18335 const char* opt = is_optimized() ? "[Optimized]" : "[Unoptimized]";
18336 const char* function_name = Function::Cast(obj).UserVisibleNameCString();
18337 return OS::SCreate(zone, "%s %s", opt, function_name);
18338 } else {
18339 // --no_retain_function_objects etc
18340 return "[unknown code]";
18341 }
18342}
uword EntryPoint() const
Definition: object.h:6864
bool IsStubCode() const
Definition: object.cc:18357
static char * SCreate(Zone *zone, const char *format,...) PRINTF_ATTRIBUTE(2
virtual const char * ToCString() const
Definition: object.h:366
static const char * NameOfStub(uword entry_point)
Definition: stub_code.cc:330
Zone * zone() const
Definition: thread_state.h:37
const char *const function_name

◆ NOT_IN_PRODUCT()

dart::Code::NOT_IN_PRODUCT ( void PrintJSONInlineIntervals(JSONObject *object) const  )

◆ NotifyCodeObservers() [1/3]

void dart::Code::NotifyCodeObservers ( const char *  name,
const Code code,
bool  optimized 
)
static

Definition at line 18171 of file object.cc.

18173 {
18174#if !defined(PRODUCT)
18175 ASSERT(name != nullptr);
18176 ASSERT(!code.IsNull());
18177 ASSERT(!Thread::Current()->OwnsGCSafepoint());
18179 const auto& instrs = Instructions::Handle(code.instructions());
18180 CodeObservers::NotifyAll(name, instrs.PayloadStart(),
18181 code.GetPrologueOffset(), instrs.Size(), optimized,
18182 &code.comments());
18183 }
18184#endif
18185}
static void NotifyAll(const char *name, uword base, uword prologue_offset, uword size, bool optimized, const CodeComments *comments)
static bool AreActive()

◆ NotifyCodeObservers() [2/3]

void dart::Code::NotifyCodeObservers ( const Code code,
bool  optimized 
)
static

Definition at line 18141 of file object.cc.

18141 {
18142#if !defined(PRODUCT)
18143 ASSERT(!Thread::Current()->OwnsGCSafepoint());
18145 if (code.IsFunctionCode()) {
18146 const auto& function = Function::Handle(code.function());
18147 if (!function.IsNull()) {
18148 return NotifyCodeObservers(function, code, optimized);
18149 }
18150 }
18151 NotifyCodeObservers(code.Name(), code, optimized);
18152 }
18153#endif
18154}

◆ NotifyCodeObservers() [3/3]

void dart::Code::NotifyCodeObservers ( const Function function,
const Code code,
bool  optimized 
)
static

Definition at line 18156 of file object.cc.

18158 {
18159#if !defined(PRODUCT)
18160 ASSERT(!function.IsNull());
18161 ASSERT(!Thread::Current()->OwnsGCSafepoint());
18162 // Calling ToLibNamePrefixedQualifiedCString is very expensive,
18163 // try to avoid it.
18165 const char* name = function.ToLibNamePrefixedQualifiedCString();
18166 NotifyCodeObservers(name, code, optimized);
18167 }
18168#endif
18169}

◆ num_variables()

intptr_t dart::Code::num_variables ( ) const

Definition at line 17672 of file object.cc.

17672 {
17673 ASSERT(!FLAG_precompiled_mode);
17674 return Smi::Value(Smi::RawCast(untag()->catch_entry()));
17675}
intptr_t Value() const
Definition: object.h:9990

◆ object_pool()

ObjectPoolPtr dart::Code::object_pool ( ) const
inline

Definition at line 6808 of file object.h.

6808{ return untag()->object_pool(); }

◆ object_pool_offset()

static intptr_t dart::Code::object_pool_offset ( )
inlinestatic

Definition at line 6809 of file object.h.

6809 {
6810 return OFFSET_OF(UntaggedCode, object_pool_);
6811 }

◆ owner()

ObjectPtr dart::Code::owner ( ) const
inline

Definition at line 7135 of file object.h.

7135 {
7137 }
static ObjectPtr Unwrap(ObjectPtr obj)
Definition: object.h:6667

◆ owner_offset()

static intptr_t dart::Code::owner_offset ( )
inlinestatic

Definition at line 7149 of file object.h.

7149{ return OFFSET_OF(UntaggedCode, owner_); }

◆ OwnerClassId()

classid_t dart::Code::OwnerClassId ( ) const
inline

Definition at line 7140 of file object.h.

7140{ return OwnerClassIdOf(ptr()); }
static classid_t OwnerClassIdOf(CodePtr raw)
Definition: object.h:7141

◆ OwnerClassIdOf()

static classid_t dart::Code::OwnerClassIdOf ( CodePtr  raw)
inlinestatic

Definition at line 7141 of file object.h.

7141 {
7142 ObjectPtr owner = WeakSerializationReference::Unwrap(raw->untag()->owner());
7143 if (!owner->IsHeapObject()) {
7144 return RawSmiValue(static_cast<SmiPtr>(owner));
7145 }
7146 return owner->GetClassId();
7147 }
intptr_t GetClassId() const
Definition: raw_object.h:885
intptr_t RawSmiValue(const SmiPtr raw_value)

◆ ParseEntryKind()

bool dart::Code::ParseEntryKind ( const char *  str,
EntryKind out 
)
static

Definition at line 17608 of file object.cc.

17608 {
17609 if (strcmp(str, "Normal") == 0) {
17611 return true;
17612 } else if (strcmp(str, "Unchecked") == 0) {
17613 *out = EntryKind::kUnchecked;
17614 return true;
17615 } else if (strcmp(str, "Monomorphic") == 0) {
17616 *out = EntryKind::kMonomorphic;
17617 return true;
17618 } else if (strcmp(str, "MonomorphicUnchecked") == 0) {
17619 *out = EntryKind::kMonomorphicUnchecked;
17620 return true;
17621 }
17622 return false;
17623}

◆ PayloadSizeOf()

static uword dart::Code::PayloadSizeOf ( const CodePtr  code)
inlinestatic

Definition at line 6904 of file object.h.

6904 {
6905#if defined(DART_PRECOMPILED_RUNTIME)
6906 if (IsUnknownDartCode(code)) return kUwordMax;
6907 return code->untag()->instructions_length_;
6908#else
6910#endif
6911 }
intptr_t Size() const
Definition: object.h:5740
constexpr uword kUwordMax
Definition: globals.h:519

◆ PayloadStart()

uword dart::Code::PayloadStart ( ) const
inline

Definition at line 6850 of file object.h.

6850{ return PayloadStartOf(ptr()); }

◆ PayloadStartOf()

static uword dart::Code::PayloadStartOf ( const CodePtr  code)
inlinestatic

Definition at line 6851 of file object.h.

6851 {
6852#if defined(DART_PRECOMPILED_RUNTIME)
6853 if (IsUnknownDartCode(code)) return 0;
6854 const uword entry_offset = HasMonomorphicEntry(code)
6855 ? Instructions::kPolymorphicEntryOffsetAOT
6856 : 0;
6857 return EntryPointOf(code) - entry_offset;
6858#else
6860#endif
6861 }
uword PayloadStart() const
Definition: object.h:5745

◆ pc_descriptors()

PcDescriptorsPtr dart::Code::pc_descriptors ( ) const
inline

Definition at line 6927 of file object.h.

6927{ return untag()->pc_descriptors(); }

◆ pointer_offsets_length()

intptr_t dart::Code::pointer_offsets_length ( ) const
inline

Definition at line 6813 of file object.h.

6813 {
6814 return PtrOffBits::decode(untag()->state_bits_);
6815 }

◆ QualifiedName()

const char * dart::Code::QualifiedName ( const NameFormattingParams params) const

Definition at line 18344 of file object.cc.

18344 {
18345 Zone* zone = Thread::Current()->zone();
18346 const Object& obj =
18348 if (obj.IsFunction()) {
18349 ZoneTextBuffer printer(zone);
18350 printer.AddString(is_optimized() ? "[Optimized] " : "[Unoptimized] ");
18351 Function::Cast(obj).PrintName(params, &printer);
18352 return printer.buffer();
18353 }
18354 return Name();
18355}
const char * Name() const
Definition: object.cc:18313
const EmbeddedViewParams * params

◆ return_address_metadata()

ObjectPtr dart::Code::return_address_metadata ( ) const
inline

Definition at line 7055 of file object.h.

7055 {
7056#if defined(PRODUCT)
7057 UNREACHABLE();
7058 return nullptr;
7059#else
7060 return untag()->return_address_metadata();
7061#endif
7062 }

◆ set_code_source_map()

void dart::Code::set_code_source_map ( const CodeSourceMap code_source_map) const
inline

Definition at line 6937 of file object.h.

6937 {
6938 ASSERT(code_source_map.IsOld());
6939 untag()->set_code_source_map(code_source_map.ptr());
6940 }

◆ set_compressed_stackmaps()

void dart::Code::set_compressed_stackmaps ( const CompressedStackMaps maps) const

Definition at line 17666 of file object.cc.

17666 {
17667 ASSERT(maps.IsOld());
17668 untag()->set_compressed_stackmaps(maps.ptr());
17669}

◆ set_deopt_info_array()

void dart::Code::set_deopt_info_array ( const Array array) const

Definition at line 17693 of file object.cc.

17693 {
17694#if defined(DART_PRECOMPILED_RUNTIME)
17695 UNREACHABLE();
17696#else
17697 ASSERT(array.IsOld());
17698 untag()->set_deopt_info_array(array.ptr());
17699#endif
17700}

◆ set_exception_handlers()

void dart::Code::set_exception_handlers ( const ExceptionHandlers handlers) const
inline

Definition at line 7119 of file object.h.

7119 {
7120 ASSERT(handlers.IsOld());
7121 untag()->set_exception_handlers(handlers.ptr());
7122 }

◆ set_inlined_id_to_function()

void dart::Code::set_inlined_id_to_function ( const Array value) const

Definition at line 17953 of file object.cc.

17953 {
17954 ASSERT(value.IsOld());
17955 untag()->set_inlined_id_to_function(value.ptr());
17956}
uint8_t value

◆ set_is_alive()

void dart::Code::set_is_alive ( bool  value) const

Definition at line 17658 of file object.cc.

17658 {
17659 set_state_bits(AliveBit::update(value, untag()->state_bits_));
17660}

◆ set_is_discarded()

void dart::Code::set_is_discarded ( bool  value) const

Definition at line 17662 of file object.cc.

17662 {
17663 set_state_bits(DiscardedBit::update(value, untag()->state_bits_));
17664}

◆ set_is_force_optimized()

void dart::Code::set_is_force_optimized ( bool  value) const

Definition at line 17654 of file object.cc.

17654 {
17655 set_state_bits(ForceOptimizedBit::update(value, untag()->state_bits_));
17656}

◆ set_is_optimized()

void dart::Code::set_is_optimized ( bool  value) const

Definition at line 17650 of file object.cc.

17650 {
17651 set_state_bits(OptimizedBit::update(value, untag()->state_bits_));
17652}

◆ set_num_variables()

void dart::Code::set_num_variables ( intptr_t  num_variables) const

Definition at line 17676 of file object.cc.

17676 {
17677 ASSERT(!FLAG_precompiled_mode);
17678 untag()->set_catch_entry(Smi::New(num_variables));
17679}
intptr_t num_variables() const
Definition: object.cc:17672
static SmiPtr New(intptr_t value)
Definition: object.h:10006

◆ set_object_pool()

void dart::Code::set_object_pool ( ObjectPoolPtr  object_pool) const
inline

Definition at line 7268 of file object.h.

7268 {
7269 untag()->set_object_pool(object_pool);
7270 }

◆ set_owner()

void dart::Code::set_owner ( const Object owner) const

Definition at line 17636 of file object.cc.

17636 {
17637#if defined(DEBUG)
17638 const auto& unwrapped_owner =
17640 ASSERT(unwrapped_owner.IsFunction() || unwrapped_owner.IsClass() ||
17641 unwrapped_owner.IsAbstractType());
17642#endif
17643 untag()->set_owner(owner.ptr());
17644}

◆ set_pc_descriptors()

void dart::Code::set_pc_descriptors ( const PcDescriptors descriptors) const
inline

Definition at line 6928 of file object.h.

6928 {
6929 ASSERT(descriptors.IsOld());
6930 untag()->set_pc_descriptors(descriptors.ptr());
6931 }

◆ set_static_calls_target_table()

void dart::Code::set_static_calls_target_table ( const Array value) const

Definition at line 17702 of file object.cc.

17702 {
17703#if defined(DART_PRECOMPILED_RUNTIME)
17704 UNREACHABLE();
17705#else
17706 untag()->set_static_calls_target_table(value.ptr());
17707#endif
17708#if defined(DEBUG)
17709 // Check that the table is sorted by pc offsets.
17710 // FlowGraphCompiler::AddStaticCallTarget adds pc-offsets to the table while
17711 // emitting assembly. This guarantees that every succeeding pc-offset is
17712 // larger than the previously added one.
17713 StaticCallsTable entries(value);
17714 const intptr_t count = entries.Length();
17715 for (intptr_t i = 0; i < count - 1; ++i) {
17716 auto left = Smi::Value(entries[i].Get<kSCallTableKindAndOffset>());
17717 auto right = Smi::Value(entries[i + 1].Get<kSCallTableKindAndOffset>());
17719 }
17720#endif // DEBUG
17721}
int count
Definition: FontMgrTest.cpp:50

◆ set_var_descriptors()

void dart::Code::set_var_descriptors ( const LocalVarDescriptors value) const
inline

Definition at line 7104 of file object.h.

7104 {
7105#if defined(PRODUCT)
7106 UNREACHABLE();
7107#else
7108 ASSERT(value.IsOld());
7109 untag()->set_var_descriptors(value.ptr());
7110#endif
7111 }

◆ SetPrologueOffset()

void dart::Code::SetPrologueOffset ( intptr_t  offset) const

Definition at line 17925 of file object.cc.

17925 {
17926#if defined(PRODUCT)
17927 UNREACHABLE();
17928#else
17929 ASSERT(offset >= 0);
17930 untag()->set_return_address_metadata(Smi::New(offset));
17931#endif
17932}

◆ SetStaticCallTargetCodeAt()

void dart::Code::SetStaticCallTargetCodeAt ( uword  pc,
const Code code 
) const

Definition at line 17815 of file object.cc.

17815 {
17816#if defined(DART_PRECOMPILED_RUNTIME)
17817 UNREACHABLE();
17818#else
17819 const intptr_t i = BinarySearchInSCallTable(pc);
17820 ASSERT(i >= 0);
17821 const Array& array = Array::Handle(untag()->static_calls_target_table());
17822 StaticCallsTable entries(array);
17823 ASSERT(code.IsNull() ||
17824 (code.function() == entries[i].Get<kSCallTableFunctionTarget>()));
17825 return entries[i].Set<kSCallTableCodeOrTypeTarget>(code);
17826#endif
17827}

◆ SetStubCallTargetCodeAt()

void dart::Code::SetStubCallTargetCodeAt ( uword  pc,
const Code code 
) const

Definition at line 17829 of file object.cc.

17829 {
17830#if defined(DART_PRECOMPILED_RUNTIME)
17831 UNREACHABLE();
17832#else
17833 const intptr_t i = BinarySearchInSCallTable(pc);
17834 ASSERT(i >= 0);
17835 const Array& array = Array::Handle(untag()->static_calls_target_table());
17836 StaticCallsTable entries(array);
17837#if defined(DEBUG)
17838 if (entries[i].Get<kSCallTableFunctionTarget>() == Function::null()) {
17839 ASSERT(!code.IsNull() && Object::Handle(code.owner()).IsClass());
17840 } else {
17841 ASSERT(code.IsNull() ||
17842 (code.function() == entries[i].Get<kSCallTableFunctionTarget>()));
17843 }
17844#endif
17845 return entries[i].Set<kSCallTableCodeOrTypeTarget>(code);
17846#endif
17847}

◆ Size()

uword dart::Code::Size ( ) const
inline

Definition at line 6903 of file object.h.

6903{ return PayloadSizeOf(ptr()); }
static uword PayloadSizeOf(const CodePtr code)
Definition: object.h:6904

◆ static_calls_target_table()

ArrayPtr dart::Code::static_calls_target_table ( ) const
inline

Definition at line 6999 of file object.h.

6999 {
7000#if defined(DART_PRECOMPILED_RUNTIME)
7001 UNREACHABLE();
7002 return nullptr;
7003#else
7004 return untag()->static_calls_target_table();
7005#endif
7006 }

◆ UncheckedEntryPoint()

uword dart::Code::UncheckedEntryPoint ( ) const
inline

Definition at line 6878 of file object.h.

6878 {
6879#if defined(DART_PRECOMPILED_RUNTIME)
6880 return untag()->unchecked_entry_point_;
6881#else
6882 return EntryPoint() + untag()->unchecked_offset_;
6883#endif
6884 }

◆ UncheckedEntryPointOf()

static uword dart::Code::UncheckedEntryPointOf ( const CodePtr  code)
inlinestatic

Definition at line 6873 of file object.h.

6873 {
6874 return code->untag()->unchecked_entry_point_;
6875 }

◆ var_descriptors()

LocalVarDescriptorsPtr dart::Code::var_descriptors ( ) const
inline

Definition at line 7096 of file object.h.

7096 {
7097#if defined(PRODUCT)
7098 UNREACHABLE();
7099 return nullptr;
7100#else
7101 return untag()->var_descriptors();
7102#endif
7103 }

Friends And Related Function Documentation

◆ CallSiteResetter

friend class CallSiteResetter
friend

Definition at line 7397 of file object.h.

◆ Class

friend class Class
friend

Definition at line 7382 of file object.h.

◆ CodeDeserializationCluster

friend class CodeDeserializationCluster
friend

Definition at line 7388 of file object.h.

◆ CodeKeyValueTrait

friend class CodeKeyValueTrait
friend

Definition at line 7398 of file object.h.

◆ CodePatcher

friend class CodePatcher
friend

Definition at line 7392 of file object.h.

◆ CodeSerializationCluster

friend class CodeSerializationCluster
friend

Definition at line 7387 of file object.h.

◆ CodeTestHelper

friend class CodeTestHelper
friend

Definition at line 7383 of file object.h.

◆ Deserializer

friend class Deserializer
friend

Definition at line 7389 of file object.h.

◆ DumpStackFrame

void DumpStackFrame ( intptr_t  frame_index,
uword  pc,
uword  fp 
)
friend

Definition at line 77 of file profiler.cc.

77 {
78 uword start = 0;
79 // The pc for all frames except the top frame is a return address, which can
80 // belong to a different inlining interval than the call. Subtract one to get
81 // the symbolization for the call.
82 uword lookup_pc = frame_index == 0 ? pc : pc - 1;
83 if (auto const name =
84 NativeSymbolResolver::LookupSymbolName(lookup_pc, &start)) {
85 DumpStackFrame(pc, fp, name, pc - start);
87 return;
88 }
89
90 const char* dso_name;
91 uword dso_base;
92 if (NativeSymbolResolver::LookupSharedObject(pc, &dso_base, &dso_name)) {
93 DumpStackFrame(pc, fp, dso_name, pc - dso_base);
95 return;
96 }
97
98#if !defined(DART_PRECOMPILED_RUNTIME)
99 // This relies on heap iteration, which might fail if we're crashing because
100 // of heap corruption. A nested crash symbolizing a JIT frame will prevent
101 // seeing all caller frames, so only do this when we aren't able to use the
102 // safer StackFrameIterator.
103 Thread* thread = Thread::Current();
104 bool symbolize_jit_code =
105 (thread != nullptr) &&
106 (thread->execution_state() != Thread::kThreadInNative) &&
107 (thread->execution_state() != Thread::kThreadInVM);
108 if (symbolize_jit_code) {
109 Code result;
110 result = Code::FindCodeUnsafe(lookup_pc);
111 if (!result.IsNull()) {
113 pc, fp,
114 result.QualifiedName(NameFormattingParams(Object::kInternalName)),
115 pc - result.PayloadStart());
116 return;
117 }
118 }
119#endif
120
121 OS::PrintErr(" pc 0x%" Pp " fp 0x%" Pp " Unknown symbol\n", pc, fp);
122}
friend void DumpStackFrame(intptr_t frame_index, uword pc, uword fp)
Definition: profiler.cc:77
static CodePtr FindCodeUnsafe(uword pc)
Definition: object.cc:18220
static bool LookupSharedObject(uword pc, uword *dso_base=nullptr, const char **dso_name=nullptr)
static const char * LookupSymbolName(uword pc, uword *start)
static void FreeSymbolName(const char *name)
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
@ kInternalName
Definition: object.h:622
friend class Thread
Definition: object.h:1025
@ kThreadInNative
Definition: thread.h:1036
const uint32_t fp
#define Pp
Definition: globals.h:425

◆ FunctionSerializationCluster

friend class FunctionSerializationCluster
friend

Definition at line 7386 of file object.h.

◆ InstanceCall

friend class InstanceCall
friend

Definition at line 7399 of file object.h.

◆ MegamorphicCacheTable

friend class MegamorphicCacheTable
friend

Definition at line 7391 of file object.h.

◆ Precompiler

friend class Precompiler
friend

Definition at line 7385 of file object.h.

◆ ProgramVisitor

friend class ProgramVisitor
friend

Definition at line 7393 of file object.h.

◆ RelocatorTestHelper

friend struct RelocatorTestHelper
friend

Definition at line 7277 of file object.h.

◆ StaticCall

friend class StaticCall
friend

Definition at line 7400 of file object.h.

◆ StubCode

StubCode
friend

Definition at line 7384 of file object.h.

◆ UntaggedCode

friend class UntaggedCode
friend

Definition at line 7276 of file object.h.

◆ UntaggedFunction

friend class UntaggedFunction
friend

Definition at line 7396 of file object.h.

◆ UntaggedObject

friend class UntaggedObject
friend

Definition at line 7275 of file object.h.

Member Data Documentation

◆ kBytesPerElement

constexpr intptr_t dart::Code::kBytesPerElement
staticconstexpr
Initial value:
=
sizeof(reinterpret_cast<UntaggedCode*>(kOffsetOfPtr)->data()[0])
const intptr_t kOffsetOfPtr
Definition: globals.h:136

Definition at line 7154 of file object.h.

◆ kMaxElements

constexpr intptr_t dart::Code::kMaxElements = kSmiMax / kBytesPerElement
staticconstexpr

Definition at line 7156 of file object.h.


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