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..57da683997e6f41e4b4658a8b64479ded0f0a24d 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,28 @@ 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. |
| uword object_tags = writer->GetObjectTags(this); |
| uword snapshot_tags = ptr()->tags_; |
| ptr()->tags_ = object_tags; |
| + |
| + bool was_marked = IsMarked(); |
| + bool was_vmheap = IsVMHeapObject(); |
| + |
| + if (!was_marked) { |
| + SetMarkBit(); |
| + } |
| + if (!was_vmheap) { |
| + SetVMHeapObject(); |
| + } |
|
siva
2015/09/14 21:29:34
can we have a local variable tags and do all this
rmacnak
2015/09/15 20:07:45
Done.
|
| + writer->Write<intptr_t>(ptr()->tags_); // For sanity check. |
| writer->Write<int32_t>(writer->GetInstructionsId(this)); |
| + |
| ptr()->tags_ = snapshot_tags; |
| { |