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

Side by Side Diff: src/serialize.cc

Issue 1148007: Merge bleeding_edge from version 2.1.3 up to revision 4205... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: Created 10 years, 9 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
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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 HashMap::Entry* entry = 470 HashMap::Entry* entry =
471 const_cast<HashMap &>(encodings_).Lookup(key, Hash(key), false); 471 const_cast<HashMap &>(encodings_).Lookup(key, Hash(key), false);
472 return entry == NULL 472 return entry == NULL
473 ? -1 473 ? -1
474 : static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); 474 : static_cast<int>(reinterpret_cast<intptr_t>(entry->value));
475 } 475 }
476 476
477 477
478 void ExternalReferenceEncoder::Put(Address key, int index) { 478 void ExternalReferenceEncoder::Put(Address key, int index) {
479 HashMap::Entry* entry = encodings_.Lookup(key, Hash(key), true); 479 HashMap::Entry* entry = encodings_.Lookup(key, Hash(key), true);
480 entry->value = reinterpret_cast<void *>(index); 480 entry->value = reinterpret_cast<void*>(index);
481 } 481 }
482 482
483 483
484 ExternalReferenceDecoder::ExternalReferenceDecoder() 484 ExternalReferenceDecoder::ExternalReferenceDecoder()
485 : encodings_(NewArray<Address*>(kTypeCodeCount)) { 485 : encodings_(NewArray<Address*>(kTypeCodeCount)) {
486 ExternalReferenceTable* external_references = 486 ExternalReferenceTable* external_references =
487 ExternalReferenceTable::instance(); 487 ExternalReferenceTable::instance();
488 for (int type = kFirstTypeCode; type < kTypeCodeCount; ++type) { 488 for (int type = kFirstTypeCode; type < kTypeCodeCount; ++type) {
489 int max = external_references->max_id(type) + 1; 489 int max = external_references->max_id(type) + 1;
490 encodings_[type] = NewArray<Address>(max + 1); 490 encodings_[type] = NewArray<Address>(max + 1);
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 967
968 968
969 // This ensures that the partial snapshot cache keeps things alive during GC and 969 // This ensures that the partial snapshot cache keeps things alive during GC and
970 // tracks their movement. When it is called during serialization of the startup 970 // tracks their movement. When it is called during serialization of the startup
971 // snapshot the partial snapshot is empty, so nothing happens. When the partial 971 // snapshot the partial snapshot is empty, so nothing happens. When the partial
972 // (context) snapshot is created, this array is populated with the pointers that 972 // (context) snapshot is created, this array is populated with the pointers that
973 // the partial snapshot will need. As that happens we emit serialized objects to 973 // the partial snapshot will need. As that happens we emit serialized objects to
974 // the startup snapshot that correspond to the elements of this cache array. On 974 // the startup snapshot that correspond to the elements of this cache array. On
975 // deserialization we therefore need to visit the cache array. This fills it up 975 // deserialization we therefore need to visit the cache array. This fills it up
976 // with pointers to deserialized objects. 976 // with pointers to deserialized objects.
977 void SerializerDeserializer::Iterate(ObjectVisitor *visitor) { 977 void SerializerDeserializer::Iterate(ObjectVisitor* visitor) {
978 visitor->VisitPointers( 978 visitor->VisitPointers(
979 &partial_snapshot_cache_[0], 979 &partial_snapshot_cache_[0],
980 &partial_snapshot_cache_[partial_snapshot_cache_length_]); 980 &partial_snapshot_cache_[partial_snapshot_cache_length_]);
981 } 981 }
982 982
983 983
984 // When deserializing we need to set the size of the snapshot cache. This means 984 // When deserializing we need to set the size of the snapshot cache. This means
985 // the root iteration code (above) will iterate over array elements, writing the 985 // the root iteration code (above) will iterate over array elements, writing the
986 // references to deserialized objects in them. 986 // references to deserialized objects in them.
987 void SerializerDeserializer::SetSnapshotCacheSize(int size) { 987 void SerializerDeserializer::SetSnapshotCacheSize(int size) {
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); 1358 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize);
1359 } 1359 }
1360 } 1360 }
1361 int allocation_address = fullness_[space]; 1361 int allocation_address = fullness_[space];
1362 fullness_[space] = allocation_address + size; 1362 fullness_[space] = allocation_address + size;
1363 return allocation_address; 1363 return allocation_address;
1364 } 1364 }
1365 1365
1366 1366
1367 } } // namespace v8::internal 1367 } } // namespace v8::internal
OLDNEW
« src/runtime.cc ('K') | « src/scopes.h ('k') | src/splay-tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698