OLD | NEW |
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_SERIALIZE_H_ | 5 #ifndef V8_SERIALIZE_H_ |
6 #define V8_SERIALIZE_H_ | 6 #define V8_SERIALIZE_H_ |
7 | 7 |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/hashmap.h" | 9 #include "src/hashmap.h" |
10 #include "src/heap-profiler.h" | 10 #include "src/heap-profiler.h" |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 }; | 588 }; |
589 | 589 |
590 | 590 |
591 class CodeAddressMap; | 591 class CodeAddressMap; |
592 | 592 |
593 // There can be only one serializer per V8 process. | 593 // There can be only one serializer per V8 process. |
594 class Serializer : public SerializerDeserializer { | 594 class Serializer : public SerializerDeserializer { |
595 public: | 595 public: |
596 Serializer(Isolate* isolate, SnapshotByteSink* sink); | 596 Serializer(Isolate* isolate, SnapshotByteSink* sink); |
597 ~Serializer(); | 597 ~Serializer(); |
598 virtual void VisitPointers(Object** start, Object** end) OVERRIDE; | 598 void VisitPointers(Object** start, Object** end) OVERRIDE; |
599 | 599 |
600 void EncodeReservations(List<SerializedData::Reservation>* out) const; | 600 void EncodeReservations(List<SerializedData::Reservation>* out) const; |
601 | 601 |
602 Isolate* isolate() const { return isolate_; } | 602 Isolate* isolate() const { return isolate_; } |
603 | 603 |
604 BackReferenceMap* back_reference_map() { return &back_reference_map_; } | 604 BackReferenceMap* back_reference_map() { return &back_reference_map_; } |
605 RootIndexMap* root_index_map() { return &root_index_map_; } | 605 RootIndexMap* root_index_map() { return &root_index_map_; } |
606 | 606 |
607 protected: | 607 protected: |
608 class ObjectSerializer : public ObjectVisitor { | 608 class ObjectSerializer : public ObjectVisitor { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 // Clear the cache of objects used by the partial snapshot. After the | 773 // Clear the cache of objects used by the partial snapshot. After the |
774 // strong roots have been serialized we can create a partial snapshot | 774 // strong roots have been serialized we can create a partial snapshot |
775 // which will repopulate the cache with objects needed by that partial | 775 // which will repopulate the cache with objects needed by that partial |
776 // snapshot. | 776 // snapshot. |
777 isolate->set_serialize_partial_snapshot_cache_length(0); | 777 isolate->set_serialize_partial_snapshot_cache_length(0); |
778 InitializeCodeAddressMap(); | 778 InitializeCodeAddressMap(); |
779 } | 779 } |
780 | 780 |
781 // The StartupSerializer has to serialize the root array, which is slightly | 781 // The StartupSerializer has to serialize the root array, which is slightly |
782 // different. | 782 // different. |
783 virtual void VisitPointers(Object** start, Object** end) OVERRIDE; | 783 void VisitPointers(Object** start, Object** end) OVERRIDE; |
784 | 784 |
785 // Serialize the current state of the heap. The order is: | 785 // Serialize the current state of the heap. The order is: |
786 // 1) Strong references. | 786 // 1) Strong references. |
787 // 2) Partial snapshot cache. | 787 // 2) Partial snapshot cache. |
788 // 3) Weak references (e.g. the string table). | 788 // 3) Weak references (e.g. the string table). |
789 virtual void SerializeStrongReferences(); | 789 virtual void SerializeStrongReferences(); |
790 virtual void SerializeObject(HeapObject* o, HowToCode how_to_code, | 790 virtual void SerializeObject(HeapObject* o, HowToCode how_to_code, |
791 WhereToPoint where_to_point, int skip) OVERRIDE; | 791 WhereToPoint where_to_point, int skip) OVERRIDE; |
792 void SerializeWeakReferences(); | 792 void SerializeWeakReferences(); |
793 void Serialize() { | 793 void Serialize() { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 static const int kCheckSumOffset = 0; | 933 static const int kCheckSumOffset = 0; |
934 static const int kNumInternalizedStringsOffset = 1; | 934 static const int kNumInternalizedStringsOffset = 1; |
935 static const int kReservationsOffset = 2; | 935 static const int kReservationsOffset = 2; |
936 static const int kNumCodeStubKeysOffset = 3; | 936 static const int kNumCodeStubKeysOffset = 3; |
937 static const int kPayloadLengthOffset = 4; | 937 static const int kPayloadLengthOffset = 4; |
938 static const int kHeaderSize = (kPayloadLengthOffset + 1) * kIntSize; | 938 static const int kHeaderSize = (kPayloadLengthOffset + 1) * kIntSize; |
939 }; | 939 }; |
940 } } // namespace v8::internal | 940 } } // namespace v8::internal |
941 | 941 |
942 #endif // V8_SERIALIZE_H_ | 942 #endif // V8_SERIALIZE_H_ |
OLD | NEW |