| Index: runtime/vm/raw_object_snapshot.cc
|
| diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
|
| index db45e581e5b13f950eed3bac7a23d7762708d46e..c2d29319c81a0226db5a8fcc91e1a45be01da96a 100644
|
| --- a/runtime/vm/raw_object_snapshot.cc
|
| +++ b/runtime/vm/raw_object_snapshot.cc
|
| @@ -2292,7 +2292,7 @@ void RawFloat64x2::WriteTo(SnapshotWriter* writer,
|
|
|
|
|
| #define TYPED_DATA_READ(setter, type) \
|
| - for (intptr_t i = 0; i < lengthInBytes; i += element_size) { \
|
| + for (intptr_t i = 0; i < length_in_bytes; i += element_size) { \
|
| result.Set##setter(i, reader->Read<type>()); \
|
| } \
|
|
|
| @@ -2314,17 +2314,15 @@ RawTypedData* TypedData::ReadFrom(SnapshotReader* reader,
|
|
|
| // Setup the array elements.
|
| intptr_t element_size = ElementSizeInBytes(cid);
|
| - intptr_t lengthInBytes = len * element_size;
|
| + intptr_t length_in_bytes = len * element_size;
|
| switch (cid) {
|
| case kTypedDataInt8ArrayCid:
|
| - TYPED_DATA_READ(Int8, int8_t);
|
| - break;
|
| case kTypedDataUint8ArrayCid:
|
| - TYPED_DATA_READ(Uint8, uint8_t);
|
| - break;
|
| - case kTypedDataUint8ClampedArrayCid:
|
| - TYPED_DATA_READ(Uint8, uint8_t);
|
| + case kTypedDataUint8ClampedArrayCid: {
|
| + uint8_t* data = reinterpret_cast<uint8_t*>(result.DataAddr(0));
|
| + reader->ReadBytes(data, length_in_bytes);
|
| break;
|
| + }
|
| case kTypedDataInt16ArrayCid:
|
| TYPED_DATA_READ(Int16, int16_t);
|
| break;
|
| @@ -2406,14 +2404,12 @@ void RawTypedData::WriteTo(SnapshotWriter* writer,
|
| // Write out the array elements.
|
| switch (cid) {
|
| case kTypedDataInt8ArrayCid:
|
| - TYPED_DATA_WRITE(int8_t);
|
| - break;
|
| case kTypedDataUint8ArrayCid:
|
| - TYPED_DATA_WRITE(uint8_t);
|
| - break;
|
| - case kTypedDataUint8ClampedArrayCid:
|
| - TYPED_DATA_WRITE(uint8_t);
|
| + case kTypedDataUint8ClampedArrayCid: {
|
| + uint8_t* data = reinterpret_cast<uint8_t*>(ptr()->data_);
|
| + writer->WriteBytes(data, len);
|
| break;
|
| + }
|
| case kTypedDataInt16ArrayCid:
|
| TYPED_DATA_WRITE(int16_t);
|
| break;
|
|
|