Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
dart::StringSerializationCluster Class Reference
Inheritance diagram for dart::StringSerializationCluster:
dart::CanonicalSetSerializationCluster< CanonicalStringSet, String, StringPtr > dart::SerializationCluster dart::ZoneAllocated

Public Member Functions

 StringSerializationCluster (bool is_canonical, bool represents_canonical_set)
 
 ~StringSerializationCluster ()
 
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 intptr_t EncodeLengthAndCid (intptr_t length, intptr_t cid)
 

Additional Inherited Members

- Static Public Attributes inherited from dart::SerializationCluster
static constexpr intptr_t kSizeVaries = -1
 
- Protected Member Functions inherited from dart::CanonicalSetSerializationCluster< CanonicalStringSet, String, StringPtr >
 CanonicalSetSerializationCluster (intptr_t cid, bool is_canonical, bool represents_canonical_set, const char *name, intptr_t target_instance_size=0)
 
virtual bool IsInCanonicalSet (Serializer *s, StringPtr ptr)
 
void ReorderObjects (Serializer *s)
 
void WriteCanonicalSetLayout (Serializer *s)
 
- Protected Attributes inherited from dart::CanonicalSetSerializationCluster< CanonicalStringSet, String, StringPtr >
GrowableArray< StringPtr > objects_
 
- 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 6610 of file app_snapshot.cc.

Constructor & Destructor Documentation

◆ StringSerializationCluster()

dart::StringSerializationCluster::StringSerializationCluster ( bool  is_canonical,
bool  represents_canonical_set 
)
inlineexplicit

Definition at line 6624 of file app_snapshot.cc.

6628 represents_canonical_set,
6629 "String",
6630 kSizeVaries) {}
CanonicalSetSerializationCluster(intptr_t cid, bool is_canonical, bool represents_canonical_set, const char *name, intptr_t target_instance_size=0)
static constexpr intptr_t kSizeVaries

◆ ~StringSerializationCluster()

dart::StringSerializationCluster::~StringSerializationCluster ( )
inline

Definition at line 6631 of file app_snapshot.cc.

6631{}

Member Function Documentation

◆ EncodeLengthAndCid()

static intptr_t dart::StringSerializationCluster::EncodeLengthAndCid ( intptr_t  length,
intptr_t  cid 
)
inlinestatic

Definition at line 6618 of file app_snapshot.cc.

6618 {
6619 ASSERT(cid == kOneByteStringCid || cid == kTwoByteStringCid);
6621 return (length << 1) | (cid == kTwoByteStringCid ? 0x1 : 0x0);
6622 }
#define ASSERT(E)
size_t length
constexpr word kSmiMax
Definition: runtime_api.h:305

◆ Trace()

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

Implements dart::SerializationCluster.

Definition at line 6633 of file app_snapshot.cc.

6633 {
6634 StringPtr str = static_cast<StringPtr>(object);
6635 objects_.Add(str);
6636 }
void Add(const T &value)

◆ WriteAlloc()

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

Implements dart::SerializationCluster.

Definition at line 6638 of file app_snapshot.cc.

6638 {
6639 const intptr_t count = objects_.length();
6640 s->WriteUnsigned(count);
6642 for (intptr_t i = 0; i < count; i++) {
6643 StringPtr str = objects_[i];
6644 s->AssignRef(str);
6645 AutoTraceObject(str);
6646 const intptr_t cid = str->GetClassId();
6647 const intptr_t length = Smi::Value(str->untag()->length());
6648 const intptr_t encoded = EncodeLengthAndCid(length, cid);
6649 s->WriteUnsigned(encoded);
6651 cid == kOneByteStringCid
6653 : compiler::target::TwoByteString::InstanceSize(length);
6654 }
6656 }
int count
Definition: FontMgrTest.cpp:50
#define AutoTraceObject(obj)
intptr_t length() const
intptr_t Value() const
Definition: object.h:9990
static intptr_t EncodeLengthAndCid(intptr_t length, intptr_t cid)
struct MyStruct s
uint32_t * target

◆ WriteFill()

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

Implements dart::SerializationCluster.

Definition at line 6658 of file app_snapshot.cc.

6658 {
6659 const intptr_t count = objects_.length();
6660 for (intptr_t i = 0; i < count; i++) {
6661 StringPtr str = objects_[i];
6662 AutoTraceObject(str);
6663 const intptr_t cid = str->GetClassId();
6664 const intptr_t length = Smi::Value(str->untag()->length());
6665 const intptr_t encoded = EncodeLengthAndCid(length, cid);
6666 s->WriteUnsigned(encoded);
6667 if (cid == kOneByteStringCid) {
6668 s->WriteBytes(static_cast<OneByteStringPtr>(str)->untag()->data(),
6669 length);
6670 } else {
6671 s->WriteBytes(reinterpret_cast<uint8_t*>(
6672 static_cast<TwoByteStringPtr>(str)->untag()->data()),
6673 length * 2);
6674 }
6675 }
6676 }
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
static int8_t data[kExtLength]

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