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

Unified Diff: src/snapshot/deserializer.cc

Issue 2229583003: [serializer] reserve maps one by one to avoid fragmentation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix build Created 4 years, 4 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/snapshot/deserializer.h ('k') | src/snapshot/serializer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/deserializer.cc
diff --git a/src/snapshot/deserializer.cc b/src/snapshot/deserializer.cc
index d4f349227d137f98f55f7965d7f65e460e749e75..8286850fe883340a092f7f6e9b65858edbdc46c1 100644
--- a/src/snapshot/deserializer.cc
+++ b/src/snapshot/deserializer.cc
@@ -55,7 +55,9 @@ bool Deserializer::ReserveSpace() {
CHECK(reservations_[i].length() > 0);
}
#endif // DEBUG
- if (!isolate_->heap()->ReserveSpace(reservations_)) return false;
+ DCHECK(allocated_maps_.is_empty());
+ if (!isolate_->heap()->ReserveSpace(reservations_, &allocated_maps_))
+ return false;
for (int i = 0; i < kNumberOfPreallocatedSpaces; i++) {
high_water_[i] = reservations_[i][0].start;
}
@@ -162,6 +164,12 @@ MaybeHandle<SharedFunctionInfo> Deserializer::DeserializeCode(
Deserializer::~Deserializer() {
// TODO(svenpanne) Re-enable this assertion when v8 initialization is fixed.
// DCHECK(source_.AtEOF());
+ for (int space = 0; space < kNumberOfPreallocatedSpaces; space++) {
+ int chunk_index = current_chunk_[space];
+ CHECK_EQ(reservations_[space].length(), chunk_index + 1);
+ CHECK_EQ(reservations_[space][chunk_index].end, high_water_[space]);
+ }
+ CHECK_EQ(allocated_maps_.length(), next_map_index_);
}
// This is called on the roots. It is the driver of the deserialization
@@ -312,9 +320,12 @@ HeapObject* Deserializer::GetBackReferencedObject(int space) {
SerializerReference back_reference =
SerializerReference::FromBitfield(source_.GetInt());
if (space == LO_SPACE) {
- CHECK(back_reference.chunk_index() == 0);
uint32_t index = back_reference.large_object_index();
obj = deserialized_large_objects_[index];
+ } else if (space == MAP_SPACE) {
+ int index = back_reference.map_index();
+ DCHECK(index < next_map_index_);
+ obj = HeapObject::FromAddress(allocated_maps_[index]);
} else {
DCHECK(space < kNumberOfPreallocatedSpaces);
uint32_t chunk_index = back_reference.chunk_index();
@@ -405,6 +416,9 @@ Address Deserializer::Allocate(int space_index, int size) {
HeapObject* obj = HeapObject::cast(result.ToObjectChecked());
deserialized_large_objects_.Add(obj);
return obj->address();
+ } else if (space_index == MAP_SPACE) {
+ DCHECK_EQ(Map::kSize, size);
+ return allocated_maps_[next_map_index_++];
} else {
DCHECK(space_index < kNumberOfPreallocatedSpaces);
Address address = high_water_[space_index];
« no previous file with comments | « src/snapshot/deserializer.h ('k') | src/snapshot/serializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698