| 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 next_alignment_(kWordAligned) { | 366 next_alignment_(kWordAligned) { |
| 367 DecodeReservation(data->Reservations()); | 367 DecodeReservation(data->Reservations()); |
| 368 } | 368 } |
| 369 | 369 |
| 370 ~Deserializer() override; | 370 ~Deserializer() override; |
| 371 | 371 |
| 372 // Deserialize the snapshot into an empty heap. | 372 // Deserialize the snapshot into an empty heap. |
| 373 void Deserialize(Isolate* isolate); | 373 void Deserialize(Isolate* isolate); |
| 374 | 374 |
| 375 // Deserialize a single object and the objects reachable from it. | 375 // Deserialize a single object and the objects reachable from it. |
| 376 MaybeHandle<Object> DeserializePartial( | 376 MaybeHandle<Object> DeserializePartial(Isolate* isolate, |
| 377 Isolate* isolate, Handle<JSGlobalProxy> global_proxy, | 377 Handle<JSGlobalProxy> global_proxy); |
| 378 Handle<FixedArray>* outdated_contexts_out); | |
| 379 | 378 |
| 380 // Deserialize a shared function info. Fail gracefully. | 379 // Deserialize a shared function info. Fail gracefully. |
| 381 MaybeHandle<SharedFunctionInfo> DeserializeCode(Isolate* isolate); | 380 MaybeHandle<SharedFunctionInfo> DeserializeCode(Isolate* isolate); |
| 382 | 381 |
| 383 // Pass a vector of externally-provided objects referenced by the snapshot. | 382 // Pass a vector of externally-provided objects referenced by the snapshot. |
| 384 // The ownership to its backing store is handed over as well. | 383 // The ownership to its backing store is handed over as well. |
| 385 void SetAttachedObjects(Vector<Handle<Object> > attached_objects) { | 384 void SetAttachedObjects(Vector<Handle<Object> > attached_objects) { |
| 386 attached_objects_ = attached_objects; | 385 attached_objects_ = attached_objects; |
| 387 } | 386 } |
| 388 | 387 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 DISALLOW_COPY_AND_ASSIGN(Serializer); | 610 DISALLOW_COPY_AND_ASSIGN(Serializer); |
| 612 }; | 611 }; |
| 613 | 612 |
| 614 | 613 |
| 615 class PartialSerializer : public Serializer { | 614 class PartialSerializer : public Serializer { |
| 616 public: | 615 public: |
| 617 PartialSerializer(Isolate* isolate, Serializer* startup_snapshot_serializer, | 616 PartialSerializer(Isolate* isolate, Serializer* startup_snapshot_serializer, |
| 618 SnapshotByteSink* sink) | 617 SnapshotByteSink* sink) |
| 619 : Serializer(isolate, sink), | 618 : Serializer(isolate, sink), |
| 620 startup_serializer_(startup_snapshot_serializer), | 619 startup_serializer_(startup_snapshot_serializer), |
| 621 outdated_contexts_(0), | |
| 622 global_object_(NULL) { | 620 global_object_(NULL) { |
| 623 InitializeCodeAddressMap(); | 621 InitializeCodeAddressMap(); |
| 624 } | 622 } |
| 625 | 623 |
| 626 ~PartialSerializer() override { OutputStatistics("PartialSerializer"); } | 624 ~PartialSerializer() override { OutputStatistics("PartialSerializer"); } |
| 627 | 625 |
| 628 // Serialize the objects reachable from a single object pointer. | 626 // Serialize the objects reachable from a single object pointer. |
| 629 void Serialize(Object** o); | 627 void Serialize(Object** o); |
| 630 void SerializeObject(HeapObject* o, HowToCode how_to_code, | 628 void SerializeObject(HeapObject* o, HowToCode how_to_code, |
| 631 WhereToPoint where_to_point, int skip) override; | 629 WhereToPoint where_to_point, int skip) override; |
| 632 | 630 |
| 633 private: | 631 private: |
| 634 int PartialSnapshotCacheIndex(HeapObject* o); | 632 int PartialSnapshotCacheIndex(HeapObject* o); |
| 635 bool ShouldBeInThePartialSnapshotCache(HeapObject* o); | 633 bool ShouldBeInThePartialSnapshotCache(HeapObject* o); |
| 636 | 634 |
| 637 void SerializeOutdatedContextsAsFixedArray(); | |
| 638 | |
| 639 Serializer* startup_serializer_; | 635 Serializer* startup_serializer_; |
| 640 List<Context*> outdated_contexts_; | |
| 641 Object* global_object_; | 636 Object* global_object_; |
| 642 PartialCacheIndexMap partial_cache_index_map_; | 637 PartialCacheIndexMap partial_cache_index_map_; |
| 643 DISALLOW_COPY_AND_ASSIGN(PartialSerializer); | 638 DISALLOW_COPY_AND_ASSIGN(PartialSerializer); |
| 644 }; | 639 }; |
| 645 | 640 |
| 646 | 641 |
| 647 class StartupSerializer : public Serializer { | 642 class StartupSerializer : public Serializer { |
| 648 public: | 643 public: |
| 649 StartupSerializer(Isolate* isolate, SnapshotByteSink* sink); | 644 StartupSerializer(Isolate* isolate, SnapshotByteSink* sink); |
| 650 ~StartupSerializer() override { OutputStatistics("StartupSerializer"); } | 645 ~StartupSerializer() override { OutputStatistics("StartupSerializer"); } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size; | 810 static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size; |
| 816 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; | 811 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; |
| 817 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; | 812 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; |
| 818 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size; | 813 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size; |
| 819 static const int kHeaderSize = kChecksum2Offset + kInt32Size; | 814 static const int kHeaderSize = kChecksum2Offset + kInt32Size; |
| 820 }; | 815 }; |
| 821 } // namespace internal | 816 } // namespace internal |
| 822 } // namespace v8 | 817 } // namespace v8 |
| 823 | 818 |
| 824 #endif // V8_SNAPSHOT_SERIALIZE_H_ | 819 #endif // V8_SNAPSHOT_SERIALIZE_H_ |
| OLD | NEW |