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 da3c3a646719b30974de152695bc6150a87bc1f3..1097091afc10a4e308e38fdd8b5093086aff51d6 100644 |
| --- a/runtime/vm/raw_object_snapshot.cc |
| +++ b/runtime/vm/raw_object_snapshot.cc |
| @@ -11,6 +11,8 @@ |
| namespace dart { |
| +DECLARE_FLAG(int, optimization_counter_threshold); |
| + |
| #define NEW_OBJECT(type) \ |
| ((kind == Snapshot::kFull) ? reader->New##type() : type::New()) |
| @@ -728,7 +730,11 @@ void RawFunction::WriteTo(SnapshotWriter* writer, |
| // Write out all the non object fields. |
| writer->Write<int32_t>(ptr()->token_pos_); |
| writer->Write<int32_t>(ptr()->end_token_pos_); |
| - writer->Write<int32_t>(ptr()->usage_counter_); |
| + if (Code::IsOptimized(ptr()->instructions_->ptr()->code_)) { |
|
srdjan
2015/08/31 22:17:18
Why are you not doing:
ptr()->instructions_->ptr(
siva
2015/08/31 23:00:19
This is better, I changed the code.
siva
2015/08/31 23:14:27
Actually I take that back, the reason I did that w
|
| + writer->Write<int32_t>(FLAG_optimization_counter_threshold); |
|
hausner
2015/08/31 22:36:48
Can the snapshot be written in a VM instance where
siva
2015/08/31 23:00:19
Discussed offline with Srdjan, there should not be
|
| + } else { |
| + writer->Write<int32_t>(0); |
| + } |
| writer->Write<int16_t>(ptr()->num_fixed_parameters_); |
| writer->Write<int16_t>(ptr()->num_optional_parameters_); |
| writer->Write<int16_t>(ptr()->deoptimization_counter_); |
| @@ -1024,13 +1030,18 @@ RawLibrary* Library::ReadFrom(SnapshotReader* reader, |
| // Set all the object fields. |
| // TODO(5411462): Need to assert No GC can happen here, even though |
| // allocations may happen. |
| - intptr_t num_flds = (library.raw()->to() - library.raw()->from()); |
| + RawObject** toobj = (kind == Snapshot::kFull) ? |
| + library.raw()->to() : library.raw()->to_snapshot(); |
| + intptr_t num_flds = (toobj - library.raw()->from()); |
| for (intptr_t i = 0; i <= num_flds; i++) { |
| (*reader->PassiveObjectHandle()) = reader->ReadObjectImpl(kAsReference); |
| library.StorePointer((library.raw()->from() + i), |
| reader->PassiveObjectHandle()->raw()); |
| } |
| if (kind != Snapshot::kFull) { |
| + // The cache of resolved names in library scope is not serialized. |
| + const intptr_t kInitialNameCacheSize = 64; |
| + library.InitResolvedNamesCache(kInitialNameCacheSize); |
| library.Register(); |
| } |
| } |
| @@ -1076,8 +1087,9 @@ void RawLibrary::WriteTo(SnapshotWriter* writer, |
| // be rebuilt lazily. |
| // Write out all the object pointer fields. |
| + RawObject** toobj = (kind == Snapshot::kFull) ? to() : to_snapshot(); |
| SnapshotWriterVisitor visitor(writer); |
| - visitor.VisitPointers(from(), to()); |
| + visitor.VisitPointers(from(), toobj); |
| } |
| } |