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_SNAPSHOT_SERIALIZE_H_ | 5 #ifndef V8_SNAPSHOT_SERIALIZE_H_ |
6 #define V8_SNAPSHOT_SERIALIZE_H_ | 6 #define V8_SNAPSHOT_SERIALIZE_H_ |
7 | 7 |
8 #include "src/address-map.h" | 8 #include "src/address-map.h" |
9 #include "src/heap/heap.h" | 9 #include "src/heap/heap.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 }; | 129 }; |
130 | 130 |
131 | 131 |
132 // The Serializer/Deserializer class is a common superclass for Serializer and | 132 // The Serializer/Deserializer class is a common superclass for Serializer and |
133 // Deserializer which is used to store common constants and methods used by | 133 // Deserializer which is used to store common constants and methods used by |
134 // both. | 134 // both. |
135 class SerializerDeserializer: public ObjectVisitor { | 135 class SerializerDeserializer: public ObjectVisitor { |
136 public: | 136 public: |
137 static void Iterate(Isolate* isolate, ObjectVisitor* visitor); | 137 static void Iterate(Isolate* isolate, ObjectVisitor* visitor); |
138 | 138 |
139 static int nop() { return kNop; } | |
140 | |
141 // No reservation for large object space necessary. | 139 // No reservation for large object space necessary. |
142 static const int kNumberOfPreallocatedSpaces = LAST_PAGED_SPACE + 1; | 140 static const int kNumberOfPreallocatedSpaces = LAST_PAGED_SPACE + 1; |
143 static const int kNumberOfSpaces = LAST_SPACE + 1; | 141 static const int kNumberOfSpaces = LAST_SPACE + 1; |
144 | 142 |
145 protected: | 143 protected: |
146 static bool CanBeDeferred(HeapObject* o); | 144 static bool CanBeDeferred(HeapObject* o); |
147 | 145 |
148 // ---------- byte code range 0x00..0x7f ---------- | 146 // ---------- byte code range 0x00..0x7f ---------- |
149 // Byte codes in this range represent Where, HowToCode and WhereToPoint. | 147 // Byte codes in this range represent Where, HowToCode and WhereToPoint. |
150 // Where the pointed-to object can be found: | 148 // Where the pointed-to object can be found: |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 void VisitPointers(Object** start, Object** end) override; | 644 void VisitPointers(Object** start, Object** end) override; |
647 | 645 |
648 // Serialize the current state of the heap. The order is: | 646 // Serialize the current state of the heap. The order is: |
649 // 1) Strong references. | 647 // 1) Strong references. |
650 // 2) Partial snapshot cache. | 648 // 2) Partial snapshot cache. |
651 // 3) Weak references (e.g. the string table). | 649 // 3) Weak references (e.g. the string table). |
652 virtual void SerializeStrongReferences(); | 650 virtual void SerializeStrongReferences(); |
653 void SerializeObject(HeapObject* o, HowToCode how_to_code, | 651 void SerializeObject(HeapObject* o, HowToCode how_to_code, |
654 WhereToPoint where_to_point, int skip) override; | 652 WhereToPoint where_to_point, int skip) override; |
655 void SerializeWeakReferencesAndDeferred(); | 653 void SerializeWeakReferencesAndDeferred(); |
656 void Serialize() { | |
657 SerializeStrongReferences(); | |
658 SerializeWeakReferencesAndDeferred(); | |
659 } | |
660 | 654 |
661 private: | 655 private: |
662 intptr_t root_index_wave_front_; | 656 intptr_t root_index_wave_front_; |
663 DISALLOW_COPY_AND_ASSIGN(StartupSerializer); | 657 DISALLOW_COPY_AND_ASSIGN(StartupSerializer); |
664 }; | 658 }; |
665 | 659 |
666 | 660 |
667 class CodeSerializer : public Serializer { | 661 class CodeSerializer : public Serializer { |
668 public: | 662 public: |
669 static ScriptData* Serialize(Isolate* isolate, | 663 static ScriptData* Serialize(Isolate* isolate, |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size; | 801 static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size; |
808 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; | 802 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; |
809 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; | 803 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; |
810 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size; | 804 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size; |
811 static const int kHeaderSize = kChecksum2Offset + kInt32Size; | 805 static const int kHeaderSize = kChecksum2Offset + kInt32Size; |
812 }; | 806 }; |
813 } // namespace internal | 807 } // namespace internal |
814 } // namespace v8 | 808 } // namespace v8 |
815 | 809 |
816 #endif // V8_SNAPSHOT_SERIALIZE_H_ | 810 #endif // V8_SNAPSHOT_SERIALIZE_H_ |
OLD | NEW |