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

Side by Side Diff: src/snapshot/serializer.h

Issue 2229583003: [serializer] reserve maps one by one to avoid fragmentation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix build Created 4 years, 4 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
« no previous file with comments | « src/snapshot/deserializer.cc ('k') | src/snapshot/serializer.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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_SERIALIZER_H_ 5 #ifndef V8_SNAPSHOT_SERIALIZER_H_
6 #define V8_SNAPSHOT_SERIALIZER_H_ 6 #define V8_SNAPSHOT_SERIALIZER_H_
7 7
8 #include "src/isolate.h" 8 #include "src/isolate.h"
9 #include "src/log.h" 9 #include "src/log.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 if (skip != 0) { 183 if (skip != 0) {
184 sink_.Put(kSkip, "SkipFromSerializeObject"); 184 sink_.Put(kSkip, "SkipFromSerializeObject");
185 sink_.PutInt(skip, "SkipDistanceFromSerializeObject"); 185 sink_.PutInt(skip, "SkipDistanceFromSerializeObject");
186 } 186 }
187 } 187 }
188 188
189 bool BackReferenceIsAlreadyAllocated(SerializerReference back_reference); 189 bool BackReferenceIsAlreadyAllocated(SerializerReference back_reference);
190 190
191 // This will return the space for an object. 191 // This will return the space for an object.
192 SerializerReference AllocateLargeObject(int size); 192 SerializerReference AllocateLargeObject(int size);
193 SerializerReference AllocateMap();
193 SerializerReference Allocate(AllocationSpace space, int size); 194 SerializerReference Allocate(AllocationSpace space, int size);
194 int EncodeExternalReference(Address addr) { 195 int EncodeExternalReference(Address addr) {
195 return external_reference_encoder_.Encode(addr); 196 return external_reference_encoder_.Encode(addr);
196 } 197 }
197 198
198 bool HasNotExceededFirstPageOfEachSpace(); 199 bool HasNotExceededFirstPageOfEachSpace();
199 200
200 // GetInt reads 4 bytes at once, requiring padding at the end. 201 // GetInt reads 4 bytes at once, requiring padding at the end.
201 void Pad(); 202 void Pad();
202 203
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 239
239 private: 240 private:
240 CodeAddressMap* code_address_map_; 241 CodeAddressMap* code_address_map_;
241 // Objects from the same space are put into chunks for bulk-allocation 242 // Objects from the same space are put into chunks for bulk-allocation
242 // when deserializing. We have to make sure that each chunk fits into a 243 // when deserializing. We have to make sure that each chunk fits into a
243 // page. So we track the chunk size in pending_chunk_ of a space, but 244 // page. So we track the chunk size in pending_chunk_ of a space, but
244 // when it exceeds a page, we complete the current chunk and start a new one. 245 // when it exceeds a page, we complete the current chunk and start a new one.
245 uint32_t pending_chunk_[kNumberOfPreallocatedSpaces]; 246 uint32_t pending_chunk_[kNumberOfPreallocatedSpaces];
246 List<uint32_t> completed_chunks_[kNumberOfPreallocatedSpaces]; 247 List<uint32_t> completed_chunks_[kNumberOfPreallocatedSpaces];
247 uint32_t max_chunk_size_[kNumberOfPreallocatedSpaces]; 248 uint32_t max_chunk_size_[kNumberOfPreallocatedSpaces];
249 // Number of maps that we need to allocate.
250 uint32_t num_maps_;
248 251
249 // We map serialized large objects to indexes for back-referencing. 252 // We map serialized large objects to indexes for back-referencing.
250 uint32_t large_objects_total_size_; 253 uint32_t large_objects_total_size_;
251 uint32_t seen_large_objects_index_; 254 uint32_t seen_large_objects_index_;
252 255
253 List<byte> code_buffer_; 256 List<byte> code_buffer_;
254 257
255 // To handle stack overflow. 258 // To handle stack overflow.
256 List<HeapObject*> deferred_objects_; 259 List<HeapObject*> deferred_objects_;
257 260
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 SnapshotByteSink* sink_; 323 SnapshotByteSink* sink_;
321 int reference_representation_; 324 int reference_representation_;
322 int bytes_processed_so_far_; 325 int bytes_processed_so_far_;
323 bool code_has_been_output_; 326 bool code_has_been_output_;
324 }; 327 };
325 328
326 } // namespace internal 329 } // namespace internal
327 } // namespace v8 330 } // namespace v8
328 331
329 #endif // V8_SNAPSHOT_SERIALIZER_H_ 332 #endif // V8_SNAPSHOT_SERIALIZER_H_
OLDNEW
« no previous file with comments | « src/snapshot/deserializer.cc ('k') | src/snapshot/serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698