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

Unified Diff: src/serialize.cc

Issue 674883002: Tweaks to the code serializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix large object back references Created 6 years, 2 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') | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/serialize.cc
diff --git a/src/serialize.cc b/src/serialize.cc
index ba4bf4152454aefab0a716fe1f3b3439b34afc13..28838edcf46dbb7896fdab40a1f9aa94cbe8ffa5 100644
--- a/src/serialize.cc
+++ b/src/serialize.cc
@@ -1677,11 +1677,10 @@ void Serializer::ObjectSerializer::VisitPointers(Object** start,
while (current < end && !(*current)->IsSmi()) {
HeapObject* current_contents = HeapObject::cast(*current);
int root_index = serializer_->root_index_map()->Lookup(current_contents);
- // Repeats are not subject to the write barrier so there are only some
- // objects that can be used in a repeat encoding. These are the early
- // ones in the root array that are never in new space.
+ // Repeats are not subject to the write barrier so we can only use
+ // immortal immovable root members. They are never in new space.
if (current != start && root_index != RootIndexMap::kInvalidRootIndex &&
- root_index < kRootArrayNumberOfConstantEncodings &&
+ Heap::RootIsImmortalImmovable(root_index) &&
current_contents == current[-1]) {
DCHECK(!serializer_->isolate()->heap()->InNewSpace(current_contents));
int repeat_count = 1;
@@ -1908,7 +1907,7 @@ BackReference Serializer::AllocateLargeObject(int size) {
// Large objects are allocated one-by-one when deserializing. We do not
// have to keep track of multiple chunks.
pending_chunk_[LO_SPACE] += size;
- return BackReference(LO_SPACE, 0, seen_large_objects_index_++);
+ return BackReference::LargeObjectReference(seen_large_objects_index_++);
}
@@ -1925,7 +1924,8 @@ BackReference Serializer::Allocate(AllocationSpace space, int size) {
}
uint32_t offset = pending_chunk_[space];
pending_chunk_[space] = new_chunk_size;
- return BackReference(space, completed_chunks_[space].length(), offset);
+ return BackReference::Reference(space, completed_chunks_[space].length(),
+ offset);
}
@@ -2007,12 +2007,17 @@ void CodeSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
BackReference back_reference = back_reference_map_.Lookup(obj);
if (back_reference.is_valid()) {
- if (FLAG_trace_code_serializer) {
- PrintF(" Encoding back reference to: ");
- obj->ShortPrint();
- PrintF("\n");
+ if (back_reference.is_source()) {
+ DCHECK_EQ(source_, obj);
+ SerializeSourceObject(how_to_code, where_to_point);
+ } else {
+ if (FLAG_trace_code_serializer) {
+ PrintF(" Encoding back reference to: ");
+ obj->ShortPrint();
+ PrintF("\n");
+ }
+ SerializeBackReference(back_reference, how_to_code, where_to_point, skip);
}
- SerializeBackReference(back_reference, how_to_code, where_to_point, skip);
return;
}
@@ -2056,11 +2061,6 @@ void CodeSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
UNREACHABLE();
}
- if (obj == source_) {
- SerializeSourceObject(how_to_code, where_to_point);
- return;
- }
-
// Past this point we should not see any (context-specific) maps anymore.
CHECK(!obj->IsMap());
// There should be no references to the global object embedded.
« 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