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

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

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-external.cc ('k') | src/snapshot-source-sink.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_SNAPSHOT_SOURCE_SINK_H_ 5 #ifndef V8_SNAPSHOT_SOURCE_SINK_H_
6 #define V8_SNAPSHOT_SOURCE_SINK_H_ 6 #define V8_SNAPSHOT_SOURCE_SINK_H_
7 7
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/utils.h" 9 #include "src/utils.h"
10 10
(...skipping 21 matching lines...) Expand all
32 int32_t GetUnalignedInt(); 32 int32_t GetUnalignedInt();
33 33
34 void Advance(int by) { position_ += by; } 34 void Advance(int by) { position_ += by; }
35 35
36 void CopyRaw(byte* to, int number_of_bytes); 36 void CopyRaw(byte* to, int number_of_bytes);
37 37
38 inline int GetInt() { 38 inline int GetInt() {
39 // This way of variable-length encoding integers does not suffer from branch 39 // This way of variable-length encoding integers does not suffer from branch
40 // mispredictions. 40 // mispredictions.
41 uint32_t answer = GetUnalignedInt(); 41 uint32_t answer = GetUnalignedInt();
42 int bytes = answer & 3; 42 int bytes = (answer & 3) + 1;
43 Advance(bytes); 43 Advance(bytes);
44 uint32_t mask = 0xffffffffu; 44 uint32_t mask = 0xffffffffu;
45 mask >>= 32 - (bytes << 3); 45 mask >>= 32 - (bytes << 3);
46 answer &= mask; 46 answer &= mask;
47 answer >>= 2; 47 answer >>= 2;
48 return answer; 48 return answer;
49 } 49 }
50 50
51 bool GetBlob(const byte** data, int* number_of_bytes); 51 bool GetBlob(const byte** data, int* number_of_bytes);
52 52
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 virtual int Position() OVERRIDE { return data_->length(); } 116 virtual int Position() OVERRIDE { return data_->length(); }
117 117
118 private: 118 private:
119 i::List<byte>* data_; 119 i::List<byte>* data_;
120 }; 120 };
121 121
122 } // namespace v8::internal 122 } // namespace v8::internal
123 } // namespace v8 123 } // namespace v8
124 124
125 #endif // V8_SNAPSHOT_SOURCE_SINK_H_ 125 #endif // V8_SNAPSHOT_SOURCE_SINK_H_
OLDNEW
« no previous file with comments | « src/snapshot-external.cc ('k') | src/snapshot-source-sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698