Index: runtime/vm/raw_object_snapshot.cc |
=================================================================== |
--- runtime/vm/raw_object_snapshot.cc (revision 37367) |
+++ runtime/vm/raw_object_snapshot.cc (working copy) |
@@ -510,7 +510,7 @@ |
// Write out the individual types. |
intptr_t len = Smi::Value(ptr()->length_); |
for (intptr_t i = 0; i < len; i++) { |
- writer->WriteObjectImpl(ptr()->types_[i]); |
+ writer->WriteObjectImpl(ptr()->types()[i]); |
} |
} |
@@ -705,13 +705,13 @@ |
// Set all the object fields. |
// TODO(5411462): Need to assert No GC can happen here, even though |
// allocations may happen. |
- intptr_t num_flds = (func.raw()->to() - func.raw()->from()); |
+ intptr_t num_flds = (func.raw()->to_snapshot() - func.raw()->from()); |
for (intptr_t i = 0; i <= num_flds; i++) { |
*(func.raw()->from() + i) = reader->ReadObjectRef(); |
} |
- // Set up code pointer with the lazy-compile-stub. |
- func.SetInstructions(Code::Handle(StubCode::LazyCompile_entry()->code())); |
+ // Initialize all fields that are not part of the snapshot. |
+ func.ClearCode(); |
return func.raw(); |
} |
@@ -745,11 +745,7 @@ |
// Write out all the object pointer fields. |
SnapshotWriterVisitor visitor(writer); |
- visitor.VisitPointers(from(), to_no_code()); |
- |
- // Write null for the instructions and unoptimized code. |
- writer->WriteVMIsolateObject(kNullObject); |
- writer->WriteVMIsolateObject(kNullObject); |
+ visitor.VisitPointers(from(), to_snapshot()); |
} |
@@ -1981,7 +1977,7 @@ |
writer->GetObjectTags(this), |
ptr()->length_, |
ptr()->hash_, |
- ptr()->data_); |
+ ptr()->data()); |
} |
@@ -1995,7 +1991,7 @@ |
writer->GetObjectTags(this), |
ptr()->length_, |
ptr()->hash_, |
- ptr()->data_); |
+ ptr()->data()); |
} |
@@ -2395,7 +2391,7 @@ |
#define TYPED_DATA_WRITE(type) \ |
{ \ |
- type* data = reinterpret_cast<type*>(ptr()->data_); \ |
+ type* data = reinterpret_cast<type*>(ptr()->data()); \ |
for (intptr_t i = 0; i < len; i++) { \ |
writer->Write(data[i]); \ |
} \ |
@@ -2425,7 +2421,7 @@ |
case kTypedDataInt8ArrayCid: |
case kTypedDataUint8ArrayCid: |
case kTypedDataUint8ClampedArrayCid: { |
- uint8_t* data = reinterpret_cast<uint8_t*>(ptr()->data_); |
+ uint8_t* data = reinterpret_cast<uint8_t*>(ptr()->data()); |
writer->WriteBytes(data, len); |
break; |
} |
@@ -2459,11 +2455,20 @@ |
} |
+#define TYPED_EXT_DATA_WRITE(type) \ |
+ { \ |
+ type* data = reinterpret_cast<type*>(ptr()->data_); \ |
+ for (intptr_t i = 0; i < len; i++) { \ |
+ writer->Write(data[i]); \ |
+ } \ |
+ } \ |
+ |
+ |
#define EXT_TYPED_DATA_WRITE(cid, type) \ |
writer->WriteIndexedObject(cid); \ |
writer->WriteIntptrValue(RawObject::ClassIdTag::update(cid, tags)); \ |
writer->Write<RawObject*>(ptr()->length_); \ |
- TYPED_DATA_WRITE(type) \ |
+ TYPED_EXT_DATA_WRITE(type) \ |
void RawExternalTypedData::WriteTo(SnapshotWriter* writer, |