Commit f8569ff3 authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

[data structures] Fix ZoneChunkList some more.

Currently, pop_back() doesn't update size. Fix that.

BUG=v8:7489

Change-Id: If11d2ddcaae3223289c168c1e6e1ad94d6775516
Reviewed-on: https://chromium-review.googlesource.com/934456Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51517}
parent aaa1d271
......@@ -289,6 +289,7 @@ void ZoneChunkList<T>::pop_back() {
back_ = back_->previous_;
}
--back_->position_;
--size_;
}
template <typename T>
......
......@@ -267,5 +267,18 @@ TEST(ZoneChunkList, RewindAndIterate) {
}
}
TEST(ZoneChunkList, PushBackPopBackSize) {
// Regression test for https://bugs.chromium.org/p/v8/issues/detail?id=7489
AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
ZoneChunkList<int> zone_chunk_list(&zone);
CHECK_EQ(size_t(0), zone_chunk_list.size());
zone_chunk_list.push_back(1);
CHECK_EQ(size_t(1), zone_chunk_list.size());
zone_chunk_list.pop_back();
CHECK_EQ(size_t(0), zone_chunk_list.size());
}
} // namespace internal
} // namespace v8
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