Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
dart::StringDeserializationCluster Class Reference
Inheritance diagram for dart::StringDeserializationCluster:
dart::CanonicalSetDeserializationCluster< CanonicalStringSet > dart::DeserializationCluster dart::ZoneAllocated

Public Member Functions

 StringDeserializationCluster (bool is_canonical, bool is_root_unit)
 
 ~StringDeserializationCluster ()
 
void ReadAlloc (Deserializer *d) override
 
void ReadFill (Deserializer *d_) override
 
void PostLoad (Deserializer *d, const Array &refs) override
 
- Public Member Functions inherited from dart::CanonicalSetDeserializationCluster< CanonicalStringSet >
 CanonicalSetDeserializationCluster (bool is_canonical, bool is_root_unit, const char *name)
 
void BuildCanonicalSetFromLayout (Deserializer *d)
 
- Public Member Functions inherited from dart::DeserializationCluster
 DeserializationCluster (const char *name, bool is_canonical=false, bool is_immutable=false)
 
virtual ~DeserializationCluster ()
 
const char * name () const
 
bool is_canonical () 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 DecodeLengthAndCid (intptr_t encoded, intptr_t *out_cid)
 
static intptr_t InstanceSize (intptr_t length, intptr_t cid)
 

Additional Inherited Members

- Protected Member Functions inherited from dart::CanonicalSetDeserializationCluster< CanonicalStringSet >
void VerifyCanonicalSet (Deserializer *d, const Array &refs, const typename SetType::ArrayHandle &current_table)
 
- Protected Member Functions inherited from dart::DeserializationCluster
void ReadAllocFixedSize (Deserializer *deserializer, intptr_t instance_size)
 
- Protected Attributes inherited from dart::CanonicalSetDeserializationCluster< CanonicalStringSet >
const bool is_root_unit_
 
intptr_t first_element_
 
SetType::ArrayHandle & table_
 
- Protected Attributes inherited from dart::DeserializationCluster
const char *const name_
 
const bool is_canonical_
 
const bool is_immutable_
 
intptr_t start_index_
 
intptr_t stop_index_
 

Detailed Description

Definition at line 6680 of file app_snapshot.cc.

Constructor & Destructor Documentation

◆ StringDeserializationCluster()

dart::StringDeserializationCluster::StringDeserializationCluster ( bool  is_canonical,
bool  is_root_unit 
)
inlineexplicit

Definition at line 6693 of file app_snapshot.cc.

6695 is_root_unit,
6696 "String") {}
CanonicalSetDeserializationCluster(bool is_canonical, bool is_root_unit, const char *name)

◆ ~StringDeserializationCluster()

dart::StringDeserializationCluster::~StringDeserializationCluster ( )
inline

Definition at line 6697 of file app_snapshot.cc.

6697{}

Member Function Documentation

◆ DecodeLengthAndCid()

static intptr_t dart::StringDeserializationCluster::DecodeLengthAndCid ( intptr_t  encoded,
intptr_t *  out_cid 
)
inlinestatic

Definition at line 6683 of file app_snapshot.cc.

6683 {
6684 *out_cid = (encoded & 0x1) != 0 ? kTwoByteStringCid : kOneByteStringCid;
6685 return encoded >> 1;
6686 }

◆ InstanceSize()

static intptr_t dart::StringDeserializationCluster::InstanceSize ( intptr_t  length,
intptr_t  cid 
)
inlinestatic

Definition at line 6688 of file app_snapshot.cc.

6688 {
6689 return cid == kOneByteStringCid ? OneByteString::InstanceSize(length)
6690 : TwoByteString::InstanceSize(length);
6691 }
static intptr_t InstanceSize()
Definition object.h:10543
static intptr_t InstanceSize(intptr_t length, intptr_t cid)
size_t length
const intptr_t cid

◆ PostLoad()

void dart::StringDeserializationCluster::PostLoad ( Deserializer d,
const Array refs 
)
inlineoverridevirtual

Reimplemented from dart::DeserializationCluster.

Definition at line 6766 of file app_snapshot.cc.

6766 {
6767 if (!table_.IsNull()) {
6768 auto object_store = d->isolate_group()->object_store();
6769 VerifyCanonicalSet(d, refs,
6770 WeakArray::Handle(object_store->symbol_table()));
6771 object_store->set_symbol_table(table_);
6772 if (d->isolate_group() == Dart::vm_isolate_group()) {
6773 Symbols::InitFromSnapshot(d->isolate_group());
6774 }
6775#if defined(DEBUG)
6776 Symbols::New(Thread::Current(), ":some:new:symbol:");
6777 ASSERT(object_store->symbol_table() == table_.ptr()); // Did not rehash.
6778#endif
6779 }
6780 }
void VerifyCanonicalSet(Deserializer *d, const Array &refs, const typename SetType::ArrayHandle &current_table)
static IsolateGroup * vm_isolate_group()
Definition dart.h:69
static Object & Handle()
Definition object.h:407
static void InitFromSnapshot(IsolateGroup *isolate_group)
Definition symbols.cc:127
static StringPtr New(Thread *thread, const char *cstr)
Definition symbols.h:722
static Thread * Current()
Definition thread.h:361
#define ASSERT(E)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition main.cc:19

◆ ReadAlloc()

void dart::StringDeserializationCluster::ReadAlloc ( Deserializer d)
inlineoverridevirtual

Implements dart::DeserializationCluster.

Definition at line 6699 of file app_snapshot.cc.

6699 {
6700 start_index_ = d->next_index();
6701 const intptr_t count = d->ReadUnsigned();
6702 for (intptr_t i = 0; i < count; i++) {
6703 const intptr_t encoded = d->ReadUnsigned();
6704 intptr_t cid = 0;
6705 const intptr_t length = DecodeLengthAndCid(encoded, &cid);
6706 d->AssignRef(d->Allocate(InstanceSize(length, cid)));
6707 }
6708 stop_index_ = d->next_index();
6710 }
int count
static intptr_t DecodeLengthAndCid(intptr_t encoded, intptr_t *out_cid)

◆ ReadFill()

void dart::StringDeserializationCluster::ReadFill ( Deserializer d_)
inlineoverridevirtual

Implements dart::DeserializationCluster.

Definition at line 6712 of file app_snapshot.cc.

6712 {
6713 Deserializer::Local d(d_);
6714
6715 for (intptr_t id = start_index_, n = stop_index_; id < n; id++) {
6716 StringPtr str = static_cast<StringPtr>(d.Ref(id));
6717 const intptr_t encoded = d.ReadUnsigned();
6718 intptr_t cid = 0;
6719 const intptr_t length = DecodeLengthAndCid(encoded, &cid);
6720 const intptr_t instance_size = InstanceSize(length, cid);
6721 // Clean up last two words of the string object to simplify future
6722 // string comparisons.
6723 // Objects are rounded up to two-word size boundary.
6724 *reinterpret_cast<word*>(reinterpret_cast<uint8_t*>(str->untag()) +
6725 instance_size - 1 * kWordSize) = 0;
6726 *reinterpret_cast<word*>(reinterpret_cast<uint8_t*>(str->untag()) +
6727 instance_size - 2 * kWordSize) = 0;
6728 Deserializer::InitializeHeader(str, cid, instance_size, is_canonical());
6729#if DART_COMPRESSED_POINTERS
6730 // Gap caused by less-than-a-word length_ smi sitting before data_.
6731 const intptr_t length_offset =
6732 reinterpret_cast<intptr_t>(&str->untag()->length_);
6733 const intptr_t data_offset =
6734 cid == kOneByteStringCid
6735 ? reinterpret_cast<intptr_t>(
6736 static_cast<OneByteStringPtr>(str)->untag()->data())
6737 : reinterpret_cast<intptr_t>(
6738 static_cast<TwoByteStringPtr>(str)->untag()->data());
6739 const intptr_t length_with_gap = data_offset - length_offset;
6740 ASSERT(length_with_gap > kCompressedWordSize);
6741 ASSERT(length_with_gap == kWordSize);
6742 memset(reinterpret_cast<void*>(length_offset), 0, length_with_gap);
6743#endif
6744 str->untag()->length_ = Smi::New(length);
6745
6746 StringHasher hasher;
6747 if (cid == kOneByteStringCid) {
6748 for (intptr_t j = 0; j < length; j++) {
6749 uint8_t code_unit = d.Read<uint8_t>();
6750 static_cast<OneByteStringPtr>(str)->untag()->data()[j] = code_unit;
6751 hasher.Add(code_unit);
6752 }
6753
6754 } else {
6755 for (intptr_t j = 0; j < length; j++) {
6756 uint16_t code_unit = d.Read<uint8_t>();
6757 code_unit = code_unit | (d.Read<uint8_t>() << 8);
6758 static_cast<TwoByteStringPtr>(str)->untag()->data()[j] = code_unit;
6759 hasher.Add(code_unit);
6760 }
6761 }
6762 String::SetCachedHash(str, hasher.Finalize());
6763 }
6764 }
static void InitializeHeader(ObjectPtr raw, intptr_t cid, intptr_t size, bool is_canonical=false)
static SmiPtr New(intptr_t value)
Definition object.h:9985
static uint32_t SetCachedHash(StringPtr obj, uint32_t hash)
Definition object.h:10433
intptr_t word
Definition globals.h:500
static constexpr intptr_t kCompressedWordSize
Definition globals.h:42
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)
constexpr intptr_t kWordSize
Definition globals.h:509
static int8_t data[kExtLength]

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