Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(936)

Unified Diff: runtime/vm/raw_object_snapshot.cc

Issue 221943002: Speed up snapshots of *int8lists, by using memmove. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698