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

Unified Diff: vm/raw_object_snapshot.cc

Issue 10446104: Use memmove instead of a loop to read bytes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 7 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 | 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 8158)
+++ vm/raw_object_snapshot.cc (working copy)
@@ -1215,9 +1215,7 @@
intptr_t len = reader->ReadIntptrValue();
char* str = reinterpret_cast<char*>(ZoneAllocator(len + 1));
str[len] = '\0';
- for (intptr_t i = 0; i < len; i++) {
- str[i] = reader->Read<uint8_t>();
- }
+ reader->ReadBytes(reinterpret_cast<uint8_t*>(str), len);
// Create a Bigint object from HexCString.
Bigint& obj = Bigint::ZoneHandle(
@@ -1386,11 +1384,9 @@
str_obj = obj;
str_obj.set_tags(tags);
obj->ptr()->hash_ = Smi::New(hash);
- uint8_t* raw_ptr = (len > 0) ? str_obj.CharAddr(0) : NULL;
- for (intptr_t i = 0; i < len; i++) {
- ASSERT(str_obj.CharAddr(i) == raw_ptr); // Will trigger assertions.
- *raw_ptr = reader->Read<uint8_t>();
- raw_ptr += 1;
+ if (len > 0) {
+ uint8_t* raw_ptr = str_obj.CharAddr(0);
+ reader->ReadBytes(raw_ptr, len);
}
ASSERT((hash == 0) || (String::Hash(str_obj, 0, str_obj.Length()) == hash));
} else {
« no previous file with comments | « no previous file | vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698