| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Deserialize the snapshot into an empty heap. | 46 // Deserialize the snapshot into an empty heap. |
| 47 void Deserialize(Isolate* isolate); | 47 void Deserialize(Isolate* isolate); |
| 48 | 48 |
| 49 // Deserialize a single object and the objects reachable from it. | 49 // Deserialize a single object and the objects reachable from it. |
| 50 MaybeHandle<Object> DeserializePartial(Isolate* isolate, | 50 MaybeHandle<Object> DeserializePartial(Isolate* isolate, |
| 51 Handle<JSGlobalProxy> global_proxy); | 51 Handle<JSGlobalProxy> global_proxy); |
| 52 | 52 |
| 53 // Deserialize a shared function info. Fail gracefully. | 53 // Deserialize a shared function info. Fail gracefully. |
| 54 MaybeHandle<SharedFunctionInfo> DeserializeCode(Isolate* isolate); | 54 MaybeHandle<SharedFunctionInfo> DeserializeCode(Isolate* isolate); |
| 55 | 55 |
| 56 // Pass a vector of externally-provided objects referenced by the snapshot. | 56 // Add an object to back an attached reference. The order to add objects must |
| 57 // The ownership to its backing store is handed over as well. | 57 // mirror the order they are added in the serializer. |
| 58 void SetAttachedObjects(Vector<Handle<Object> > attached_objects) { | 58 void AddAttachedObject(Handle<HeapObject> attached_object) { |
| 59 attached_objects_ = attached_objects; | 59 attached_objects_.Add(attached_object); |
| 60 } | 60 } |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 void VisitPointers(Object** start, Object** end) override; | 63 void VisitPointers(Object** start, Object** end) override; |
| 64 | 64 |
| 65 void Synchronize(VisitorSynchronization::SyncTag tag) override; | 65 void Synchronize(VisitorSynchronization::SyncTag tag) override; |
| 66 | 66 |
| 67 void VisitRuntimeEntry(RelocInfo* rinfo) override { UNREACHABLE(); } | 67 void VisitRuntimeEntry(RelocInfo* rinfo) override { UNREACHABLE(); } |
| 68 | 68 |
| 69 void Initialize(Isolate* isolate); | 69 void Initialize(Isolate* isolate); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // snapshot by chunk index and offset. | 110 // snapshot by chunk index and offset. |
| 111 HeapObject* GetBackReferencedObject(int space); | 111 HeapObject* GetBackReferencedObject(int space); |
| 112 | 112 |
| 113 Object** CopyInNativesSource(Vector<const char> source_vector, | 113 Object** CopyInNativesSource(Vector<const char> source_vector, |
| 114 Object** current); | 114 Object** current); |
| 115 | 115 |
| 116 // Cached current isolate. | 116 // Cached current isolate. |
| 117 Isolate* isolate_; | 117 Isolate* isolate_; |
| 118 | 118 |
| 119 // Objects from the attached object descriptions in the serialized user code. | 119 // Objects from the attached object descriptions in the serialized user code. |
| 120 Vector<Handle<Object> > attached_objects_; | 120 List<Handle<HeapObject> > attached_objects_; |
| 121 | 121 |
| 122 SnapshotByteSource source_; | 122 SnapshotByteSource source_; |
| 123 uint32_t magic_number_; | 123 uint32_t magic_number_; |
| 124 | 124 |
| 125 // The address of the next object that will be allocated in each space. | 125 // 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 | 126 // 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 | 127 // fitting into a page. Deserialized objects are allocated into the |
| 128 // current chunk of the target space by bumping up high water mark. | 128 // current chunk of the target space by bumping up high water mark. |
| 129 Heap::Reservation reservations_[kNumberOfSpaces]; | 129 Heap::Reservation reservations_[kNumberOfSpaces]; |
| 130 uint32_t current_chunk_[kNumberOfPreallocatedSpaces]; | 130 uint32_t current_chunk_[kNumberOfPreallocatedSpaces]; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 141 | 141 |
| 142 AllocationAlignment next_alignment_; | 142 AllocationAlignment next_alignment_; |
| 143 | 143 |
| 144 DISALLOW_COPY_AND_ASSIGN(Deserializer); | 144 DISALLOW_COPY_AND_ASSIGN(Deserializer); |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 } // namespace internal | 147 } // namespace internal |
| 148 } // namespace v8 | 148 } // namespace v8 |
| 149 | 149 |
| 150 #endif // V8_SNAPSHOT_DESERIALIZER_H_ | 150 #endif // V8_SNAPSHOT_DESERIALIZER_H_ |
| OLD | NEW |