| 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/deoptimizer.h" |
| 8 #include "src/heap/heap.h" | 9 #include "src/heap/heap.h" |
| 9 #include "src/objects.h" | 10 #include "src/objects.h" |
| 10 #include "src/snapshot/serializer-common.h" | 11 #include "src/snapshot/serializer-common.h" |
| 11 #include "src/snapshot/snapshot-source-sink.h" | 12 #include "src/snapshot/snapshot-source-sink.h" |
| 12 | 13 |
| 13 namespace v8 { | 14 namespace v8 { |
| 14 namespace internal { | 15 namespace internal { |
| 15 | 16 |
| 16 // Used for platforms with embedded constant pools to trigger deserialization | 17 // Used for platforms with embedded constant pools to trigger deserialization |
| 17 // of objects found in code. | 18 // of objects found in code. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 34 : isolate_(NULL), | 35 : isolate_(NULL), |
| 35 source_(data->Payload()), | 36 source_(data->Payload()), |
| 36 magic_number_(data->GetMagicNumber()), | 37 magic_number_(data->GetMagicNumber()), |
| 37 num_extra_references_(data->GetExtraReferences()), | 38 num_extra_references_(data->GetExtraReferences()), |
| 38 next_map_index_(0), | 39 next_map_index_(0), |
| 39 external_reference_table_(NULL), | 40 external_reference_table_(NULL), |
| 40 deserialized_large_objects_(0), | 41 deserialized_large_objects_(0), |
| 41 deserializing_user_code_(deserializing_user_code), | 42 deserializing_user_code_(deserializing_user_code), |
| 42 next_alignment_(kWordAligned) { | 43 next_alignment_(kWordAligned) { |
| 43 DecodeReservation(data->Reservations()); | 44 DecodeReservation(data->Reservations()); |
| 45 memset(max_deopt_entry_ids_, 0, sizeof(max_deopt_entry_ids_)); |
| 44 } | 46 } |
| 45 | 47 |
| 46 ~Deserializer() override; | 48 ~Deserializer() override; |
| 47 | 49 |
| 48 // Deserialize the snapshot into an empty heap. | 50 // Deserialize the snapshot into an empty heap. |
| 49 void Deserialize(Isolate* isolate); | 51 void Deserialize(Isolate* isolate); |
| 50 | 52 |
| 51 // Deserialize a single object and the objects reachable from it. | 53 // Deserialize a single object and the objects reachable from it. |
| 52 MaybeHandle<Object> DeserializePartial( | 54 MaybeHandle<Object> DeserializePartial( |
| 53 Isolate* isolate, Handle<JSGlobalProxy> global_proxy, | 55 Isolate* isolate, Handle<JSGlobalProxy> global_proxy, |
| 54 v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer); | 56 v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer); |
| 55 | 57 |
| 56 // Deserialize an object graph. Fail gracefully. | 58 // Deserialize an object graph. Fail gracefully. |
| 57 MaybeHandle<HeapObject> DeserializeObject(Isolate* isolate); | 59 MaybeHandle<HeapObject> DeserializeObject(Isolate* isolate); |
| 58 | 60 |
| 59 // Add an object to back an attached reference. The order to add objects must | 61 // Add an object to back an attached reference. The order to add objects must |
| 60 // mirror the order they are added in the serializer. | 62 // mirror the order they are added in the serializer. |
| 61 void AddAttachedObject(Handle<HeapObject> attached_object) { | 63 void AddAttachedObject(Handle<HeapObject> attached_object) { |
| 62 attached_objects_.Add(attached_object); | 64 attached_objects_.Add(attached_object); |
| 63 } | 65 } |
| 64 | 66 |
| 67 int max_deopt_entry_id(Deoptimizer::BailoutType bailout_type) const { |
| 68 return max_deopt_entry_ids_[bailout_type]; |
| 69 } |
| 70 |
| 65 private: | 71 private: |
| 72 Address DecodeExternalReference(uint32_t reference_id); |
| 66 void VisitPointers(Object** start, Object** end) override; | 73 void VisitPointers(Object** start, Object** end) override; |
| 67 | 74 |
| 68 void Synchronize(VisitorSynchronization::SyncTag tag) override; | 75 void Synchronize(VisitorSynchronization::SyncTag tag) override; |
| 69 | 76 |
| 70 void VisitRuntimeEntry(RelocInfo* rinfo) override { UNREACHABLE(); } | 77 void VisitRuntimeEntry(RelocInfo* rinfo) override { UNREACHABLE(); } |
| 71 | 78 |
| 72 void Initialize(Isolate* isolate); | 79 void Initialize(Isolate* isolate); |
| 73 | 80 |
| 74 bool deserializing_user_code() { return deserializing_user_code_; } | 81 bool deserializing_user_code() { return deserializing_user_code_; } |
| 75 | 82 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 151 |
| 145 List<HeapObject*> deserialized_large_objects_; | 152 List<HeapObject*> deserialized_large_objects_; |
| 146 List<Code*> new_code_objects_; | 153 List<Code*> new_code_objects_; |
| 147 List<AccessorInfo*> accessor_infos_; | 154 List<AccessorInfo*> accessor_infos_; |
| 148 List<Handle<String> > new_internalized_strings_; | 155 List<Handle<String> > new_internalized_strings_; |
| 149 List<Handle<Script> > new_scripts_; | 156 List<Handle<Script> > new_scripts_; |
| 150 | 157 |
| 151 bool deserializing_user_code_; | 158 bool deserializing_user_code_; |
| 152 | 159 |
| 153 AllocationAlignment next_alignment_; | 160 AllocationAlignment next_alignment_; |
| 161 int max_deopt_entry_ids_[Deoptimizer::kLastBailoutType + 1]; |
| 154 | 162 |
| 155 DISALLOW_COPY_AND_ASSIGN(Deserializer); | 163 DISALLOW_COPY_AND_ASSIGN(Deserializer); |
| 156 }; | 164 }; |
| 157 | 165 |
| 158 } // namespace internal | 166 } // namespace internal |
| 159 } // namespace v8 | 167 } // namespace v8 |
| 160 | 168 |
| 161 #endif // V8_SNAPSHOT_DESERIALIZER_H_ | 169 #endif // V8_SNAPSHOT_DESERIALIZER_H_ |
| OLD | NEW |