| 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_DESERIALIZER_H_ | 5 #ifndef V8_SNAPSHOT_DESERIALIZER_H_ |
| 6 #define V8_SNAPSHOT_DESERIALIZER_H_ | 6 #define V8_SNAPSHOT_DESERIALIZER_H_ |
| 7 | 7 |
| 8 #include "src/heap/heap.h" | 8 #include "src/heap/heap.h" |
| 9 #include "src/objects.h" | 9 #include "src/objects.h" |
| 10 #include "src/snapshot/serializer-common.h" | 10 #include "src/snapshot/serializer-common.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 // A Deserializer reads a snapshot and reconstructs the Object graph it defines. | 28 // A Deserializer reads a snapshot and reconstructs the Object graph it defines. |
| 29 class Deserializer : public SerializerDeserializer { | 29 class Deserializer : public SerializerDeserializer { |
| 30 public: | 30 public: |
| 31 // Create a deserializer from a snapshot byte source. | 31 // Create a deserializer from a snapshot byte source. |
| 32 template <class Data> | 32 template <class Data> |
| 33 explicit Deserializer(Data* data) | 33 explicit Deserializer(Data* data) |
| 34 : isolate_(NULL), | 34 : isolate_(NULL), |
| 35 source_(data->Payload()), | 35 source_(data->Payload()), |
| 36 magic_number_(data->GetMagicNumber()), | 36 magic_number_(data->GetMagicNumber()), |
| 37 next_map_index_(0), |
| 37 external_reference_table_(NULL), | 38 external_reference_table_(NULL), |
| 38 deserialized_large_objects_(0), | 39 deserialized_large_objects_(0), |
| 39 deserializing_user_code_(false), | 40 deserializing_user_code_(false), |
| 40 next_alignment_(kWordAligned) { | 41 next_alignment_(kWordAligned) { |
| 41 DecodeReservation(data->Reservations()); | 42 DecodeReservation(data->Reservations()); |
| 42 } | 43 } |
| 43 | 44 |
| 44 ~Deserializer() override; | 45 ~Deserializer() override; |
| 45 | 46 |
| 46 // Deserialize the snapshot into an empty heap. | 47 // Deserialize the snapshot into an empty heap. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 SnapshotByteSource source_; | 123 SnapshotByteSource source_; |
| 123 uint32_t magic_number_; | 124 uint32_t magic_number_; |
| 124 | 125 |
| 125 // The address of the next object that will be allocated in each space. | 126 // The address of the next object that will be allocated in each space. |
| 126 // Each space has a number of chunks reserved by the GC, with each chunk | 127 // Each space has a number of chunks reserved by the GC, with each chunk |
| 127 // fitting into a page. Deserialized objects are allocated into the | 128 // fitting into a page. Deserialized objects are allocated into the |
| 128 // current chunk of the target space by bumping up high water mark. | 129 // current chunk of the target space by bumping up high water mark. |
| 129 Heap::Reservation reservations_[kNumberOfSpaces]; | 130 Heap::Reservation reservations_[kNumberOfSpaces]; |
| 130 uint32_t current_chunk_[kNumberOfPreallocatedSpaces]; | 131 uint32_t current_chunk_[kNumberOfPreallocatedSpaces]; |
| 131 Address high_water_[kNumberOfPreallocatedSpaces]; | 132 Address high_water_[kNumberOfPreallocatedSpaces]; |
| 133 int next_map_index_; |
| 134 List<Address> allocated_maps_; |
| 132 | 135 |
| 133 ExternalReferenceTable* external_reference_table_; | 136 ExternalReferenceTable* external_reference_table_; |
| 134 | 137 |
| 135 List<HeapObject*> deserialized_large_objects_; | 138 List<HeapObject*> deserialized_large_objects_; |
| 136 List<Code*> new_code_objects_; | 139 List<Code*> new_code_objects_; |
| 137 List<Handle<String> > new_internalized_strings_; | 140 List<Handle<String> > new_internalized_strings_; |
| 138 List<Handle<Script> > new_scripts_; | 141 List<Handle<Script> > new_scripts_; |
| 139 | 142 |
| 140 bool deserializing_user_code_; | 143 bool deserializing_user_code_; |
| 141 | 144 |
| 142 AllocationAlignment next_alignment_; | 145 AllocationAlignment next_alignment_; |
| 143 | 146 |
| 144 DISALLOW_COPY_AND_ASSIGN(Deserializer); | 147 DISALLOW_COPY_AND_ASSIGN(Deserializer); |
| 145 }; | 148 }; |
| 146 | 149 |
| 147 } // namespace internal | 150 } // namespace internal |
| 148 } // namespace v8 | 151 } // namespace v8 |
| 149 | 152 |
| 150 #endif // V8_SNAPSHOT_DESERIALIZER_H_ | 153 #endif // V8_SNAPSHOT_DESERIALIZER_H_ |
| OLD | NEW |