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

Side by Side Diff: src/snapshot-source-sink.cc

Issue 671633004: Make block writes in the serializer more efficient. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 #include "src/snapshot-source-sink.h" 6 #include "src/snapshot-source-sink.h"
7 7
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/handles-inl.h" 9 #include "src/handles-inl.h"
10 #include "src/serialize.h" // for SerializerDeserializer::nop() in AtEOF() 10 #include "src/serialize.h" // for SerializerDeserializer::nop() in AtEOF()
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 if (integer > 0xffffff) bytes = 4; 47 if (integer > 0xffffff) bytes = 4;
48 integer |= (bytes - 1); 48 integer |= (bytes - 1);
49 Put(static_cast<int>(integer & 0xff), "IntPart1"); 49 Put(static_cast<int>(integer & 0xff), "IntPart1");
50 if (bytes > 1) Put(static_cast<int>((integer >> 8) & 0xff), "IntPart2"); 50 if (bytes > 1) Put(static_cast<int>((integer >> 8) & 0xff), "IntPart2");
51 if (bytes > 2) Put(static_cast<int>((integer >> 16) & 0xff), "IntPart3"); 51 if (bytes > 2) Put(static_cast<int>((integer >> 16) & 0xff), "IntPart3");
52 if (bytes > 3) Put(static_cast<int>((integer >> 24) & 0xff), "IntPart4"); 52 if (bytes > 3) Put(static_cast<int>((integer >> 24) & 0xff), "IntPart4");
53 } 53 }
54 54
55 void SnapshotByteSink::PutRaw(byte* data, int number_of_bytes, 55 void SnapshotByteSink::PutRaw(byte* data, int number_of_bytes,
56 const char* description) { 56 const char* description) {
57 for (int i = 0; i < number_of_bytes; ++i) { 57 data_.AddAll(Vector<byte>(data, number_of_bytes));
58 Put(data[i], description);
59 }
60 } 58 }
61 59
62 void SnapshotByteSink::PutBlob(byte* data, int number_of_bytes, 60 void SnapshotByteSink::PutBlob(byte* data, int number_of_bytes,
63 const char* description) { 61 const char* description) {
64 PutInt(number_of_bytes, description); 62 PutInt(number_of_bytes, description);
65 PutRaw(data, number_of_bytes, description); 63 PutRaw(data, number_of_bytes, description);
66 } 64 }
67 65
68 66
69 bool SnapshotByteSource::AtEOF() { 67 bool SnapshotByteSource::AtEOF() {
(...skipping 14 matching lines...) Expand all
84 Advance(size); 82 Advance(size);
85 return true; 83 return true;
86 } else { 84 } else {
87 Advance(length_ - position_); // proceed until end. 85 Advance(length_ - position_); // proceed until end.
88 return false; 86 return false;
89 } 87 }
90 } 88 }
91 89
92 } // namespace v8::internal 90 } // namespace v8::internal
93 } // namespace v8 91 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698