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

Unified Diff: vm/raw_object_snapshot.cc

Issue 10665035: Prepare for writing token streams directly into a snapshot and reading it directly from the snapsho… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 6 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 | « vm/datastream.h ('k') | vm/snapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/raw_object_snapshot.cc
===================================================================
--- vm/raw_object_snapshot.cc (revision 9070)
+++ vm/raw_object_snapshot.cc (working copy)
@@ -1278,9 +1278,7 @@
} else {
writer->WriteIntptrValue(len - 2);
}
- for (intptr_t i = 2; i < len; i++) {
- writer->Write<uint8_t>(str[i]);
- }
+ writer->WriteBytes(reinterpret_cast<const uint8_t*>(&(str[2])), (len - 2));
}
@@ -1488,8 +1486,14 @@
writer->Write<RawObject*>(hash);
// Write out the string.
- for (intptr_t i = 0; i < len; i++) {
- writer->Write(data[i]);
+ if (len > 0) {
+ if (class_id == ObjectStore::kOneByteStringClass) {
+ writer->WriteBytes(reinterpret_cast<const uint8_t*>(data), len);
+ } else {
+ for (intptr_t i = 0; i < len; i++) {
+ writer->Write(data[i]);
+ }
+ }
}
}
« no previous file with comments | « vm/datastream.h ('k') | vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698