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

Side by Side Diff: src/serialize.cc

Issue 650142: Fix bugs in partial snapshots so they work on ARM simulator. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: Created 10 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « src/serialize.h ('k') | test/cctest/test-assembler-arm.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 character = *tag++; 885 character = *tag++;
886 sink_->PutSection(character, "TagCharacter"); 886 sink_->PutSection(character, "TagCharacter");
887 } while (character != 0); 887 } while (character != 0);
888 } 888 }
889 889
890 #endif 890 #endif
891 891
892 Serializer::Serializer(SnapshotByteSink* sink) 892 Serializer::Serializer(SnapshotByteSink* sink)
893 : sink_(sink), 893 : sink_(sink),
894 current_root_index_(0), 894 current_root_index_(0),
895 external_reference_encoder_(NULL), 895 external_reference_encoder_(new ExternalReferenceEncoder),
896 large_object_total_(0) { 896 large_object_total_(0) {
897 for (int i = 0; i <= LAST_SPACE; i++) { 897 for (int i = 0; i <= LAST_SPACE; i++) {
898 fullness_[i] = 0; 898 fullness_[i] = 0;
899 } 899 }
900 } 900 }
901 901
902 902
903 Serializer::~Serializer() {
904 delete external_reference_encoder_;
905 }
906
907
903 void StartupSerializer::SerializeStrongReferences() { 908 void StartupSerializer::SerializeStrongReferences() {
904 // No active threads. 909 // No active threads.
905 CHECK_EQ(NULL, ThreadState::FirstInUse()); 910 CHECK_EQ(NULL, ThreadState::FirstInUse());
906 // No active or weak handles. 911 // No active or weak handles.
907 CHECK(HandleScopeImplementer::instance()->blocks()->is_empty()); 912 CHECK(HandleScopeImplementer::instance()->blocks()->is_empty());
908 CHECK_EQ(0, GlobalHandles::NumberOfWeakHandles()); 913 CHECK_EQ(0, GlobalHandles::NumberOfWeakHandles());
909 CHECK_EQ(NULL, external_reference_encoder_);
910 // We don't support serializing installed extensions. 914 // We don't support serializing installed extensions.
911 for (RegisteredExtension* ext = RegisteredExtension::first_extension(); 915 for (RegisteredExtension* ext = RegisteredExtension::first_extension();
912 ext != NULL; 916 ext != NULL;
913 ext = ext->next()) { 917 ext = ext->next()) {
914 CHECK_NE(v8::INSTALLED, ext->state()); 918 CHECK_NE(v8::INSTALLED, ext->state());
915 } 919 }
916 external_reference_encoder_ = new ExternalReferenceEncoder();
917 Heap::IterateStrongRoots(this, VISIT_ONLY_STRONG); 920 Heap::IterateStrongRoots(this, VISIT_ONLY_STRONG);
918 delete external_reference_encoder_;
919 external_reference_encoder_ = NULL;
920 } 921 }
921 922
922 923
923 void PartialSerializer::Serialize(Object** object) { 924 void PartialSerializer::Serialize(Object** object) {
924 external_reference_encoder_ = new ExternalReferenceEncoder();
925 this->VisitPointer(object); 925 this->VisitPointer(object);
926 926
927 // After we have done the partial serialization the partial snapshot cache 927 // After we have done the partial serialization the partial snapshot cache
928 // will contain some references needed to decode the partial snapshot. We 928 // will contain some references needed to decode the partial snapshot. We
929 // fill it up with undefineds so it has a predictable length so the 929 // fill it up with undefineds so it has a predictable length so the
930 // deserialization code doesn't need to know the length. 930 // deserialization code doesn't need to know the length.
931 for (int index = partial_snapshot_cache_length_; 931 for (int index = partial_snapshot_cache_length_;
932 index < kPartialSnapshotCacheCapacity; 932 index < kPartialSnapshotCacheCapacity;
933 index++) { 933 index++) {
934 partial_snapshot_cache_[index] = Heap::undefined_value(); 934 partial_snapshot_cache_[index] = Heap::undefined_value();
935 startup_serializer_->VisitPointer(&partial_snapshot_cache_[index]); 935 startup_serializer_->VisitPointer(&partial_snapshot_cache_[index]);
936 } 936 }
937 partial_snapshot_cache_length_ = kPartialSnapshotCacheCapacity; 937 partial_snapshot_cache_length_ = kPartialSnapshotCacheCapacity;
938
939 delete external_reference_encoder_;
940 external_reference_encoder_ = NULL;
941 } 938 }
942 939
943 940
944 void Serializer::VisitPointers(Object** start, Object** end) { 941 void Serializer::VisitPointers(Object** start, Object** end) {
945 for (Object** current = start; current < end; current++) { 942 for (Object** current = start; current < end; current++) {
946 if ((*current)->IsSmi()) { 943 if ((*current)->IsSmi()) {
947 sink_->Put(RAW_DATA_SERIALIZATION, "RawData"); 944 sink_->Put(RAW_DATA_SERIALIZATION, "RawData");
948 sink_->PutInt(kPointerSize, "length"); 945 sink_->PutInt(kPointerSize, "length");
949 for (int i = 0; i < kPointerSize; i++) { 946 for (int i = 0; i < kPointerSize; i++) {
950 sink_->Put(reinterpret_cast<byte*>(current)[i], "Byte"); 947 sink_->Put(reinterpret_cast<byte*>(current)[i], "Byte");
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); 1350 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize);
1354 } 1351 }
1355 } 1352 }
1356 int allocation_address = fullness_[space]; 1353 int allocation_address = fullness_[space];
1357 fullness_[space] = allocation_address + size; 1354 fullness_[space] = allocation_address + size;
1358 return allocation_address; 1355 return allocation_address;
1359 } 1356 }
1360 1357
1361 1358
1362 } } // namespace v8::internal 1359 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/serialize.h ('k') | test/cctest/test-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698