@@ -30,7 +30,11 @@ FlowGraphSerializer::FlowGraphSerializer(NonStreamingWriteStream* stream)
3030 zone_ (Thread::Current()->zone()),
3131 thread_(Thread::Current()),
3232 isolate_group_(IsolateGroup::Current()),
33- heap_(IsolateGroup::Current()->heap()) {}
33+ heap_(IsolateGroup::Current()->heap()) {
34+ // We want to preserve the identity of these, even though they are not const.
35+ AddBaseObject (Object::uninitialized_index ());
36+ AddBaseObject (Object::uninitialized_data ());
37+ }
3438
3539FlowGraphSerializer::~FlowGraphSerializer () {
3640 heap_->ResetObjectIdTable ();
@@ -43,7 +47,11 @@ FlowGraphDeserializer::FlowGraphDeserializer(
4347 stream_ (stream),
4448 zone_(Thread::Current()->zone()),
4549 thread_(Thread::Current()),
46- isolate_group_(IsolateGroup::Current()) {}
50+ isolate_group_(IsolateGroup::Current()) {
51+ // We want to preserve the identity of these, even though they are not const.
52+ AddBaseObject (Object::uninitialized_index ());
53+ AddBaseObject (Object::uninitialized_data ());
54+ }
4755
4856ClassPtr FlowGraphDeserializer::GetClassById (classid_t id) const {
4957 return isolate_group ()->class_table ()->At (id);
@@ -1392,6 +1400,11 @@ void MoveOperands::Write(FlowGraphSerializer* s) const {
13921400MoveOperands::MoveOperands (FlowGraphDeserializer* d)
13931401 : dest_(Location::Read(d)), src_(Location::Read(d)) {}
13941402
1403+ void FlowGraphSerializer::AddBaseObject (const Object& x) {
1404+ const intptr_t object_index = object_counter_++;
1405+ heap ()->SetObjectId (x.ptr (), object_index + 1 );
1406+ }
1407+
13951408template <>
13961409void FlowGraphSerializer::WriteTrait<const Object&>::Write(
13971410 FlowGraphSerializer* s,
@@ -1412,6 +1425,12 @@ void FlowGraphSerializer::WriteTrait<const Object&>::Write(
14121425 s->WriteObjectImpl (x, cid, object_index);
14131426}
14141427
1428+ void FlowGraphDeserializer::AddBaseObject (const Object& x) {
1429+ const intptr_t object_index = object_counter_;
1430+ object_counter_++;
1431+ SetObjectAt (object_index, x);
1432+ }
1433+
14151434template <>
14161435const Object& FlowGraphDeserializer::ReadTrait<const Object&>::Read(
14171436 FlowGraphDeserializer* d) {
0 commit comments