OLD | NEW |
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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 void SerializeDeferred(); | 283 void SerializeDeferred(); |
284 void VisitPointers(Object** start, Object** end) override; | 284 void VisitPointers(Object** start, Object** end) override; |
285 void VisitEmbeddedPointer(RelocInfo* target) override; | 285 void VisitEmbeddedPointer(RelocInfo* target) override; |
286 void VisitExternalReference(Address* p) override; | 286 void VisitExternalReference(Address* p) override; |
287 void VisitExternalReference(RelocInfo* rinfo) override; | 287 void VisitExternalReference(RelocInfo* rinfo) override; |
288 void VisitInternalReference(RelocInfo* rinfo) override; | 288 void VisitInternalReference(RelocInfo* rinfo) override; |
289 void VisitCodeTarget(RelocInfo* target) override; | 289 void VisitCodeTarget(RelocInfo* target) override; |
290 void VisitCodeEntry(Address entry_address) override; | 290 void VisitCodeEntry(Address entry_address) override; |
291 void VisitCell(RelocInfo* rinfo) override; | 291 void VisitCell(RelocInfo* rinfo) override; |
292 void VisitRuntimeEntry(RelocInfo* reloc) override; | 292 void VisitRuntimeEntry(RelocInfo* reloc) override; |
293 // Used for seralizing the external strings that hold the natives source. | |
294 void VisitExternalOneByteString( | |
295 v8::String::ExternalOneByteStringResource** resource) override; | |
296 // We can't serialize a heap with external two byte strings. | |
297 void VisitExternalTwoByteString( | |
298 v8::String::ExternalStringResource** resource) override { | |
299 UNREACHABLE(); | |
300 } | |
301 | 293 |
302 private: | 294 private: |
303 bool TryEncodeDeoptimizationEntry(HowToCode how_to_code, Address target, | 295 bool TryEncodeDeoptimizationEntry(HowToCode how_to_code, Address target, |
304 int skip); | 296 int skip); |
305 void SerializePrologue(AllocationSpace space, int size, Map* map); | 297 void SerializePrologue(AllocationSpace space, int size, Map* map); |
306 | 298 |
307 bool SerializeExternalNativeSourceString( | |
308 int builtin_count, | |
309 v8::String::ExternalOneByteStringResource** resource_pointer, | |
310 FixedArray* source_cache, int resource_index); | |
311 | 299 |
312 enum ReturnSkip { kCanReturnSkipInsteadOfSkipping, kIgnoringReturn }; | 300 enum ReturnSkip { kCanReturnSkipInsteadOfSkipping, kIgnoringReturn }; |
313 // This function outputs or skips the raw data between the last pointer and | 301 // This function outputs or skips the raw data between the last pointer and |
314 // up to the current position. It optionally can just return the number of | 302 // up to the current position. It optionally can just return the number of |
315 // bytes to skip instead of performing a skip instruction, in case the skip | 303 // bytes to skip instead of performing a skip instruction, in case the skip |
316 // can be merged into the next instruction. | 304 // can be merged into the next instruction. |
317 int OutputRawData(Address up_to, ReturnSkip return_skip = kIgnoringReturn); | 305 int OutputRawData(Address up_to, ReturnSkip return_skip = kIgnoringReturn); |
318 // External strings are serialized in a way to resemble sequential strings. | |
319 void SerializeExternalString(); | 306 void SerializeExternalString(); |
| 307 void SerializeExternalStringAsSequentialString(); |
| 308 bool SerializeExternalNativeSourceString( |
| 309 int builtin_count, |
| 310 v8::String::ExternalOneByteStringResource** resource_pointer, |
| 311 FixedArray* source_cache, int resource_index); |
320 | 312 |
321 Address PrepareCode(); | 313 Address PrepareCode(); |
322 | 314 |
323 Serializer* serializer_; | 315 Serializer* serializer_; |
324 HeapObject* object_; | 316 HeapObject* object_; |
325 SnapshotByteSink* sink_; | 317 SnapshotByteSink* sink_; |
326 int reference_representation_; | 318 int reference_representation_; |
327 int bytes_processed_so_far_; | 319 int bytes_processed_so_far_; |
328 bool code_has_been_output_; | 320 bool code_has_been_output_; |
329 }; | 321 }; |
330 | 322 |
331 } // namespace internal | 323 } // namespace internal |
332 } // namespace v8 | 324 } // namespace v8 |
333 | 325 |
334 #endif // V8_SNAPSHOT_SERIALIZER_H_ | 326 #endif // V8_SNAPSHOT_SERIALIZER_H_ |
OLD | NEW |