@@ -3718,9 +3718,6 @@ class RODataDeserializationCluster
37183718 VerifyCanonicalSet (d, refs,
37193719 WeakArray::Handle (object_store->symbol_table ()));
37203720 object_store->set_symbol_table (table_);
3721- if (d->isolate_group () == Dart::vm_isolate_group ()) {
3722- Symbols::InitFromSnapshot (d->isolate_group ());
3723- }
37243721 } else if (!is_root_unit_ && is_canonical ()) {
37253722 FATAL (" Cannot recanonicalize RO objects." );
37263723 }
@@ -6790,9 +6787,6 @@ class StringDeserializationCluster
67906787 VerifyCanonicalSet (d, refs,
67916788 WeakArray::Handle (object_store->symbol_table ()));
67926789 object_store->set_symbol_table (table_);
6793- if (d->isolate_group () == Dart::vm_isolate_group ()) {
6794- Symbols::InitFromSnapshot (d->isolate_group ());
6795- }
67966790#if defined(DEBUG)
67976791 Symbols::New (Thread::Current (), " :some:new:symbol:" );
67986792 ASSERT (object_store->symbol_table () == table_.ptr ()); // Did not rehash.
@@ -6824,10 +6818,10 @@ class FakeSerializationCluster : public SerializationCluster {
68246818#if !defined(DART_PRECOMPILED_RUNTIME)
68256819class VMSerializationRoots : public SerializationRoots {
68266820 public:
6827- explicit VMSerializationRoots (const WeakArray& symbols ,
6828- bool should_write_symbols )
6829- : symbols_(symbols ),
6830- should_write_symbols_(should_write_symbols ),
6821+ explicit VMSerializationRoots (const WeakArray& symbol_table ,
6822+ bool should_write_symbol_table )
6823+ : symbol_table_(symbol_table ),
6824+ should_write_symbol_table_(should_write_symbol_table ),
68316825 zone_(Thread::Current()->zone()) {}
68326826
68336827 void AddBaseObjects (Serializer* s) {
@@ -6901,11 +6895,11 @@ class VMSerializationRoots : public SerializationRoots {
69016895 }
69026896
69036897 void PushRoots (Serializer* s) {
6904- if (should_write_symbols_ ) {
6905- s->Push (symbols_ .ptr ());
6898+ if (should_write_symbol_table_ ) {
6899+ s->Push (symbol_table_ .ptr ());
69066900 } else {
6907- for (intptr_t i = 0 ; i < symbols_ .Length (); i++) {
6908- s->Push (symbols_ .At (i));
6901+ for (intptr_t i = 0 ; i < symbol_table_ .Length (); i++) {
6902+ s->Push (symbol_table_ .At (i));
69096903 }
69106904 }
69116905 if (Snapshot::IncludesCode (s->kind ())) {
@@ -6916,35 +6910,41 @@ class VMSerializationRoots : public SerializationRoots {
69166910 }
69176911
69186912 void WriteRoots (Serializer* s) {
6919- s->WriteRootRef (should_write_symbols_ ? symbols_.ptr () : Object::null (),
6920- " symbol-table" );
6913+ for (intptr_t i = 1 ; i < Symbols::kMaxPredefinedId ; i++) {
6914+ s->WriteRootRef (Symbols::Symbol (i).ptr (), " <symbol>" );
6915+ }
6916+ s->WriteRootRef (
6917+ should_write_symbol_table_ ? symbol_table_.ptr () : Object::null (),
6918+ " symbol-table" );
69216919 if (Snapshot::IncludesCode (s->kind ())) {
69226920 for (intptr_t i = 0 ; i < StubCode::NumEntries (); i++) {
69236921 s->WriteRootRef (StubCode::EntryAt (i).ptr (),
69246922 zone_->PrintToString (" Stub:%s" , StubCode::NameAt (i)));
69256923 }
69266924 }
69276925
6928- if (!should_write_symbols_ && s->profile_writer () != nullptr ) {
6926+ if (!should_write_symbol_table_ && s->profile_writer () != nullptr ) {
69296927 // If writing V8 snapshot profile create an artificial node representing
69306928 // VM isolate symbol table.
6931- ASSERT (!s->IsReachable (symbols_.ptr ()));
6932- s->AssignArtificialRef (symbols_.ptr ());
6933- const auto & symbols_snapshot_id = s->GetProfileId (symbols_.ptr ());
6934- s->profile_writer ()->SetObjectTypeAndName (symbols_snapshot_id, " Symbols" ,
6935- " vm_symbols" );
6936- s->profile_writer ()->AddRoot (symbols_snapshot_id);
6937- for (intptr_t i = 0 ; i < symbols_.Length (); i++) {
6929+ ASSERT (!s->IsReachable (symbol_table_.ptr ()));
6930+ s->AssignArtificialRef (symbol_table_.ptr ());
6931+ const auto & symbol_table_snapshot_id =
6932+ s->GetProfileId (symbol_table_.ptr ());
6933+ s->profile_writer ()->SetObjectTypeAndName (symbol_table_snapshot_id,
6934+ " Symbols" , " vm_symbols" );
6935+ s->profile_writer ()->AddRoot (symbol_table_snapshot_id);
6936+ for (intptr_t i = 0 ; i < symbol_table_.Length (); i++) {
69386937 s->profile_writer ()->AttributeReferenceTo (
6939- symbols_snapshot_id, V8SnapshotProfileWriter::Reference::Element (i),
6940- s->GetProfileId (symbols_.At (i)));
6938+ symbol_table_snapshot_id,
6939+ V8SnapshotProfileWriter::Reference::Element (i),
6940+ s->GetProfileId (symbol_table_.At (i)));
69416941 }
69426942 }
69436943 }
69446944
69456945 private:
6946- const WeakArray& symbols_ ;
6947- const bool should_write_symbols_ ;
6946+ const WeakArray& symbol_table_ ;
6947+ const bool should_write_symbol_table_ ;
69486948 Zone* zone_;
69496949};
69506950#endif // !DART_PRECOMPILED_RUNTIME
@@ -7007,10 +7007,16 @@ class VMDeserializationRoots : public DeserializationRoots {
70077007 }
70087008
70097009 void ReadRoots (Deserializer* d) override {
7010+ for (intptr_t i = 1 ; i < Symbols::kMaxPredefinedId ; i++) {
7011+ String* symbol = String::ReadOnlyHandle ();
7012+ *symbol ^= d->ReadRef ();
7013+ Symbols::InitSymbol (i, symbol);
7014+ }
70107015 symbol_table_ ^= d->ReadRef ();
70117016 if (!symbol_table_.IsNull ()) {
70127017 d->isolate_group ()->object_store ()->set_symbol_table (symbol_table_);
70137018 }
7019+ Symbols::InitFromSnapshot (d->isolate_group ());
70147020 if (Snapshot::IncludesCode (d->kind ())) {
70157021 for (intptr_t i = 0 ; i < StubCode::NumEntries (); i++) {
70167022 Code* code = Code::ReadOnlyHandle ();
@@ -7026,10 +7032,6 @@ class VMDeserializationRoots : public DeserializationRoots {
70267032 // allocations (e.g., FinalizeVMIsolate) before allocating new pages.
70277033 d->heap ()->old_space ()->ReleaseBumpAllocation ();
70287034
7029- if (!symbol_table_.IsNull ()) {
7030- Symbols::InitFromSnapshot (d->isolate_group ());
7031- }
7032-
70337035 Object::set_vm_isolate_snapshot_object_table (refs);
70347036 }
70357037
@@ -9701,7 +9703,7 @@ ZoneGrowableArray<Object*>* FullSnapshotWriter::WriteVMSnapshot() {
97019703 VMSerializationRoots roots (
97029704 WeakArray::Handle (
97039705 Dart::vm_isolate_group ()->object_store ()->symbol_table ()),
9704- /* should_write_symbols =*/ !Snapshot::IncludesStringsInROData (kind_));
9706+ /* should_write_symbol_table =*/ !Snapshot::IncludesStringsInROData (kind_));
97059707 ZoneGrowableArray<Object*>* objects = serializer.Serialize (&roots);
97069708 serializer.FillHeader (serializer.kind ());
97079709 clustered_vm_size_ = serializer.bytes_written ();
0 commit comments