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

Unified Diff: src/serialize.cc

Issue 536077: Implement enough of the partial snapshots that we can deserialize... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/serialize.h ('k') | src/v8.cc » ('j') | test/cctest/test-serialize.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/serialize.cc
===================================================================
--- src/serialize.cc (revision 3606)
+++ src/serialize.cc (working copy)
@@ -558,11 +558,10 @@
bool Serializer::serialization_enabled_ = false;
bool Serializer::too_late_to_enable_now_ = false;
+ExternalReferenceDecoder* Deserializer::external_reference_decoder_ = NULL;
-Deserializer::Deserializer(SnapshotByteSource* source)
- : source_(source),
- external_reference_decoder_(NULL) {
+Deserializer::Deserializer(SnapshotByteSource* source) : source_(source) {
}
@@ -652,11 +651,29 @@
external_reference_decoder_ = new ExternalReferenceDecoder();
Heap::IterateRoots(this, VISIT_ONLY_STRONG);
ASSERT(source_->AtEOF());
- delete external_reference_decoder_;
- external_reference_decoder_ = NULL;
}
+void Deserializer::DeserializePartial(Object** root) {
+ // Don't GC while deserializing - just expand the heap.
+ AlwaysAllocateScope always_allocate;
+ // Don't use the free lists while deserializing.
+ LinearAllocationScope allocate_linearly;
+ if (external_reference_decoder_ == NULL) {
+ external_reference_decoder_ = new ExternalReferenceDecoder();
+ }
+ VisitPointer(root);
+}
+
+
+void Deserializer::TearDown() {
+ if (external_reference_decoder_ != NULL) {
+ delete external_reference_decoder_;
+ external_reference_decoder_ = NULL;
+ }
+}
+
+
// This is called on the roots. It is the driver of the deserialization
// process. It is also called on the body of each function.
void Deserializer::VisitPointers(Object** start, Object** end) {
@@ -866,6 +883,11 @@
*current++ = reinterpret_cast<Object*>(resource);
break;
}
+ case ROOT_SERIALIZATION: {
+ int root_id = source_->GetInt();
+ *current++ = Heap::roots_address()[root_id];
+ break;
+ }
default:
UNREACHABLE();
}
@@ -919,7 +941,8 @@
: sink_(sink),
current_root_index_(0),
external_reference_encoder_(NULL),
- partial_(false) {
+ partial_(false),
+ large_object_total_(0) {
for (int i = 0; i <= LAST_SPACE; i++) {
fullness_[i] = 0;
}
@@ -1230,6 +1253,7 @@
// In large object space we merely number the objects instead of trying to
// determine some sort of address.
*new_page = true;
+ large_object_total_ += size;
return fullness_[LO_SPACE]++;
}
*new_page = false;
« no previous file with comments | « src/serialize.h ('k') | src/v8.cc » ('j') | test/cctest/test-serialize.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698