Commit a93a7694 authored by Franziska Hinkelmann's avatar Franziska Hinkelmann Committed by Commit Bot

[cleanup] Make heap "Reservation" an std::vector.

There's no point in using our own implemention of List for this.

Bug:v8:6325

Change-Id: Idf3399bbaaf50f9e1fc7b16c67ea2c6246dd6574
Reviewed-on: https://chromium-review.googlesource.com/489949Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Franziska Hinkelmann <franzih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44980}
parent 95a7cfe0
......@@ -1166,13 +1166,13 @@ bool Heap::ReserveSpace(Reservation* reservations, List<Address>* maps) {
for (int space = NEW_SPACE; space < SerializerDeserializer::kNumberOfSpaces;
space++) {
Reservation* reservation = &reservations[space];
DCHECK_LE(1, reservation->length());
DCHECK_LE(1, reservation->size());
if (reservation->at(0).size == 0) continue;
bool perform_gc = false;
if (space == MAP_SPACE) {
// We allocate each map individually to avoid fragmentation.
maps->Clear();
DCHECK_EQ(1, reservation->length());
DCHECK_EQ(1, reservation->size());
int num_maps = reservation->at(0).size / Map::kSize;
for (int i = 0; i < num_maps; i++) {
// The deserializer will update the skip list.
......@@ -1193,7 +1193,7 @@ bool Heap::ReserveSpace(Reservation* reservations, List<Address>* maps) {
}
} else if (space == LO_SPACE) {
// Just check that we can allocate during deserialization.
DCHECK_EQ(1, reservation->length());
DCHECK_EQ(1, reservation->size());
perform_gc = !CanExpandOldGeneration(reservation->at(0).size);
} else {
for (auto& chunk : *reservation) {
......
......@@ -614,7 +614,7 @@ class Heap {
Address start;
Address end;
};
typedef List<Chunk> Reservation;
typedef std::vector<Chunk> Reservation;
static const int kInitalOldGenerationLimitFactor = 2;
......
......@@ -22,11 +22,11 @@ namespace internal {
void Deserializer::DecodeReservation(
Vector<const SerializedData::Reservation> res) {
DCHECK_EQ(0, reservations_[NEW_SPACE].length());
DCHECK_EQ(0, reservations_[NEW_SPACE].size());
STATIC_ASSERT(NEW_SPACE == 0);
int current_space = NEW_SPACE;
for (auto& r : res) {
reservations_[current_space].Add({r.chunk_size(), NULL, NULL});
reservations_[current_space].push_back({r.chunk_size(), NULL, NULL});
if (r.is_last()) current_space++;
}
DCHECK_EQ(kNumberOfSpaces, current_space);
......@@ -57,7 +57,7 @@ void Deserializer::FlushICacheForNewCodeObjectsAndRecordEmbeddedObjects() {
bool Deserializer::ReserveSpace() {
#ifdef DEBUG
for (int i = NEW_SPACE; i < kNumberOfSpaces; ++i) {
CHECK(reservations_[i].length() > 0);
CHECK(reservations_[i].size() > 0);
}
#endif // DEBUG
DCHECK(allocated_maps_.is_empty());
......@@ -187,7 +187,7 @@ Deserializer::~Deserializer() {
while (source_.HasMore()) CHECK_EQ(kNop, source_.Get());
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].size(), chunk_index + 1);
CHECK_EQ(reservations_[space][chunk_index].end, high_water_[space]);
}
CHECK_EQ(allocated_maps_.length(), next_map_index_);
......@@ -793,7 +793,7 @@ bool Deserializer::ReadData(Object** current, Object** limit, int source_space,
CHECK_EQ(reservation[chunk_index].end, high_water_[space]);
// Move to next reserved chunk.
chunk_index = ++current_chunk_[space];
CHECK_LT(chunk_index, reservation.length());
CHECK_LT(chunk_index, reservation.size());
high_water_[space] = reservation[chunk_index].start;
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment