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

Member Typedef Documentation

◆ EntryKind

Definition at line 6761 of file object.h.

Member Enumeration Documentation

◆ CallEntryPoint

Enumerator
kDefaultEntry 
kUncheckedEntry 

Definition at line 6948 of file object.h.

6948 {
6951 };
@ kDefaultEntry
Definition object.h:6949
@ kUncheckedEntry
Definition object.h:6950

◆ CallKind

Enumerator
kPcRelativeCall 
kPcRelativeTTSCall 
kPcRelativeTailCall 
kCallViaCode 

Definition at line 6941 of file object.h.

6941 {
6942 kPcRelativeCall = 1,
6945 kCallViaCode = 4,
6946 };
@ kPcRelativeCall
Definition object.h:6942
@ kPcRelativeTTSCall
Definition object.h:6943
@ kCallViaCode
Definition object.h:6945
@ kPcRelativeTailCall
Definition object.h:6944

◆ PoolAttachment

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

Definition at line 6960 of file object.h.

◆ SCallTableEntry

Enumerator
kSCallTableKindAndOffset 
kSCallTableCodeOrTypeTarget 
kSCallTableFunctionTarget 
kSCallTableEntryLength 

Definition at line 6953 of file object.h.

6953 {
6958 };
@ kSCallTableEntryLength
Definition object.h:6957
@ kSCallTableFunctionTarget
Definition object.h:6956
@ kSCallTableCodeOrTypeTarget
Definition object.h:6955
@ kSCallTableKindAndOffset
Definition object.h:6954

Member Function Documentation

◆ active_instructions()

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

Definition at line 6737 of file object.h.

6737 {
6738#if defined(DART_PRECOMPILED_RUNTIME)
6739 UNREACHABLE();
6740 return nullptr;
6741#else
6742 return untag()->active_instructions();
6743#endif
6744 }
#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)

◆ active_instructions_offset()

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

Definition at line 6756 of file object.h.

6756 {
6757 return OFFSET_OF(UntaggedCode, active_instructions_);
6758 }
friend class UntaggedCode
Definition object.h:7247
#define OFFSET_OF(type, field)
Definition globals.h:138

◆ code_source_map()

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

Definition at line 6906 of file object.h.

6906 {
6907 return untag()->code_source_map();
6908 }

◆ compile_timestamp()

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

Definition at line 7201 of file object.h.

7201 {
7202#if defined(PRODUCT)
7203 return 0;
7204#else
7205 return untag()->compile_timestamp_;
7206#endif
7207 }

◆ compressed_stackmaps()

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

Definition at line 6936 of file object.h.

6936 {
6937 return untag()->compressed_stackmaps();
6938 }

◆ ContainsInstructionAt() [1/2]

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

Definition at line 6893 of file object.h.

6893 {
6894 return UntaggedCode::ContainsPC(code, pc);
6895 }

◆ ContainsInstructionAt() [2/2]

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

Definition at line 6888 of file object.h.

6888 {
6889 return ContainsInstructionAt(ptr(), addr);
6890 }
bool ContainsInstructionAt(uword addr) const
Definition object.h:6888
ObjectPtr ptr() const
Definition object.h:332

◆ deopt_info_array()

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

Definition at line 6916 of file object.h.

6916 {
6917#if defined(DART_PRECOMPILED_RUNTIME)
6918 UNREACHABLE();
6919 return nullptr;
6920#else
6921 return untag()->deopt_info_array();
6922#endif
6923 }

◆ DisableDartCode()

void dart::Code::DisableDartCode ( ) const

Definition at line 18433 of file object.cc.

18433 {
18434 GcSafepointOperationScope safepoint(Thread::Current());
18437 const Code& new_code = StubCode::FixCallersTarget();
18438 SetActiveInstructions(Instructions::Handle(new_code.instructions()),
18439 new_code.UncheckedEntryPointOffset());
18440}
bool IsFunctionCode() const
Definition object.cc:18424
InstructionsPtr active_instructions() const
Definition object.h:6737
InstructionsPtr instructions() const
Definition object.h:6747
static Object & Handle()
Definition object.h:407
static Thread * Current()
Definition thread.h:361
#define ASSERT(E)

◆ DisableStubCode()

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

Definition at line 18442 of file object.cc.

18442 {
18443 GcSafepointOperationScope safepoint(Thread::Current());
18446 const Code& new_code = is_cls_parameterized
18447 ? StubCode::FixParameterizedAllocationStubTarget()
18448 : StubCode::FixAllocationStubTarget();
18449 SetActiveInstructions(Instructions::Handle(new_code.instructions()),
18450 new_code.UncheckedEntryPointOffset());
18451}
friend class StubCode
Definition object.h:7355
bool IsAllocationStubCode() const
Definition object.cc:18413

◆ Disassemble()

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

Definition at line 17899 of file object.cc.

17899 {
17900#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)
17901 if (!FLAG_support_disassembler) {
17902 return;
17903 }
17904 const uword start = PayloadStart();
17905 if (formatter == nullptr) {
17907 } else {
17908 Disassembler::Disassemble(start, start + Size(), formatter, *this);
17909 }
17910#endif // !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)
17911}
uword Size() const
Definition object.h:6876
uword PayloadStart() const
Definition object.h:6823
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 18527 of file object.cc.

18527 {
18528 const CodeSourceMap& map = CodeSourceMap::Handle(code_source_map());
18529 if (map.IsNull()) {
18530 // Stub code.
18531 return;
18532 }
18533 const Array& id_map = Array::Handle(inlined_id_to_function());
18534 const Function& root = Function::Handle(function());
18535 CodeSourceMapReader reader(map, id_map, root);
18536 reader.DumpInlineIntervals(PayloadStart());
18537}
FunctionPtr function() const
Definition object.h:7101
CodeSourceMapPtr code_source_map() const
Definition object.h:6906
ArrayPtr inlined_id_to_function() const
Definition object.cc:17999
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 18539 of file object.cc.

18539 {
18540 const CodeSourceMap& map = CodeSourceMap::Handle(code_source_map());
18541 if (map.IsNull()) {
18542 // Stub code.
18543 return;
18544 }
18545 const Array& id_map = Array::Handle(inlined_id_to_function());
18546 const Function& root = Function::Handle(function());
18547 CodeSourceMapReader reader(map, id_map, root);
18548 reader.DumpSourcePositions(relative_addresses ? 0 : PayloadStart());
18549}

◆ Enable()

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

Definition at line 7223 of file object.h.

7223 {
7224 if (!IsDisabled()) return;
7225 ResetActiveInstructions();
7226 }
bool IsDisabled() const
Definition object.h:7228

◆ entry_point_offset()

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

Definition at line 6766 of file object.h.

6766 {
6767 switch (kind) {
6768 case EntryKind::kNormal:
6769 return OFFSET_OF(UntaggedCode, entry_point_);
6770 case EntryKind::kUnchecked:
6771 return OFFSET_OF(UntaggedCode, unchecked_entry_point_);
6772 case EntryKind::kMonomorphic:
6773 return OFFSET_OF(UntaggedCode, monomorphic_entry_point_);
6774 case EntryKind::kMonomorphicUnchecked:
6775 return OFFSET_OF(UntaggedCode, monomorphic_unchecked_entry_point_);
6776 default:
6777 UNREACHABLE();
6778 }
6779 }

◆ EntryKindToCString()

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

Definition at line 17642 of file object.cc.

17642 {
17643 switch (kind) {
17644 case EntryKind::kNormal:
17645 return "Normal";
17646 case EntryKind::kUnchecked:
17647 return "Unchecked";
17648 case EntryKind::kMonomorphic:
17649 return "Monomorphic";
17650 case EntryKind::kMonomorphicUnchecked:
17651 return "MonomorphicUnchecked";
17652 default:
17653 UNREACHABLE();
17654 return nullptr;
17655 }
17656}

◆ EntryPoint()

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

Definition at line 6837 of file object.h.

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

◆ EntryPointOf()

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

Definition at line 6838 of file object.h.

6838 {
6839#if defined(DART_PRECOMPILED_RUNTIME)
6840 return code->untag()->entry_point_;
6841#else
6843#endif
6844 }
static InstructionsPtr InstructionsOf(const CodePtr code)
Definition object.h:6748
uword EntryPoint() const
Definition object.h:5718

◆ exception_handlers()

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

Definition at line 7087 of file object.h.

7087 {
7088 return untag()->exception_handlers();
7089 }

◆ FinalizeCode()

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

Definition at line 18068 of file object.cc.

18072 {
18073 auto thread = Thread::Current();
18074 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
18075
18076 ASSERT(assembler != nullptr);
18077 ObjectPool& object_pool = ObjectPool::Handle();
18078
18079 if (pool_attachment == PoolAttachment::kAttachPool) {
18080 if (assembler->HasObjectPoolBuilder()) {
18081 object_pool =
18082 ObjectPool::NewFromBuilder(assembler->object_pool_builder());
18083 } else {
18084 object_pool = ObjectPool::empty_object_pool().ptr();
18085 }
18086 } else {
18087#if defined(DART_PRECOMPILER)
18088 if (assembler->HasObjectPoolBuilder() &&
18089 assembler->object_pool_builder().HasParent()) {
18090 // We are not going to write this pool into snapshot, but we will use
18091 // it to emit references from this code object to other objects in the
18092 // snapshot that it uses.
18093 object_pool =
18094 ObjectPool::NewFromBuilder(assembler->object_pool_builder());
18095 }
18096#endif // defined(DART_PRECOMPILER)
18097 }
18098
18099 // Allocate the Code and Instructions objects. Code is allocated first
18100 // because a GC during allocation of the code will leave the instruction
18101 // pages read-only.
18102 intptr_t pointer_offset_count = assembler->CountPointerOffsets();
18103 Code& code = Code::ZoneHandle(Code::New(pointer_offset_count));
18104#ifdef TARGET_ARCH_IA32
18105 assembler->GetSelfHandle() = code.ptr();
18106#endif
18107 Instructions& instrs = Instructions::ZoneHandle(Instructions::New(
18108 assembler->CodeSize(), assembler->has_monomorphic_entry(),
18109 assembler->should_be_aligned()));
18110
18111 {
18112 // Important: if GC is triggered at any point between Instructions::New
18113 // and here it would write protect instructions object that we are trying
18114 // to fill in.
18115 NoSafepointScope no_safepoint;
18116
18117 // Copy the instructions into the instruction area and apply all fixups.
18118 // Embedded pointers are still in handles at this point.
18119 MemoryRegion region(reinterpret_cast<void*>(instrs.PayloadStart()),
18120 instrs.Size());
18121 assembler->FinalizeInstructions(region);
18122
18123 const auto& pointer_offsets = assembler->GetPointerOffsets();
18124 ASSERT(pointer_offsets.length() == pointer_offset_count);
18125 ASSERT(code.pointer_offsets_length() == pointer_offsets.length());
18126
18127 // Set pointer offsets list in Code object and resolve all handles in
18128 // the instruction stream to raw objects.
18129 for (intptr_t i = 0; i < pointer_offsets.length(); i++) {
18130 intptr_t offset_in_instrs = pointer_offsets[i];
18131 code.SetPointerOffsetAt(i, offset_in_instrs);
18132 uword addr = region.start() + offset_in_instrs;
18133 ASSERT(instrs.PayloadStart() <= addr);
18134 ASSERT((instrs.PayloadStart() + instrs.Size()) > addr);
18135 const Object* object = LoadUnaligned(reinterpret_cast<Object**>(addr));
18136 ASSERT(object->IsOld());
18137 // N.B. The pointer is embedded in the Instructions object, but visited
18138 // through the Code object.
18139 code.StorePointerUnaligned(reinterpret_cast<ObjectPtr*>(addr),
18140 object->ptr(), thread);
18141 }
18142
18143 // Write protect instructions and, if supported by OS, use dual mapping
18144 // for execution.
18145 if (FLAG_write_protect_code) {
18146 uword address = UntaggedObject::ToAddr(instrs.ptr());
18147 VirtualMemory::Protect(reinterpret_cast<void*>(address),
18148 instrs.ptr()->untag()->HeapSize(),
18150 }
18151
18152 // Hook up Code and Instructions objects.
18153 const uword unchecked_offset = assembler->UncheckedEntryOffset();
18154 code.SetActiveInstructions(instrs, unchecked_offset);
18155 code.set_instructions(instrs);
18156 NOT_IN_PRECOMPILED(code.set_unchecked_offset(unchecked_offset));
18157 code.set_is_alive(true);
18158
18159 // Set object pool in Instructions object.
18160 if (!object_pool.IsNull()) {
18161 code.set_object_pool(object_pool.ptr());
18162 }
18163
18164#if defined(DART_PRECOMPILER)
18165 if (stats != nullptr) {
18166 stats->Finalize();
18167 instrs.set_stats(stats);
18168 }
18169#endif
18170
18171 CPU::FlushICache(instrs.PayloadStart(), instrs.Size());
18172 }
18173
18174#if defined(INCLUDE_IL_PRINTER)
18175 code.set_comments(CreateCommentsFrom(assembler));
18176#endif // defined(INCLUDE_IL_PRINTER)
18177
18178#ifndef PRODUCT
18179 code.set_compile_timestamp(OS::GetCurrentMonotonicMicros());
18180 if (assembler->prologue_offset() >= 0) {
18181 code.SetPrologueOffset(assembler->prologue_offset());
18182 } else {
18183 // No prologue was ever entered, optimistically assume nothing was ever
18184 // pushed onto the stack.
18185 code.SetPrologueOffset(assembler->CodeSize());
18186 }
18187#endif
18188 return code.ptr();
18189}
static void FlushICache(uword start, uword size)
ObjectPoolPtr object_pool() const
Definition object.h:6781
static int64_t GetCurrentMonotonicMicros()
static ObjectPoolPtr NewFromBuilder(const compiler::ObjectPoolBuilder &builder)
Definition object.cc:15723
static Object & ZoneHandle()
Definition object.h:419
static uword ToAddr(const UntaggedObject *raw_obj)
Definition raw_object.h:501
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
dict 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 18048 of file object.cc.

18053 {
18054 auto thread = Thread::Current();
18055 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
18056
18057 const auto& code = Code::Handle(
18058 FinalizeCode(compiler, assembler, pool_attachment, optimized, stats));
18059 NotifyCodeObservers(name, code, optimized);
18060 return code.ptr();
18061}
static void NotifyCodeObservers(const Code &code, bool optimized)
Definition object.cc:18191
static CodePtr FinalizeCode(FlowGraphCompiler *compiler, compiler::Assembler *assembler, PoolAttachment pool_attachment, bool optimized, CodeStatistics *stats)
Definition object.cc:18068
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 18033 of file object.cc.

18038 {
18039 auto thread = Thread::Current();
18040 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadWriter());
18041
18042 const auto& code = Code::Handle(
18043 FinalizeCode(compiler, assembler, pool_attachment, optimized, stats));
18044 NotifyCodeObservers(function, code, optimized);
18045 return code.ptr();
18046}

◆ FindCode()

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

Definition at line 18238 of file object.cc.

18238 {
18239 class SlowFindCodeVisitor : public ObjectVisitor {
18240 public:
18241 SlowFindCodeVisitor(uword pc, int64_t timestamp)
18242 : pc_(pc), timestamp_(timestamp), result_(Code::null()) {}
18243
18244 void VisitObject(ObjectPtr obj) {
18245 if (!obj->IsCode()) return;
18246 CodePtr code = static_cast<CodePtr>(obj);
18247 if (Code::PayloadStartOf(code) != pc_) return;
18248#if !defined(PRODUCT)
18249 if (code->untag()->compile_timestamp_ != timestamp_) return;
18250#endif
18251 ASSERT(result_ == Code::null());
18252 result_ = code;
18253 }
18254
18255 CodePtr result() const { return result_; }
18256
18257 private:
18258 uword pc_;
18259 int64_t timestamp_;
18260 CodePtr result_;
18261 };
18262
18263 HeapIterationScope iteration(Thread::Current());
18264 SlowFindCodeVisitor visitor(pc, timestamp);
18265 iteration.IterateVMIsolateObjects(&visitor);
18266 iteration.IterateOldObjectsNoImagePages(&visitor);
18267 return visitor.result();
18268}
GAsyncResult * result

◆ FindCodeUnsafe()

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

Definition at line 18270 of file object.cc.

18270 {
18271 class FindCodeUnsafeVisitor : public ObjectVisitor {
18272 public:
18273 explicit FindCodeUnsafeVisitor(uword pc) : pc_(pc), result_(Code::null()) {}
18274
18275 void VisitObject(ObjectPtr obj) {
18276 if (obj->IsCode()) {
18277 CodePtr code = static_cast<CodePtr>(obj);
18278 if (Code::ContainsInstructionAt(code, pc_)) {
18279 result_ = code;
18280 }
18281 }
18282 }
18283
18284 CodePtr result() { return result_; }
18285
18286 private:
18287 uword pc_;
18288 CodePtr result_;
18289 };
18290
18291 IsolateGroup* group = IsolateGroup::Current();
18292 PageSpace* old_space = group->heap()->old_space();
18293 old_space->MakeIterable();
18294 FindCodeUnsafeVisitor visitor(pc);
18295 old_space->VisitObjectsUnsafe(&visitor);
18297 return visitor.result();
18298}
static IsolateGroup * vm_isolate_group()
Definition dart.h:69
PageSpace * old_space()
Definition heap.h:63
Heap * heap() const
Definition isolate.h:295
static IsolateGroup * Current()
Definition isolate.h:534
void VisitObjectsUnsafe(ObjectVisitor *visitor) const
Definition pages.cc:667

◆ function()

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

Definition at line 7101 of file object.h.

7101 {
7103 return Function::RawCast(owner());
7104 }
ObjectPtr owner() const
Definition object.h:7106
static ObjectPtr RawCast(ObjectPtr obj)
Definition object.h:325

◆ GetDeoptIdForOsr()

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

Definition at line 18327 of file object.cc.

18327 {
18328 uword pc_offset = pc - PayloadStart();
18329 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
18330 PcDescriptors::Iterator iter(descriptors, UntaggedPcDescriptors::kOsrEntry);
18331 while (iter.MoveNext()) {
18332 if (iter.PcOffset() == pc_offset) {
18333 return iter.DeoptId();
18334 }
18335 }
18336 return DeoptId::kNone;
18337}
PcDescriptorsPtr pc_descriptors() const
Definition object.h:6900
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 17790 of file object.cc.

17792 {
17793#if defined(DART_PRECOMPILED_RUNTIME)
17795 return TypedData::null();
17796#else
17798 const Instructions& instrs = Instructions::Handle(instructions());
17799 uword code_entry = instrs.PayloadStart();
17800 const Array& table = Array::Handle(deopt_info_array());
17801 if (table.IsNull()) {
17803 return TypedData::null();
17804 }
17805 // Linear search for the PC offset matching the target PC.
17807 Smi& offset = Smi::Handle();
17808 Smi& reason_and_flags = Smi::Handle();
17809 TypedData& info = TypedData::Handle();
17810 for (intptr_t i = 0; i < length; ++i) {
17811 DeoptTable::GetEntry(table, i, &offset, &info, &reason_and_flags);
17812 if (pc == (code_entry + offset.Value())) {
17813 ASSERT(!info.IsNull());
17814 *deopt_reason = DeoptTable::ReasonField::decode(reason_and_flags.Value());
17815 *deopt_flags = DeoptTable::FlagsField::decode(reason_and_flags.Value());
17816 return info.ptr();
17817 }
17818 }
17819 *deopt_reason = ICData::kDeoptUnknown;
17820 return TypedData::null();
17821#endif // defined(DART_PRECOMPILED_RUNTIME)
17822}
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:173
ArrayPtr deopt_info_array() const
Definition object.h:6916
bool is_optimized() const
Definition object.h:6790
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)
static ObjectPtr null()
Definition object.h:433
size_t length
Point offset

◆ GetInlinedFunctionsAtInstruction()

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

Definition at line 18499 of file object.cc.

18502 {
18503 const CodeSourceMap& map = CodeSourceMap::Handle(code_source_map());
18504 if (map.IsNull()) {
18506 return; // VM stub, allocation stub, or type testing stub.
18507 }
18508 const Array& id_map = Array::Handle(inlined_id_to_function());
18509 const Function& root = Function::Handle(function());
18510 CodeSourceMapReader reader(map, id_map, root);
18511 reader.GetInlinedFunctionsAt(pc_offset, functions, token_positions);
18512}

◆ GetInlinedFunctionsAtReturnAddress()

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

Definition at line 7056 of file object.h.

7059 {
7060 GetInlinedFunctionsAtInstruction(pc_offset - 1, functions, token_positions);
7061 }
void GetInlinedFunctionsAtInstruction(intptr_t pc_offset, GrowableArray< const Function * > *functions, GrowableArray< TokenPosition > *token_positions) const
Definition object.cc:18499

◆ GetLocalVarDescriptors()

LocalVarDescriptorsPtr dart::Code::GetLocalVarDescriptors ( ) const

Definition at line 17675 of file object.cc.

17675 {
17676 const LocalVarDescriptors& v = LocalVarDescriptors::Handle(var_descriptors());
17677 if (v.IsNull()) {
17678 ASSERT(!is_optimized());
17679 const Function& f = Function::Handle(function());
17680 ASSERT(!f.IsIrregexpFunction()); // Not yet implemented.
17682 }
17683 return var_descriptors();
17684}
LocalVarDescriptorsPtr var_descriptors() const
Definition object.h:7067
static void ComputeLocalVarDescriptors(const Code &code)
Definition compiler.cc:910

◆ GetObjectPool()

ObjectPoolPtr dart::Code::GetObjectPool ( ) const

Definition at line 17773 of file object.cc.

17773 {
17774#if defined(DART_PRECOMPILER) || defined(DART_PRECOMPILED_RUNTIME)
17775 if (FLAG_precompiled_mode) {
17776 return IsolateGroup::Current()->object_store()->global_object_pool();
17777 }
17778#endif
17779 return object_pool();
17780}
ObjectStore * object_store() const
Definition isolate.h:505

◆ GetPcForDeoptId()

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

Definition at line 18312 of file object.cc.

18313 {
18314 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
18315 PcDescriptors::Iterator iter(descriptors, kind);
18316 while (iter.MoveNext()) {
18317 if (iter.DeoptId() == deopt_id) {
18318 uword pc_offset = iter.PcOffset();
18319 uword pc = PayloadStart() + pc_offset;
18321 return pc;
18322 }
18323 }
18324 return 0;
18325}

◆ GetPointerOffsetAt()

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

Definition at line 7186 of file object.h.

7186 {
7187 NoSafepointScope no_safepoint;
7188 return *PointerOffsetAddrAt(index);
7189 }

◆ GetPrologueOffset()

intptr_t dart::Code::GetPrologueOffset ( ) const

Definition at line 17984 of file object.cc.

17984 {
17985#if defined(PRODUCT)
17986 UNREACHABLE();
17987 return -1;
17988#else
17989 const Object& object = Object::Handle(untag()->return_address_metadata());
17990 // In the future we may put something other than a smi in
17991 // |return_address_metadata_|.
17992 if (object.IsNull() || !object.IsSmi()) {
17993 return -1;
17994 }
17995 return Smi::Cast(object).Value();
17996#endif
17997}
ObjectPtr return_address_metadata() const
Definition object.h:7026
bool IsNull() const
Definition object.h:363
bool IsSmi(int64_t v)

◆ GetStaticCallTargetFunctionAt()

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

Definition at line 17850 of file object.cc.

17850 {
17851#if defined(DART_PRECOMPILED_RUNTIME)
17852 UNREACHABLE();
17853 return Function::null();
17854#else
17855 const intptr_t i = BinarySearchInSCallTable(pc);
17856 if (i < 0) {
17857 return Function::null();
17858 }
17859 const Array& array = Array::Handle(untag()->static_calls_target_table());
17860 StaticCallsTable entries(array);
17861 return entries[i].Get<kSCallTableFunctionTarget>();
17862#endif
17863}
ArrayPtr static_calls_target_table() const
Definition object.h:6972
ArrayOfTuplesView< Code::SCallTableEntry, std::tuple< Smi, Object, Function > > StaticCallsTable
Definition object.h:13520

◆ GetTokenIndexOfPC()

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

Definition at line 18300 of file object.cc.

18300 {
18301 uword pc_offset = pc - PayloadStart();
18302 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
18303 PcDescriptors::Iterator iter(descriptors, UntaggedPcDescriptors::kAnyKind);
18304 while (iter.MoveNext()) {
18305 if (iter.PcOffset() == pc_offset) {
18306 return iter.TokenPos();
18307 }
18308 }
18309 return TokenPosition::kNoSource;
18310}

◆ HasBreakpoint()

bool dart::Code::HasBreakpoint ( ) const

Definition at line 17782 of file object.cc.

17782 {
17783#if defined(PRODUCT)
17784 return false;
17785#else
17787#endif
17788}
bool HasBreakpointInCode(const Code &code)
Definition debugger.cc:438
GroupDebugger * debugger() const
Definition isolate.h:314

◆ Hash()

uint32_t dart::Code::Hash ( ) const

Definition at line 18345 of file object.cc.

18345 {
18346 // PayloadStart() is a tempting hash as Instructions are not moved by the
18347 // compactor, but Instructions are effectively moved between the process
18348 // creating an AppJIT/AOT snapshot and the process loading the snapshot.
18349 const Object& obj =
18351 if (obj.IsClass()) {
18352 return Class::Cast(obj).Hash();
18353 } else if (obj.IsAbstractType()) {
18354 return AbstractType::Cast(obj).Hash();
18355 } else if (obj.IsFunction()) {
18356 return Function::Cast(obj).Hash();
18357 } else {
18358 // E.g., VM stub.
18359 return 42;
18360 }
18361}
static ObjectPtr UnwrapIfTarget(ObjectPtr obj)
Definition object.h:6649

◆ HasMonomorphicEntry() [1/2]

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

Definition at line 6812 of file object.h.

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

◆ HasMonomorphicEntry() [2/2]

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

Definition at line 6813 of file object.h.

6813 {
6814#if defined(DART_PRECOMPILED_RUNTIME)
6815 return code->untag()->entry_point_ !=
6816 code->untag()->monomorphic_entry_point_;
6817#else
6818 return Instructions::HasMonomorphicEntry(InstructionsOf(code));
6819#endif
6820 }

◆ inlined_id_to_function()

ArrayPtr dart::Code::inlined_id_to_function ( ) const

Definition at line 17999 of file object.cc.

17999 {
18000 return untag()->inlined_id_to_function();
18001}

◆ InstanceSize() [1/2]

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

Definition at line 7134 of file object.h.

7134 {
7135 ASSERT(sizeof(UntaggedCode) ==
7137 return 0;
7138 }
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 7139 of file object.h.

7139 {
7140 ASSERT(0 <= len && len <= kMaxElements);
7141 return RoundedAllocationSize(sizeof(UntaggedCode) +
7142 (len * kBytesPerElement));
7143 }
static constexpr intptr_t kBytesPerElement
Definition object.h:7125
static constexpr intptr_t kMaxElements
Definition object.h:7127
static constexpr intptr_t RoundedAllocationSize(intptr_t size)
Definition object.h:758

◆ instructions()

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

Definition at line 6747 of file object.h.

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

◆ instructions_offset()

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

Definition at line 6752 of file object.h.

6752 {
6753 return OFFSET_OF(UntaggedCode, instructions_);
6754 }

◆ InstructionsOf()

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

Definition at line 6748 of file object.h.

6748 {
6749 return code->untag()->instructions();
6750 }

◆ is_alive()

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

Definition at line 6803 of file object.h.

6803{ return AliveBit::decode(untag()->state_bits_); }

◆ is_discarded()

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

Definition at line 6806 of file object.h.

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

◆ is_force_optimized()

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

Definition at line 6798 of file object.h.

6798 {
6799 return ForceOptimizedBit::decode(untag()->state_bits_);
6800 }

◆ is_optimized()

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

Definition at line 6790 of file object.h.

6790 {
6791 return OptimizedBit::decode(untag()->state_bits_);
6792 }

◆ IsAllocationStubCode()

bool dart::Code::IsAllocationStubCode ( ) const

Definition at line 18413 of file object.cc.

18413 {
18414 return OwnerClassId() == kClassCid;
18415}
classid_t OwnerClassId() const
Definition object.h:7111

◆ IsDisabled() [1/2]

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

Definition at line 7228 of file object.h.

7228{ return IsDisabled(ptr()); }

◆ IsDisabled() [2/2]

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

Definition at line 7229 of file object.h.

7229 {
7230#if defined(DART_PRECOMPILED_RUNTIME)
7231 UNREACHABLE();
7232 return false;
7233#else
7234 return code->untag()->instructions() !=
7235 code->untag()->active_instructions();
7236#endif
7237 }

◆ IsDiscarded()

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

Definition at line 6807 of file object.h.

6807 {
6808 return DiscardedBit::decode(code->untag()->state_bits_);
6809 }

◆ IsFunctionCode()

bool dart::Code::IsFunctionCode ( ) const

Definition at line 18424 of file object.cc.

18424 {
18425 return OwnerClassId() == kFunctionCid;
18426}

◆ IsOptimized()

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

Definition at line 6794 of file object.h.

6794 {
6795 return Code::OptimizedBit::decode(code->untag()->state_bits_);
6796 }

◆ IsStubCode()

bool dart::Code::IsStubCode ( ) const

Definition at line 18407 of file object.cc.

18407 {
18408 // We should _not_ unwrap any possible WSRs here, as the null value is never
18409 // wrapped by a WSR.
18410 return owner() == Object::null();
18411}

◆ IsTypeTestStubCode()

bool dart::Code::IsTypeTestStubCode ( ) const

Definition at line 18417 of file object.cc.

18417 {
18418 auto const cid = OwnerClassId();
18419 return cid == kAbstractTypeCid || cid == kTypeCid ||
18420 cid == kFunctionTypeCid || cid == kRecordTypeCid ||
18421 cid == kTypeParameterCid;
18422}
const intptr_t cid

◆ IsUnknownDartCode() [1/2]

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

Definition at line 7216 of file object.h.

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

◆ IsUnknownDartCode() [2/2]

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

Definition at line 18428 of file object.cc.

18428 {
18430 (code == StubCode::UnknownDartCode().ptr());
18431}
static bool HasBeenInitialized()
Definition stub_code.h:41

◆ MonomorphicEntryPoint()

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

Definition at line 6859 of file object.h.

6859 {
6860#if defined(DART_PRECOMPILED_RUNTIME)
6861 return untag()->monomorphic_entry_point_;
6862#else
6864#endif
6865 }
uword MonomorphicEntryPoint() const
Definition object.h:5717

◆ MonomorphicUncheckedEntryPoint()

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

Definition at line 6867 of file object.h.

6867 {
6868#if defined(DART_PRECOMPILED_RUNTIME)
6869 return untag()->monomorphic_unchecked_entry_point_;
6870#else
6871 return MonomorphicEntryPoint() + untag()->unchecked_offset_;
6872#endif
6873 }
uword MonomorphicEntryPoint() const
Definition object.h:6859

◆ Name()

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

Definition at line 18363 of file object.cc.

18363 {
18364 Zone* zone = Thread::Current()->zone();
18365 if (IsStubCode()) {
18366 // Regular stub.
18367 const char* name = StubCode::NameOfStub(EntryPoint());
18368 if (name == nullptr) {
18369 return "[unknown stub]"; // Not yet recorded.
18370 }
18371 return OS::SCreate(zone, "[Stub] %s", name);
18372 }
18373 const auto& obj =
18375 if (obj.IsClass()) {
18376 // Allocation stub.
18377 return OS::SCreate(zone, "[Stub] Allocate %s",
18378 Class::Cast(obj).ScrubbedNameCString());
18379 } else if (obj.IsAbstractType()) {
18380 // Type test stub.
18381 return OS::SCreate(zone, "[Stub] Type Test %s",
18382 AbstractType::Cast(obj).ToCString());
18383 } else if (obj.IsFunction()) {
18384 // Dart function.
18385 const char* opt = is_optimized() ? "[Optimized]" : "[Unoptimized]";
18386 const char* function_name = Function::Cast(obj).UserVisibleNameCString();
18387 return OS::SCreate(zone, "%s %s", opt, function_name);
18388 } else {
18389 // --no_retain_function_objects etc
18390 return "[unknown code]";
18391 }
18392}
uword EntryPoint() const
Definition object.h:6837
bool IsStubCode() const
Definition object.cc:18407
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
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 18221 of file object.cc.

18223 {
18224#if !defined(PRODUCT)
18225 ASSERT(name != nullptr);
18226 ASSERT(!code.IsNull());
18227 ASSERT(!Thread::Current()->OwnsGCSafepoint());
18229 const auto& instrs = Instructions::Handle(code.instructions());
18230 CodeObservers::NotifyAll(name, instrs.PayloadStart(),
18231 code.GetPrologueOffset(), instrs.Size(), optimized,
18232 &code.comments());
18233 }
18234#endif
18235}
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 18191 of file object.cc.

18191 {
18192#if !defined(PRODUCT)
18193 ASSERT(!Thread::Current()->OwnsGCSafepoint());
18195 if (code.IsFunctionCode()) {
18196 const auto& function = Function::Handle(code.function());
18197 if (!function.IsNull()) {
18198 return NotifyCodeObservers(function, code, optimized);
18199 }
18200 }
18201 NotifyCodeObservers(code.Name(), code, optimized);
18202 }
18203#endif
18204}

◆ NotifyCodeObservers() [3/3]

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

Definition at line 18206 of file object.cc.

18208 {
18209#if !defined(PRODUCT)
18210 ASSERT(!function.IsNull());
18211 ASSERT(!Thread::Current()->OwnsGCSafepoint());
18212 // Calling ToLibNamePrefixedQualifiedCString is very expensive,
18213 // try to avoid it.
18215 const char* name = function.ToLibNamePrefixedQualifiedCString();
18216 NotifyCodeObservers(name, code, optimized);
18217 }
18218#endif
18219}

◆ num_variables()

intptr_t dart::Code::num_variables ( ) const

Definition at line 17722 of file object.cc.

17722 {
17723 ASSERT(!FLAG_precompiled_mode);
17724 return Smi::Value(Smi::RawCast(untag()->catch_entry()));
17725}
intptr_t Value() const
Definition object.h:9969

◆ object_pool()

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

Definition at line 6781 of file object.h.

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

◆ object_pool_offset()

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

Definition at line 6782 of file object.h.

6782 {
6783 return OFFSET_OF(UntaggedCode, object_pool_);
6784 }

◆ owner()

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

Definition at line 7106 of file object.h.

7106 {
7108 }
static ObjectPtr Unwrap(ObjectPtr obj)
Definition object.h:6640

◆ owner_offset()

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

Definition at line 7120 of file object.h.

7120{ return OFFSET_OF(UntaggedCode, owner_); }

◆ OwnerClassId()

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

Definition at line 7111 of file object.h.

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

◆ OwnerClassIdOf()

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

Definition at line 7112 of file object.h.

7112 {
7113 ObjectPtr owner = WeakSerializationReference::Unwrap(raw->untag()->owner());
7114 if (!owner->IsHeapObject()) {
7115 return RawSmiValue(static_cast<SmiPtr>(owner));
7116 }
7117 return owner->GetClassId();
7118 }
intptr_t GetClassId() const
Definition raw_object.h:864
intptr_t RawSmiValue(const SmiPtr raw_value)

◆ ParseEntryKind()

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

Definition at line 17658 of file object.cc.

17658 {
17659 if (strcmp(str, "Normal") == 0) {
17660 *out = EntryKind::kNormal;
17661 return true;
17662 } else if (strcmp(str, "Unchecked") == 0) {
17663 *out = EntryKind::kUnchecked;
17664 return true;
17665 } else if (strcmp(str, "Monomorphic") == 0) {
17666 *out = EntryKind::kMonomorphic;
17667 return true;
17668 } else if (strcmp(str, "MonomorphicUnchecked") == 0) {
17669 *out = EntryKind::kMonomorphicUnchecked;
17670 return true;
17671 }
17672 return false;
17673}

◆ PayloadSizeOf()

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

Definition at line 6877 of file object.h.

6877 {
6878#if defined(DART_PRECOMPILED_RUNTIME)
6879 if (IsUnknownDartCode(code)) return kUwordMax;
6880 return code->untag()->instructions_length_;
6881#else
6882 return Instructions::Size(InstructionsOf(code));
6883#endif
6884 }
intptr_t Size() const
Definition object.h:5711
constexpr uword kUwordMax
Definition globals.h:519

◆ PayloadStart()

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

Definition at line 6823 of file object.h.

6823{ return PayloadStartOf(ptr()); }
static uword PayloadStartOf(const CodePtr code)
Definition object.h:6824

◆ PayloadStartOf()

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

Definition at line 6824 of file object.h.

6824 {
6825#if defined(DART_PRECOMPILED_RUNTIME)
6826 if (IsUnknownDartCode(code)) return 0;
6827 const uword entry_offset = HasMonomorphicEntry(code)
6828 ? Instructions::kPolymorphicEntryOffsetAOT
6829 : 0;
6830 return EntryPointOf(code) - entry_offset;
6831#else
6833#endif
6834 }
uword PayloadStart() const
Definition object.h:5716

◆ pc_descriptors()

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

Definition at line 6900 of file object.h.

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

◆ pointer_offsets_length()

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

Definition at line 6786 of file object.h.

6786 {
6787 return PtrOffBits::decode(untag()->state_bits_);
6788 }

◆ QualifiedName()

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

Definition at line 18394 of file object.cc.

18394 {
18395 Zone* zone = Thread::Current()->zone();
18396 const Object& obj =
18398 if (obj.IsFunction()) {
18399 ZoneTextBuffer printer(zone);
18400 printer.AddString(is_optimized() ? "[Optimized] " : "[Unoptimized] ");
18401 Function::Cast(obj).PrintName(params, &printer);
18402 return printer.buffer();
18403 }
18404 return Name();
18405}
const char * Name() const
Definition object.cc:18363
const EmbeddedViewParams * params

◆ return_address_metadata()

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

Definition at line 7026 of file object.h.

7026 {
7027#if defined(PRODUCT)
7028 UNREACHABLE();
7029 return nullptr;
7030#else
7031 return untag()->return_address_metadata();
7032#endif
7033 }

◆ set_code_source_map()

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

Definition at line 6910 of file object.h.

6910 {
6911 ASSERT(code_source_map.IsOld());
6912 untag()->set_code_source_map(code_source_map.ptr());
6913 }

◆ set_compressed_stackmaps()

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

Definition at line 17716 of file object.cc.

17716 {
17717 ASSERT(maps.IsOld());
17718 untag()->set_compressed_stackmaps(maps.ptr());
17719}

◆ set_deopt_info_array()

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

Definition at line 17743 of file object.cc.

17743 {
17744#if defined(DART_PRECOMPILED_RUNTIME)
17745 UNREACHABLE();
17746#else
17747 ASSERT(array.IsOld());
17748 untag()->set_deopt_info_array(array.ptr());
17749#endif
17750}

◆ set_exception_handlers()

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

Definition at line 7090 of file object.h.

7090 {
7091 ASSERT(handlers.IsOld());
7092 untag()->set_exception_handlers(handlers.ptr());
7093 }

◆ set_inlined_id_to_function()

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

Definition at line 18003 of file object.cc.

18003 {
18004 ASSERT(value.IsOld());
18005 untag()->set_inlined_id_to_function(value.ptr());
18006}
uint8_t value

◆ set_is_alive()

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

Definition at line 17708 of file object.cc.

17708 {
17709 set_state_bits(AliveBit::update(value, untag()->state_bits_));
17710}
static constexpr int32_t update(bool value, int32_t original)
Definition bitfield.h:190

◆ set_is_discarded()

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

Definition at line 17712 of file object.cc.

17712 {
17713 set_state_bits(DiscardedBit::update(value, untag()->state_bits_));
17714}

◆ set_is_force_optimized()

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

Definition at line 17704 of file object.cc.

17704 {
17705 set_state_bits(ForceOptimizedBit::update(value, untag()->state_bits_));
17706}

◆ set_is_optimized()

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

Definition at line 17700 of file object.cc.

17700 {
17701 set_state_bits(OptimizedBit::update(value, untag()->state_bits_));
17702}

◆ set_num_variables()

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

Definition at line 17726 of file object.cc.

17726 {
17727 ASSERT(!FLAG_precompiled_mode);
17728 untag()->set_catch_entry(Smi::New(num_variables));
17729}
intptr_t num_variables() const
Definition object.cc:17722
static SmiPtr New(intptr_t value)
Definition object.h:9985

◆ set_object_pool()

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

Definition at line 7239 of file object.h.

7239 {
7240 untag()->set_object_pool(object_pool);
7241 }

◆ set_owner()

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

Definition at line 17686 of file object.cc.

17686 {
17687#if defined(DEBUG)
17688 const auto& unwrapped_owner =
17690 ASSERT(unwrapped_owner.IsFunction() || unwrapped_owner.IsClass() ||
17691 unwrapped_owner.IsAbstractType());
17692#endif
17693 untag()->set_owner(owner.ptr());
17694}

◆ set_pc_descriptors()

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

Definition at line 6901 of file object.h.

6901 {
6902 ASSERT(descriptors.IsOld());
6903 untag()->set_pc_descriptors(descriptors.ptr());
6904 }

◆ set_static_calls_target_table()

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

Definition at line 17752 of file object.cc.

17752 {
17753#if defined(DART_PRECOMPILED_RUNTIME)
17754 UNREACHABLE();
17755#else
17756 untag()->set_static_calls_target_table(value.ptr());
17757#endif
17758#if defined(DEBUG)
17759 // Check that the table is sorted by pc offsets.
17760 // FlowGraphCompiler::AddStaticCallTarget adds pc-offsets to the table while
17761 // emitting assembly. This guarantees that every succeeding pc-offset is
17762 // larger than the previously added one.
17763 StaticCallsTable entries(value);
17764 const intptr_t count = entries.Length();
17765 for (intptr_t i = 0; i < count - 1; ++i) {
17766 auto left = Smi::Value(entries[i].Get<kSCallTableKindAndOffset>());
17767 auto right = Smi::Value(entries[i + 1].Get<kSCallTableKindAndOffset>());
17769 }
17770#endif // DEBUG
17771}
int count
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)

◆ set_var_descriptors()

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

Definition at line 7075 of file object.h.

7075 {
7076#if defined(PRODUCT)
7077 UNREACHABLE();
7078#else
7079 ASSERT(value.IsOld());
7080 untag()->set_var_descriptors(value.ptr());
7081#endif
7082 }

◆ SetPrologueOffset()

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

Definition at line 17975 of file object.cc.

17975 {
17976#if defined(PRODUCT)
17977 UNREACHABLE();
17978#else
17979 ASSERT(offset >= 0);
17980 untag()->set_return_address_metadata(Smi::New(offset));
17981#endif
17982}

◆ SetStaticCallTargetCodeAt()

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

Definition at line 17865 of file object.cc.

17865 {
17866#if defined(DART_PRECOMPILED_RUNTIME)
17867 UNREACHABLE();
17868#else
17869 const intptr_t i = BinarySearchInSCallTable(pc);
17870 ASSERT(i >= 0);
17871 const Array& array = Array::Handle(untag()->static_calls_target_table());
17872 StaticCallsTable entries(array);
17873 ASSERT(code.IsNull() ||
17874 (code.function() == entries[i].Get<kSCallTableFunctionTarget>()));
17875 return entries[i].Set<kSCallTableCodeOrTypeTarget>(code);
17876#endif
17877}

◆ SetStubCallTargetCodeAt()

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

Definition at line 17879 of file object.cc.

17879 {
17880#if defined(DART_PRECOMPILED_RUNTIME)
17881 UNREACHABLE();
17882#else
17883 const intptr_t i = BinarySearchInSCallTable(pc);
17884 ASSERT(i >= 0);
17885 const Array& array = Array::Handle(untag()->static_calls_target_table());
17886 StaticCallsTable entries(array);
17887#if defined(DEBUG)
17888 if (entries[i].Get<kSCallTableFunctionTarget>() == Function::null()) {
17889 ASSERT(!code.IsNull() && Object::Handle(code.owner()).IsClass());
17890 } else {
17891 ASSERT(code.IsNull() ||
17892 (code.function() == entries[i].Get<kSCallTableFunctionTarget>()));
17893 }
17894#endif
17895 return entries[i].Set<kSCallTableCodeOrTypeTarget>(code);
17896#endif
17897}

◆ Size()

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

Definition at line 6876 of file object.h.

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

◆ static_calls_target_table()

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

Definition at line 6972 of file object.h.

6972 {
6973#if defined(DART_PRECOMPILED_RUNTIME)
6974 UNREACHABLE();
6975 return nullptr;
6976#else
6977 return untag()->static_calls_target_table();
6978#endif
6979 }

◆ UncheckedEntryPoint()

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

Definition at line 6851 of file object.h.

6851 {
6852#if defined(DART_PRECOMPILED_RUNTIME)
6853 return untag()->unchecked_entry_point_;
6854#else
6855 return EntryPoint() + untag()->unchecked_offset_;
6856#endif
6857 }

◆ UncheckedEntryPointOf()

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

Definition at line 6846 of file object.h.

6846 {
6847 return code->untag()->unchecked_entry_point_;
6848 }

◆ var_descriptors()

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

Definition at line 7067 of file object.h.

7067 {
7068#if defined(PRODUCT)
7069 UNREACHABLE();
7070 return nullptr;
7071#else
7072 return untag()->var_descriptors();
7073#endif
7074 }

Friends And Related Symbol Documentation

◆ CallSiteResetter

friend class CallSiteResetter
friend

Definition at line 7368 of file object.h.

◆ Class

friend class Class
friend

Definition at line 7353 of file object.h.

◆ CodeDeserializationCluster

friend class CodeDeserializationCluster
friend

Definition at line 7359 of file object.h.

◆ CodeKeyValueTrait

friend class CodeKeyValueTrait
friend

Definition at line 7369 of file object.h.

◆ CodePatcher

friend class CodePatcher
friend

Definition at line 7363 of file object.h.

◆ CodeSerializationCluster

friend class CodeSerializationCluster
friend

Definition at line 7358 of file object.h.

◆ CodeTestHelper

friend class CodeTestHelper
friend

Definition at line 7354 of file object.h.

◆ Deserializer

friend class Deserializer
friend

Definition at line 7360 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 =
85 DumpStackFrame(pc, fp, name, pc - start);
87 return;
88 }
89
90 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:18270
static void FreeSymbolName(char *name)
static bool LookupSharedObject(uword pc, uword *dso_base=nullptr, char **dso_name=nullptr)
static char * LookupSymbolName(uword pc, uword *start)
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:1023
const uint32_t fp
#define Pp
Definition globals.h:425

◆ FunctionSerializationCluster

friend class FunctionSerializationCluster
friend

Definition at line 7357 of file object.h.

◆ InstanceCall

friend class InstanceCall
friend

Definition at line 7370 of file object.h.

◆ MegamorphicCacheTable

friend class MegamorphicCacheTable
friend

Definition at line 7362 of file object.h.

◆ Precompiler

friend class Precompiler
friend

Definition at line 7356 of file object.h.

◆ ProgramVisitor

friend class ProgramVisitor
friend

Definition at line 7364 of file object.h.

◆ RelocatorTestHelper

friend struct RelocatorTestHelper
friend

Definition at line 7248 of file object.h.

◆ StaticCall

friend class StaticCall
friend

Definition at line 7371 of file object.h.

◆ StubCode

StubCode
friend

Definition at line 7355 of file object.h.

◆ UntaggedCode

friend class UntaggedCode
friend

Definition at line 7247 of file object.h.

◆ UntaggedFunction

friend class UntaggedFunction
friend

Definition at line 7367 of file object.h.

◆ UntaggedObject

friend class UntaggedObject
friend

Definition at line 7246 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 7125 of file object.h.

◆ kMaxElements

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

Definition at line 7127 of file object.h.


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