18 return IsInternalizedString(obj) ||
32 if (IsInternalizedString(obj))
return true;
42 serialized_objects_(isolate->
heap())
72 &serialized_objects_);
73 for (
auto it = it_scope.
begin(); it != it_scope.
end(); ++it) {
91 std::vector<Tagged<Object>>* existing_cache =
93 const size_t existing_cache_size = existing_cache->size();
96 DCHECK_LT(base::checked_cast<size_t>(cache_index), existing_cache_size);
97 if (base::checked_cast<size_t>(cache_index) == existing_cache_size - 1) {
99 DCHECK(IsUndefined(existing_cache->back(), roots));
100 existing_cache->back() = *obj;
101 existing_cache->push_back(roots.undefined_value());
106 sink->
PutUint30(cache_index,
"shared_heap_object_cache_index");
123 "String table number of elements");
128 class SharedHeapSerializerStringTableVisitor :
public RootVisitor {
130 explicit SharedHeapSerializerStringTableVisitor(
132 : serializer_(serializer) {}
134 void VisitRootPointers(
Root root,
const char* description,
139 void VisitRootPointers(
Root root,
const char* description,
146 if (IsHeapObject(obj)) {
147 DCHECK(IsInternalizedString(obj));
148 serializer_->SerializeObject(
handle(Cast<HeapObject>(obj), isolate),
158 SharedHeapSerializerStringTableVisitor string_table_visitor(
this);
190 serialized_objects_.Insert(obj, 0);
204 std::vector<Tagged<Object>>* cache =
209 for (
size_t i = 0, size = cache->
size();
i < size - 1;
i++) {
216 DCHECK(IsUndefined(cache->back(), isolate()));
Isolate * isolate() const
bool has_shared_space() const
StringTable * string_table() const
Isolate * shared_space_isolate() const
std::vector< Tagged< Object > > * shared_heap_object_cache()
static V8_EXPORT_PRIVATE bool Contains(Address address)
virtual void VisitRootPointer(Root root, const char *description, FullObjectSlot p)
void CheckRehashability(Tagged< HeapObject > obj)
int SerializeInObjectCache(Handle< HeapObject > object)
bool IsRootAndHasBeenSerialized(Tagged< HeapObject > obj) const
void Serialize(SlotType slot_type)
Isolate * isolate() const
bool reconstruct_read_only_and_shared_object_caches_for_testing() const
void SerializeDeferredObjects()
bool SerializeRoot(Tagged< HeapObject > obj)
bool SerializeReadOnlyObjectReference(Tagged< HeapObject > obj, SnapshotByteSink *sink)
void OutputStatistics(const char *name)
void Pad(int padding_offset=0)
bool SerializeHotObject(Tagged< HeapObject > obj)
bool SerializeBackReference(Tagged< HeapObject > obj)
SharedHeapSerializer(Isolate *isolate, Snapshot::SerializerFlags flags)
static bool CanBeInSharedOldSpace(Tagged< HeapObject > obj)
~SharedHeapSerializer() override
bool SerializeUsingSharedHeapObjectCache(SnapshotByteSink *sink, Handle< HeapObject > obj)
static bool ShouldBeInSharedHeapObjectCache(Tagged< HeapObject > obj)
void SerializeObjectImpl(Handle< HeapObject > obj, SlotType slot_type) override
bool ShouldReconstructSharedHeapObjectCacheForTesting() const
void ReconstructSharedHeapObjectCacheForTesting()
void SerializeStringTable(StringTable *string_table)
void FinalizeSerialization()
void PutUint30(uint32_t integer, const char *description)
void Put(uint8_t b, const char *description)
void IterateElements(RootVisitor *visitor)
int NumberOfElements() const
static bool IsInPlaceInternalizable(Tagged< String > string)
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)