| 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, bool deserializing_user_code = false) | 33 explicit Deserializer(Data* data, bool deserializing_user_code = false) |
| 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 num_extra_references_(data->GetExtraReferences()), |
| 37 next_map_index_(0), | 38 next_map_index_(0), |
| 38 external_reference_table_(NULL), | 39 external_reference_table_(NULL), |
| 39 deserialized_large_objects_(0), | 40 deserialized_large_objects_(0), |
| 40 deserializing_user_code_(deserializing_user_code), | 41 deserializing_user_code_(deserializing_user_code), |
| 41 next_alignment_(kWordAligned) { | 42 next_alignment_(kWordAligned) { |
| 42 DecodeReservation(data->Reservations()); | 43 DecodeReservation(data->Reservations()); |
| 43 } | 44 } |
| 44 | 45 |
| 45 ~Deserializer() override; | 46 ~Deserializer() override; |
| 46 | 47 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 Object** current); | 119 Object** current); |
| 119 | 120 |
| 120 // Cached current isolate. | 121 // Cached current isolate. |
| 121 Isolate* isolate_; | 122 Isolate* isolate_; |
| 122 | 123 |
| 123 // Objects from the attached object descriptions in the serialized user code. | 124 // Objects from the attached object descriptions in the serialized user code. |
| 124 List<Handle<HeapObject> > attached_objects_; | 125 List<Handle<HeapObject> > attached_objects_; |
| 125 | 126 |
| 126 SnapshotByteSource source_; | 127 SnapshotByteSource source_; |
| 127 uint32_t magic_number_; | 128 uint32_t magic_number_; |
| 129 uint32_t num_extra_references_; |
| 128 | 130 |
| 129 // The address of the next object that will be allocated in each space. | 131 // The address of the next object that will be allocated in each space. |
| 130 // Each space has a number of chunks reserved by the GC, with each chunk | 132 // Each space has a number of chunks reserved by the GC, with each chunk |
| 131 // fitting into a page. Deserialized objects are allocated into the | 133 // fitting into a page. Deserialized objects are allocated into the |
| 132 // current chunk of the target space by bumping up high water mark. | 134 // current chunk of the target space by bumping up high water mark. |
| 133 Heap::Reservation reservations_[kNumberOfSpaces]; | 135 Heap::Reservation reservations_[kNumberOfSpaces]; |
| 134 uint32_t current_chunk_[kNumberOfPreallocatedSpaces]; | 136 uint32_t current_chunk_[kNumberOfPreallocatedSpaces]; |
| 135 Address high_water_[kNumberOfPreallocatedSpaces]; | 137 Address high_water_[kNumberOfPreallocatedSpaces]; |
| 136 int next_map_index_; | 138 int next_map_index_; |
| 137 List<Address> allocated_maps_; | 139 List<Address> allocated_maps_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 148 | 150 |
| 149 AllocationAlignment next_alignment_; | 151 AllocationAlignment next_alignment_; |
| 150 | 152 |
| 151 DISALLOW_COPY_AND_ASSIGN(Deserializer); | 153 DISALLOW_COPY_AND_ASSIGN(Deserializer); |
| 152 }; | 154 }; |
| 153 | 155 |
| 154 } // namespace internal | 156 } // namespace internal |
| 155 } // namespace v8 | 157 } // namespace v8 |
| 156 | 158 |
| 157 #endif // V8_SNAPSHOT_DESERIALIZER_H_ | 159 #endif // V8_SNAPSHOT_DESERIALIZER_H_ |
| OLD | NEW |