Chromium Code Reviews| Index: runtime/vm/raw_object_snapshot.cc |
| diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc |
| index 06dce1270cfcef8cc55dd362cd12161f0f4d19eb..fe326e916ba554a93d781a6daba12c262a3db559 100644 |
| --- a/runtime/vm/raw_object_snapshot.cc |
| +++ b/runtime/vm/raw_object_snapshot.cc |
| @@ -653,14 +653,18 @@ RawFunction* Function::ReadFrom(SnapshotReader* reader, |
| func.raw()->from(), |
| reader->snapshot_code() ? func.raw()->to() |
| : func.raw()->to_snapshot(), |
| - kAsReference); |
| + kAsInlinedObject); |
| if (!reader->snapshot_code()) { |
| // Initialize all fields that are not part of the snapshot. |
| func.ClearICDataArray(); |
| func.ClearCode(); |
| } else { |
| - // TODO(rmacnak): Fix entry_point_. |
| + // Fix entry point. |
| + (*reader->CodeHandle()) = func.CurrentCode(); |
| + uword new_entry = (*reader->CodeHandle()).EntryPoint(); |
| + ASSERT(Dart::vm_isolate()->heap()->CodeContains(new_entry)); |
| + func.StoreNonPointer(&func.raw_ptr()->entry_point_, new_entry); |
| } |
| return func.raw(); |
| } |
| @@ -695,7 +699,7 @@ void RawFunction::WriteTo(SnapshotWriter* writer, |
| writer->Write<uint16_t>(ptr()->optimized_call_site_count_); |
| // Write out all the object pointer fields. |
| - SnapshotWriterVisitor visitor(writer); |
| + SnapshotWriterVisitor visitor(writer, kAsInlinedObject); |
| visitor.VisitPointers(from(), writer->snapshot_code() ? to() |
| : to_snapshot()); |
| } |
| @@ -1159,9 +1163,12 @@ RawCode* Code::ReadFrom(SnapshotReader* reader, |
| // Set all the object fields. |
| READ_OBJECT_FIELDS(result, |
| result.raw()->from(), result.raw()->to(), |
| - kAsReference); |
| + kAsInlinedObject); |
| - // TODO(rmacnak): Fix entry_point_. |
| + // Fix entry point. |
| + uword new_entry = result.EntryPoint(); |
| + ASSERT(Dart::vm_isolate()->heap()->CodeContains(new_entry)); |
| + result.StoreNonPointer(&result.raw_ptr()->entry_point_, new_entry); |
| return result.raw(); |
| } |
| @@ -1195,7 +1202,7 @@ void RawCode::WriteTo(SnapshotWriter* writer, |
| writer->Write<int32_t>(ptr()->lazy_deopt_pc_offset_); |
| // Write out all the object pointer fields. |
| - SnapshotWriterVisitor visitor(writer); |
| + SnapshotWriterVisitor visitor(writer, kAsInlinedObject); |
| visitor.VisitPointers(from(), to()); |
| writer->SetInstructionsCode(ptr()->instructions_, this); |
| @@ -1216,12 +1223,6 @@ RawInstructions* Instructions::ReadFrom(SnapshotReader* reader, |
| reader->GetInstructionsAt(offset, full_tags)); |
| reader->AddBackRef(object_id, &result, kIsDeserialized); |
| - { |
| - // TODO(rmacnak): Drop after calling convention change. |
| - Code::CheckedHandle(reader->ReadObjectImpl(kAsReference)); |
| - ObjectPool::CheckedHandle(reader->ReadObjectImpl(kAsReference)); |
| - } |
| - |
| return result.raw(); |
| } |
| @@ -1232,21 +1233,26 @@ void RawInstructions::WriteTo(SnapshotWriter* writer, |
| ASSERT(writer->snapshot_code()); |
| ASSERT(kind == Snapshot::kFull); |
| - { |
| - // TODO(rmacnak): Drop after calling convention change. |
| - writer->WriteInlinedObjectHeader(object_id); |
| - writer->WriteVMIsolateObject(kInstructionsCid); |
| - writer->WriteTags(writer->GetObjectTags(this)); |
| - } |
| - |
| - writer->Write<intptr_t>(writer->GetObjectTags(this)); // For sanity check. |
| + writer->WriteInlinedObjectHeader(object_id); |
| + writer->WriteVMIsolateObject(kInstructionsCid); |
| + writer->WriteTags(writer->GetObjectTags(this)); |
| // Temporarily restore the object header for writing to the text section. |
| // TODO(asiva): Don't mutate object headers during serialization. |
|
siva
2015/09/15 23:22:01
Is this temporary restore of tags stuff necessary
rmacnak
2015/09/16 01:34:45
Dropped.
|
| uword object_tags = writer->GetObjectTags(this); |
| uword snapshot_tags = ptr()->tags_; |
| ptr()->tags_ = object_tags; |
| + |
| + // Instructions with be written pre-marked and in the VM heap. Write out |
| + // the tags we expect to find when reading the snapshot for a sanity check |
| + // that our offsets/alignment didn't get out of sync. |
| + uword written_tags = object_tags; |
| + written_tags = RawObject::VMHeapObjectTag::update(true, written_tags); |
| + written_tags = RawObject::MarkBit::update(true, written_tags); |
| + writer->Write<intptr_t>(written_tags); |
| + |
| writer->Write<int32_t>(writer->GetInstructionsId(this)); |
| + |
| ptr()->tags_ = snapshot_tags; |
| { |