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

Side by Side Diff: src/serialize.cc

Issue 560031: Create a test that serializes and deserializes a context. Fix... (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-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 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 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 void SerializerDeserializer::SetSnapshotCacheSize(int size) { 983 void SerializerDeserializer::SetSnapshotCacheSize(int size) {
984 partial_snapshot_cache_length_ = size; 984 partial_snapshot_cache_length_ = size;
985 } 985 }
986 986
987 987
988 int PartialSerializer::PartialSnapshotCacheIndex(HeapObject* heap_object) { 988 int PartialSerializer::PartialSnapshotCacheIndex(HeapObject* heap_object) {
989 for (int i = 0; i < partial_snapshot_cache_length_; i++) { 989 for (int i = 0; i < partial_snapshot_cache_length_; i++) {
990 Object* entry = partial_snapshot_cache_[i]; 990 Object* entry = partial_snapshot_cache_[i];
991 if (entry == heap_object) return i; 991 if (entry == heap_object) return i;
992 } 992 }
993
993 // We didn't find the object in the cache. So we add it to the cache and 994 // We didn't find the object in the cache. So we add it to the cache and
994 // then visit the pointer so that it becomes part of the startup snapshot 995 // then visit the pointer so that it becomes part of the startup snapshot
995 // and we can refer to it from the partial snapshot. 996 // and we can refer to it from the partial snapshot.
996 int length = partial_snapshot_cache_length_; 997 int length = partial_snapshot_cache_length_;
997 CHECK(length < kPartialSnapshotCacheCapacity); 998 CHECK(length < kPartialSnapshotCacheCapacity);
998 partial_snapshot_cache_[length] = heap_object; 999 partial_snapshot_cache_[length] = heap_object;
999 startup_serializer_->VisitPointer(&partial_snapshot_cache_[length]); 1000 startup_serializer_->VisitPointer(&partial_snapshot_cache_[length]);
1000 // We don't recurse from the startup snapshot generator into the partial 1001 // We don't recurse from the startup snapshot generator into the partial
1001 // snapshot generator. 1002 // snapshot generator.
1002 ASSERT(length == partial_snapshot_cache_length_); 1003 ASSERT(length == partial_snapshot_cache_length_);
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 } 1356 }
1356 int allocation_address = fullness_[space]; 1357 int allocation_address = fullness_[space];
1357 fullness_[space] = allocation_address + size; 1358 fullness_[space] = allocation_address + size;
1358 return allocation_address; 1359 return allocation_address;
1359 } 1360 }
1360 1361
1361 bool SerializerDeserializer::tracing_; 1362 bool SerializerDeserializer::tracing_;
1362 1363
1363 1364
1364 } } // namespace v8::internal 1365 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/serialize.h ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698