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

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

Issue 581223004: Support large objects in the serializer/deserializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments 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
« no previous file with comments | « src/snapshot-source-sink.h ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 21 matching lines...) Expand all
32 } 32 }
33 33
34 34
35 void SnapshotByteSource::CopyRaw(byte* to, int number_of_bytes) { 35 void SnapshotByteSource::CopyRaw(byte* to, int number_of_bytes) {
36 MemCopy(to, data_ + position_, number_of_bytes); 36 MemCopy(to, data_ + position_, number_of_bytes);
37 position_ += number_of_bytes; 37 position_ += number_of_bytes;
38 } 38 }
39 39
40 40
41 void SnapshotByteSink::PutInt(uintptr_t integer, const char* description) { 41 void SnapshotByteSink::PutInt(uintptr_t integer, const char* description) {
42 DCHECK(integer < 1 << 22); 42 DCHECK(integer < 1 << 30);
43 integer <<= 2; 43 integer <<= 2;
44 int bytes = 1; 44 int bytes = 1;
45 if (integer > 0xff) bytes = 2; 45 if (integer > 0xff) bytes = 2;
46 if (integer > 0xffff) bytes = 3; 46 if (integer > 0xffff) bytes = 3;
47 integer |= bytes; 47 if (integer > 0xffffff) bytes = 4;
48 integer |= (bytes - 1);
48 Put(static_cast<int>(integer & 0xff), "IntPart1"); 49 Put(static_cast<int>(integer & 0xff), "IntPart1");
49 if (bytes > 1) Put(static_cast<int>((integer >> 8) & 0xff), "IntPart2"); 50 if (bytes > 1) Put(static_cast<int>((integer >> 8) & 0xff), "IntPart2");
50 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");
51 } 53 }
52 54
53 void SnapshotByteSink::PutRaw(byte* data, int number_of_bytes, 55 void SnapshotByteSink::PutRaw(byte* data, int number_of_bytes,
54 const char* description) { 56 const char* description) {
55 for (int i = 0; i < number_of_bytes; ++i) { 57 for (int i = 0; i < number_of_bytes; ++i) {
56 Put(data[i], description); 58 Put(data[i], description);
57 } 59 }
58 } 60 }
59 61
60 void SnapshotByteSink::PutBlob(byte* data, int number_of_bytes, 62 void SnapshotByteSink::PutBlob(byte* data, int number_of_bytes,
(...skipping 27 matching lines...) Expand all
88 } 90 }
89 91
90 92
91 void DebugSnapshotSink::Put(byte b, const char* description) { 93 void DebugSnapshotSink::Put(byte b, const char* description) {
92 PrintF("%24s: %x\n", description, b); 94 PrintF("%24s: %x\n", description, b);
93 sink_->Put(b, description); 95 sink_->Put(b, description);
94 } 96 }
95 97
96 } // namespace v8::internal 98 } // namespace v8::internal
97 } // namespace v8 99 } // namespace v8
OLDNEW
« no previous file with comments | « src/snapshot-source-sink.h ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698