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

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

Issue 2807023003: [snapshot] encode resource before serializing. (Closed)
Patch Set: fix Created 3 years, 8 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/natives-common.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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 SnapshotByteSink* sink, HowToCode how_to_code, 273 SnapshotByteSink* sink, HowToCode how_to_code,
274 WhereToPoint where_to_point) 274 WhereToPoint where_to_point)
275 : serializer_(serializer), 275 : serializer_(serializer),
276 object_(obj), 276 object_(obj),
277 sink_(sink), 277 sink_(sink),
278 reference_representation_(how_to_code + where_to_point), 278 reference_representation_(how_to_code + where_to_point),
279 bytes_processed_so_far_(0), 279 bytes_processed_so_far_(0),
280 code_has_been_output_(false) {} 280 code_has_been_output_(false) {}
281 ~ObjectSerializer() override {} 281 ~ObjectSerializer() override {}
282 void Serialize(); 282 void Serialize();
283 void SerializeContent();
283 void SerializeDeferred(); 284 void SerializeDeferred();
284 void VisitPointers(Object** start, Object** end) override; 285 void VisitPointers(Object** start, Object** end) override;
285 void VisitEmbeddedPointer(RelocInfo* target) override; 286 void VisitEmbeddedPointer(RelocInfo* target) override;
286 void VisitExternalReference(Address* p) override; 287 void VisitExternalReference(Address* p) override;
287 void VisitExternalReference(RelocInfo* rinfo) override; 288 void VisitExternalReference(RelocInfo* rinfo) override;
288 void VisitInternalReference(RelocInfo* rinfo) override; 289 void VisitInternalReference(RelocInfo* rinfo) override;
289 void VisitCodeTarget(RelocInfo* target) override; 290 void VisitCodeTarget(RelocInfo* target) override;
290 void VisitCodeEntry(Address entry_address) override; 291 void VisitCodeEntry(Address entry_address) override;
291 void VisitCell(RelocInfo* rinfo) override; 292 void VisitCell(RelocInfo* rinfo) override;
292 void VisitRuntimeEntry(RelocInfo* reloc) override; 293 void VisitRuntimeEntry(RelocInfo* reloc) override;
293 294
294 private: 295 private:
295 bool TryEncodeDeoptimizationEntry(HowToCode how_to_code, Address target, 296 bool TryEncodeDeoptimizationEntry(HowToCode how_to_code, Address target,
296 int skip); 297 int skip);
297 void SerializePrologue(AllocationSpace space, int size, Map* map); 298 void SerializePrologue(AllocationSpace space, int size, Map* map);
298 299
299 300
300 enum ReturnSkip { kCanReturnSkipInsteadOfSkipping, kIgnoringReturn }; 301 enum ReturnSkip { kCanReturnSkipInsteadOfSkipping, kIgnoringReturn };
301 // This function outputs or skips the raw data between the last pointer and 302 // This function outputs or skips the raw data between the last pointer and
302 // up to the current position. It optionally can just return the number of 303 // up to the current position. It optionally can just return the number of
303 // bytes to skip instead of performing a skip instruction, in case the skip 304 // bytes to skip instead of performing a skip instruction, in case the skip
304 // can be merged into the next instruction. 305 // can be merged into the next instruction.
305 int OutputRawData(Address up_to, ReturnSkip return_skip = kIgnoringReturn); 306 int OutputRawData(Address up_to, ReturnSkip return_skip = kIgnoringReturn);
306 void SerializeExternalString(); 307 void SerializeExternalString();
307 void SerializeExternalStringAsSequentialString(); 308 void SerializeExternalStringAsSequentialString();
308 bool SerializeExternalNativeSourceString(
309 int builtin_count,
310 v8::String::ExternalOneByteStringResource** resource_pointer,
311 FixedArray* source_cache, int resource_index);
312 309
313 Address PrepareCode(); 310 Address PrepareCode();
314 311
315 Serializer* serializer_; 312 Serializer* serializer_;
316 HeapObject* object_; 313 HeapObject* object_;
317 SnapshotByteSink* sink_; 314 SnapshotByteSink* sink_;
318 int reference_representation_; 315 int reference_representation_;
319 int bytes_processed_so_far_; 316 int bytes_processed_so_far_;
320 bool code_has_been_output_; 317 bool code_has_been_output_;
321 }; 318 };
322 319
323 } // namespace internal 320 } // namespace internal
324 } // namespace v8 321 } // namespace v8
325 322
326 #endif // V8_SNAPSHOT_SERIALIZER_H_ 323 #endif // V8_SNAPSHOT_SERIALIZER_H_
OLDNEW
« no previous file with comments | « src/snapshot/natives-common.cc ('k') | src/snapshot/serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698