Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: src/serialize.h

Issue 803063002: Add a CHECK to make sure we don't accidentally serialize type feedback (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/serialize.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_SERIALIZE_H_ 5 #ifndef V8_SERIALIZE_H_
6 #define V8_SERIALIZE_H_ 6 #define V8_SERIALIZE_H_
7 7
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/hashmap.h" 9 #include "src/hashmap.h"
10 #include "src/heap-profiler.h" 10 #include "src/heap-profiler.h"
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 586
587 DISALLOW_COPY_AND_ASSIGN(Deserializer); 587 DISALLOW_COPY_AND_ASSIGN(Deserializer);
588 }; 588 };
589 589
590 590
591 class CodeAddressMap; 591 class CodeAddressMap;
592 592
593 // There can be only one serializer per V8 process. 593 // There can be only one serializer per V8 process.
594 class Serializer : public SerializerDeserializer { 594 class Serializer : public SerializerDeserializer {
595 public: 595 public:
596 Serializer(Isolate* isolate, SnapshotByteSink* sink); 596 Serializer(Isolate* isolate, SnapshotByteSink* sink,
597 bool allow_type_feedback);
597 ~Serializer(); 598 ~Serializer();
598 void VisitPointers(Object** start, Object** end) OVERRIDE; 599 void VisitPointers(Object** start, Object** end) OVERRIDE;
599 600
600 void EncodeReservations(List<SerializedData::Reservation>* out) const; 601 void EncodeReservations(List<SerializedData::Reservation>* out) const;
601 602
602 Isolate* isolate() const { return isolate_; } 603 Isolate* isolate() const { return isolate_; }
603 604
604 BackReferenceMap* back_reference_map() { return &back_reference_map_; } 605 BackReferenceMap* back_reference_map() { return &back_reference_map_; }
605 RootIndexMap* root_index_map() { return &root_index_map_; } 606 RootIndexMap* root_index_map() { return &root_index_map_; }
606 607
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 // when deserializing. We have to make sure that each chunk fits into a 719 // when deserializing. We have to make sure that each chunk fits into a
719 // page. So we track the chunk size in pending_chunk_ of a space, but 720 // page. So we track the chunk size in pending_chunk_ of a space, but
720 // when it exceeds a page, we complete the current chunk and start a new one. 721 // when it exceeds a page, we complete the current chunk and start a new one.
721 uint32_t pending_chunk_[kNumberOfPreallocatedSpaces]; 722 uint32_t pending_chunk_[kNumberOfPreallocatedSpaces];
722 List<uint32_t> completed_chunks_[kNumberOfPreallocatedSpaces]; 723 List<uint32_t> completed_chunks_[kNumberOfPreallocatedSpaces];
723 uint32_t max_chunk_size_[kNumberOfPreallocatedSpaces]; 724 uint32_t max_chunk_size_[kNumberOfPreallocatedSpaces];
724 725
725 // We map serialized large objects to indexes for back-referencing. 726 // We map serialized large objects to indexes for back-referencing.
726 uint32_t large_objects_total_size_; 727 uint32_t large_objects_total_size_;
727 uint32_t seen_large_objects_index_; 728 uint32_t seen_large_objects_index_;
729 bool allow_type_feedback_;
728 730
729 DISALLOW_COPY_AND_ASSIGN(Serializer); 731 DISALLOW_COPY_AND_ASSIGN(Serializer);
730 }; 732 };
731 733
732 734
733 class PartialSerializer : public Serializer { 735 class PartialSerializer : public Serializer {
734 public: 736 public:
735 PartialSerializer(Isolate* isolate, 737 PartialSerializer(Isolate* isolate, Serializer* startup_snapshot_serializer,
736 Serializer* startup_snapshot_serializer,
737 SnapshotByteSink* sink) 738 SnapshotByteSink* sink)
738 : Serializer(isolate, sink), 739 : Serializer(isolate, sink, true),
739 startup_serializer_(startup_snapshot_serializer) { 740 startup_serializer_(startup_snapshot_serializer) {
740 InitializeCodeAddressMap(); 741 InitializeCodeAddressMap();
741 } 742 }
742 743
743 // Serialize the objects reachable from a single object pointer. 744 // Serialize the objects reachable from a single object pointer.
744 void Serialize(Object** o); 745 void Serialize(Object** o);
745 virtual void SerializeObject(HeapObject* o, HowToCode how_to_code, 746 virtual void SerializeObject(HeapObject* o, HowToCode how_to_code,
746 WhereToPoint where_to_point, int skip) OVERRIDE; 747 WhereToPoint where_to_point, int skip) OVERRIDE;
747 748
748 private: 749 private:
749 int PartialSnapshotCacheIndex(HeapObject* o); 750 int PartialSnapshotCacheIndex(HeapObject* o);
(...skipping 12 matching lines...) Expand all
762 763
763 764
764 Serializer* startup_serializer_; 765 Serializer* startup_serializer_;
765 DISALLOW_COPY_AND_ASSIGN(PartialSerializer); 766 DISALLOW_COPY_AND_ASSIGN(PartialSerializer);
766 }; 767 };
767 768
768 769
769 class StartupSerializer : public Serializer { 770 class StartupSerializer : public Serializer {
770 public: 771 public:
771 StartupSerializer(Isolate* isolate, SnapshotByteSink* sink) 772 StartupSerializer(Isolate* isolate, SnapshotByteSink* sink)
772 : Serializer(isolate, sink), root_index_wave_front_(0) { 773 : Serializer(isolate, sink, true), root_index_wave_front_(0) {
773 // Clear the cache of objects used by the partial snapshot. After the 774 // Clear the cache of objects used by the partial snapshot. After the
774 // strong roots have been serialized we can create a partial snapshot 775 // strong roots have been serialized we can create a partial snapshot
775 // which will repopulate the cache with objects needed by that partial 776 // which will repopulate the cache with objects needed by that partial
776 // snapshot. 777 // snapshot.
777 isolate->set_serialize_partial_snapshot_cache_length(0); 778 isolate->set_serialize_partial_snapshot_cache_length(0);
778 InitializeCodeAddressMap(); 779 InitializeCodeAddressMap();
779 } 780 }
780 781
781 // The StartupSerializer has to serialize the root array, which is slightly 782 // The StartupSerializer has to serialize the root array, which is slightly
782 // different. 783 // different.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 DCHECK(!AllowHeapAllocation::IsAllowed()); 821 DCHECK(!AllowHeapAllocation::IsAllowed());
821 return source_; 822 return source_;
822 } 823 }
823 824
824 const List<uint32_t>* stub_keys() const { return &stub_keys_; } 825 const List<uint32_t>* stub_keys() const { return &stub_keys_; }
825 int num_internalized_strings() const { return num_internalized_strings_; } 826 int num_internalized_strings() const { return num_internalized_strings_; }
826 827
827 private: 828 private:
828 CodeSerializer(Isolate* isolate, SnapshotByteSink* sink, String* source, 829 CodeSerializer(Isolate* isolate, SnapshotByteSink* sink, String* source,
829 Code* main_code) 830 Code* main_code)
830 : Serializer(isolate, sink), 831 : Serializer(isolate, sink, false),
831 source_(source), 832 source_(source),
832 main_code_(main_code), 833 main_code_(main_code),
833 num_internalized_strings_(0) { 834 num_internalized_strings_(0) {
834 back_reference_map_.AddSourceString(source); 835 back_reference_map_.AddSourceString(source);
835 } 836 }
836 837
837 virtual void SerializeObject(HeapObject* o, HowToCode how_to_code, 838 virtual void SerializeObject(HeapObject* o, HowToCode how_to_code,
838 WhereToPoint where_to_point, int skip) OVERRIDE; 839 WhereToPoint where_to_point, int skip) OVERRIDE;
839 840
840 void SerializeBuiltin(int builtin_index, HowToCode how_to_code, 841 void SerializeBuiltin(int builtin_index, HowToCode how_to_code,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 static const int kCheckSumOffset = 0; 934 static const int kCheckSumOffset = 0;
934 static const int kNumInternalizedStringsOffset = 1; 935 static const int kNumInternalizedStringsOffset = 1;
935 static const int kReservationsOffset = 2; 936 static const int kReservationsOffset = 2;
936 static const int kNumCodeStubKeysOffset = 3; 937 static const int kNumCodeStubKeysOffset = 3;
937 static const int kPayloadLengthOffset = 4; 938 static const int kPayloadLengthOffset = 4;
938 static const int kHeaderSize = (kPayloadLengthOffset + 1) * kIntSize; 939 static const int kHeaderSize = (kPayloadLengthOffset + 1) * kIntSize;
939 }; 940 };
940 } } // namespace v8::internal 941 } } // namespace v8::internal
941 942
942 #endif // V8_SERIALIZE_H_ 943 #endif // V8_SERIALIZE_H_
OLDNEW
« no previous file with comments | « no previous file | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698