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

Unified Diff: runtime/vm/dart_api_message.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 | « no previous file | runtime/vm/raw_object_snapshot.cc » ('j') | runtime/vm/raw_object_snapshot.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_message.cc
diff --git a/runtime/vm/dart_api_message.cc b/runtime/vm/dart_api_message.cc
index 123d5352a67b994dbd2891d9939206ba2896b63c..8f089d3764283a13bad31de27fa453042558f801 100644
--- a/runtime/vm/dart_api_message.cc
+++ b/runtime/vm/dart_api_message.cc
@@ -600,12 +600,16 @@ Dart_CObject* ApiMessageReader::ReadInternalVMObject(intptr_t class_id,
return object;
}
-#define READ_TYPED_DATA(type, ctype) \
- { \
+#define READ_TYPED_DATA_HEADER(type) \
intptr_t len = ReadSmiValue(); \
Dart_CObject* object = \
- AllocateDartCObjectTypedData(Dart_TypedData_k##type, len); \
+ AllocateDartCObjectTypedData(Dart_TypedData_k##type, len); \
AddBackRef(object_id, object, kIsDeserialized); \
+
+
+#define READ_TYPED_DATA(type, ctype) \
+ { \
+ READ_TYPED_DATA_HEADER(type); \
if (len > 0) { \
ctype* p = \
reinterpret_cast<ctype*>(object->value.as_typed_data.values); \
@@ -617,12 +621,26 @@ Dart_CObject* ApiMessageReader::ReadInternalVMObject(intptr_t class_id,
} \
case kTypedDataInt8ArrayCid:
- case kExternalTypedDataInt8ArrayCid:
- READ_TYPED_DATA(Int8, int8_t);
+ case kExternalTypedDataInt8ArrayCid: {
+ READ_TYPED_DATA_HEADER(Int8);
+ if (len > 0) {
+ uint8_t* p =
+ reinterpret_cast<uint8_t*>(object->value.as_typed_data.values);
+ ReadBytes(p, len);
+ }
+ return object;
+ }
case kTypedDataUint8ArrayCid:
- case kExternalTypedDataUint8ArrayCid:
- READ_TYPED_DATA(Uint8, uint8_t);
+ case kExternalTypedDataUint8ArrayCid: {
+ READ_TYPED_DATA_HEADER(Uint8);
+ if (len > 0) {
+ uint8_t* p =
+ reinterpret_cast<uint8_t*>(object->value.as_typed_data.values);
+ ReadBytes(p, len);
+ }
+ return object;
+ }
case kTypedDataUint8ClampedArrayCid:
case kExternalTypedDataUint8ClampedArrayCid:
« no previous file with comments | « no previous file | runtime/vm/raw_object_snapshot.cc » ('j') | runtime/vm/raw_object_snapshot.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698