Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
dart::FunctionSerializationCluster Class Reference
Inheritance diagram for dart::FunctionSerializationCluster:
dart::SerializationCluster dart::ZoneAllocated

Public Member Functions

 FunctionSerializationCluster ()
 
 ~FunctionSerializationCluster ()
 
void Trace (Serializer *s, ObjectPtr object)
 
void WriteAlloc (Serializer *s)
 
void WriteFill (Serializer *s)
 
- Public Member Functions inherited from dart::SerializationCluster
 SerializationCluster (const char *name, intptr_t cid, intptr_t target_instance_size=kSizeVaries, bool is_canonical=false)
 
virtual ~SerializationCluster ()
 
virtual void Trace (Serializer *serializer, ObjectPtr object)=0
 
virtual void WriteAlloc (Serializer *serializer)=0
 
virtual void WriteFill (Serializer *serializer)=0
 
void WriteAndMeasureAlloc (Serializer *serializer)
 
void WriteAndMeasureFill (Serializer *serializer)
 
const char * name () const
 
intptr_t cid () const
 
bool is_canonical () const
 
bool is_immutable () const
 
intptr_t size () const
 
intptr_t num_objects () const
 
intptr_t target_memory_size () const
 
- Public Member Functions inherited from dart::ZoneAllocated
 ZoneAllocated ()
 
void * operator new (size_t size)
 
void * operator new (size_t size, Zone *zone)
 
void operator delete (void *pointer)
 

Static Public Member Functions

static const char * MakeDisambiguatedFunctionName (Serializer *s, FunctionPtr f)
 

Additional Inherited Members

- Static Public Attributes inherited from dart::SerializationCluster
static constexpr intptr_t kSizeVaries = -1
 
- Protected Attributes inherited from dart::SerializationCluster
const char *const name_
 
const intptr_t cid_
 
const intptr_t target_instance_size_
 
const bool is_canonical_
 
const bool is_immutable_
 
intptr_t size_ = 0
 
intptr_t num_objects_ = 0
 
intptr_t target_memory_size_ = 0
 

Detailed Description

Definition at line 1686 of file app_snapshot.cc.

Constructor & Destructor Documentation

◆ FunctionSerializationCluster()

dart::FunctionSerializationCluster::FunctionSerializationCluster ( )
inline

Definition at line 1688 of file app_snapshot.cc.

1689 : SerializationCluster("Function",
1690 kFunctionCid,
SerializationCluster(const char *name, intptr_t cid, intptr_t target_instance_size=kSizeVaries, bool is_canonical=false)

◆ ~FunctionSerializationCluster()

dart::FunctionSerializationCluster::~FunctionSerializationCluster ( )
inline

Definition at line 1692 of file app_snapshot.cc.

1692{}

Member Function Documentation

◆ MakeDisambiguatedFunctionName()

static const char * dart::FunctionSerializationCluster::MakeDisambiguatedFunctionName ( Serializer s,
FunctionPtr  f 
)
inlinestatic

Definition at line 1777 of file app_snapshot.cc.

1778 {
1779 if (s->profile_writer() == nullptr) {
1780 return nullptr;
1781 }
1782
1784 Function& fun = reused_function_handle.Handle();
1785 fun = f;
1786 ZoneTextBuffer printer(s->thread()->zone());
1788 Object::NameVisibility::kInternalName),
1789 &printer);
1790 return printer.buffer();
1791 }
struct MyStruct s
#define REUSABLE_FUNCTION_HANDLESCOPE(thread)
static NameFormattingParams DisambiguatedUnqualified(Object::NameVisibility visibility)
Definition: object.h:2975

◆ Trace()

void dart::FunctionSerializationCluster::Trace ( Serializer s,
ObjectPtr  object 
)
inlinevirtual

Implements dart::SerializationCluster.

Definition at line 1694 of file app_snapshot.cc.

1694 {
1695 Snapshot::Kind kind = s->kind();
1696 FunctionPtr func = Function::RawCast(object);
1697 objects_.Add(func);
1698
1699 PushFromTo(func);
1700 if (kind == Snapshot::kFullAOT) {
1701 s->Push(func->untag()->code());
1702 } else if (kind == Snapshot::kFullJIT) {
1703 NOT_IN_PRECOMPILED(s->Push(func->untag()->unoptimized_code()));
1704 s->Push(func->untag()->code());
1705 s->Push(func->untag()->ic_data_array());
1706 }
1707 if (kind != Snapshot::kFullAOT) {
1708 NOT_IN_PRECOMPILED(s->Push(func->untag()->positional_parameter_names()));
1709 }
1710 }
#define PushFromTo(obj,...)
void Add(const T &value)
static ObjectPtr RawCast(ObjectPtr obj)
Definition: object.h:325
#define NOT_IN_PRECOMPILED(code)
Definition: globals.h:100

◆ WriteAlloc()

void dart::FunctionSerializationCluster::WriteAlloc ( Serializer s)
inlinevirtual

Implements dart::SerializationCluster.

Definition at line 1712 of file app_snapshot.cc.

1712 {
1713 const intptr_t count = objects_.length();
1714 s->WriteUnsigned(count);
1715 for (intptr_t i = 0; i < count; i++) {
1716 FunctionPtr func = objects_[i];
1717 s->AssignRef(func);
1718 }
1719 }
int count
Definition: FontMgrTest.cpp:50
intptr_t length() const

◆ WriteFill()

void dart::FunctionSerializationCluster::WriteFill ( Serializer s)
inlinevirtual

Implements dart::SerializationCluster.

Definition at line 1721 of file app_snapshot.cc.

1721 {
1722 Snapshot::Kind kind = s->kind();
1723 const intptr_t count = objects_.length();
1724 for (intptr_t i = 0; i < count; i++) {
1725 FunctionPtr func = objects_[i];
1727 WriteFromTo(func);
1728 if (kind == Snapshot::kFullAOT) {
1729#if defined(DART_PRECOMPILER)
1730 CodePtr code = func->untag()->code();
1731 const auto code_index = s->GetCodeIndex(code);
1732 s->WriteUnsigned(code_index);
1733 s->AttributePropertyRef(code, "code_");
1734#else
1735 UNREACHABLE();
1736#endif
1737 } else if (s->kind() == Snapshot::kFullJIT) {
1738 NOT_IN_PRECOMPILED(WriteCompressedField(func, unoptimized_code));
1740 WriteCompressedField(func, ic_data_array);
1741 }
1742
1743 if (kind != Snapshot::kFullAOT) {
1745 WriteCompressedField(func, positional_parameter_names));
1746 }
1747
1748#if defined(DART_PRECOMPILER) && !defined(PRODUCT)
1749 TokenPosition token_pos = func->untag()->token_pos_;
1750 if (kind == Snapshot::kFullAOT) {
1751 // We use then token_pos property to store the line number
1752 // in AOT snapshots.
1753 intptr_t line = -1;
1754 const Function& function = Function::Handle(func);
1755 const Script& script = Script::Handle(function.script());
1756 if (!script.IsNull()) {
1757 script.GetTokenLocation(token_pos, &line, nullptr);
1758 }
1759 token_pos = line == -1 ? TokenPosition::kNoSource
1761 }
1762 s->WriteTokenPosition(token_pos);
1763#else
1764 if (kind != Snapshot::kFullAOT) {
1765 s->WriteTokenPosition(func->untag()->token_pos_);
1766 }
1767#endif
1768 if (kind != Snapshot::kFullAOT) {
1769 s->WriteTokenPosition(func->untag()->end_token_pos_);
1770 s->Write<uint32_t>(func->untag()->kernel_offset_);
1771 s->Write<uint32_t>(func->untag()->packed_fields_);
1772 }
1773 s->Write<uint32_t>(func->untag()->kind_tag_);
1774 }
1775 }
#define WriteFromTo(obj,...)
#define AutoTraceObjectName(obj, str)
#define WriteCompressedField(obj, name)
#define UNREACHABLE()
Definition: assert.h:248
static const char * MakeDisambiguatedFunctionName(Serializer *s, FunctionPtr f)
static Object & Handle()
Definition: object.h:407
static TokenPosition Deserialize(int32_t value)
Dart_NativeFunction function
Definition: fuchsia.cc:51

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