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

Unified Diff: test/unittests/heap/slot-set-unittest.cc

Issue 2418773002: [heap] Move slot filtering logic into sweeper. (Closed)
Patch Set: remove prefree mode Created 4 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/heap/slot-set.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/heap/slot-set-unittest.cc
diff --git a/test/unittests/heap/slot-set-unittest.cc b/test/unittests/heap/slot-set-unittest.cc
index d24ed1322b4042851cdde1da64611a340b94fc4b..c9b1464d670b48615407aaa7001669030ef342fd 100644
--- a/test/unittests/heap/slot-set-unittest.cc
+++ b/test/unittests/heap/slot-set-unittest.cc
@@ -101,18 +101,21 @@ void CheckRemoveRangeOn(uint32_t start, uint32_t end) {
set.SetPageStart(0);
uint32_t first = start == 0 ? 0 : start - kPointerSize;
uint32_t last = end == Page::kPageSize ? end - kPointerSize : end;
- for (uint32_t i = first; i <= last; i += kPointerSize) {
- set.Insert(i);
- }
- set.RemoveRange(start, end, SlotSet::FREE_EMPTY_BUCKETS);
- if (first != start) {
- EXPECT_TRUE(set.Lookup(first));
- }
- if (last == end) {
- EXPECT_TRUE(set.Lookup(last));
- }
- for (uint32_t i = start; i < end; i += kPointerSize) {
- EXPECT_FALSE(set.Lookup(i));
+ for (const auto mode :
+ {SlotSet::FREE_EMPTY_BUCKETS, SlotSet::KEEP_EMPTY_BUCKETS}) {
+ for (uint32_t i = first; i <= last; i += kPointerSize) {
+ set.Insert(i);
+ }
+ set.RemoveRange(start, end, mode);
+ if (first != start) {
+ EXPECT_TRUE(set.Lookup(first));
+ }
+ if (last == end) {
+ EXPECT_TRUE(set.Lookup(last));
+ }
+ for (uint32_t i = start; i < end; i += kPointerSize) {
+ EXPECT_FALSE(set.Lookup(i));
+ }
}
}
@@ -134,10 +137,13 @@ TEST(SlotSet, RemoveRange) {
}
SlotSet set;
set.SetPageStart(0);
- set.Insert(Page::kPageSize / 2);
- set.RemoveRange(0, Page::kPageSize, SlotSet::FREE_EMPTY_BUCKETS);
- for (uint32_t i = 0; i < Page::kPageSize; i += kPointerSize) {
- EXPECT_FALSE(set.Lookup(i));
+ for (const auto mode :
+ {SlotSet::FREE_EMPTY_BUCKETS, SlotSet::KEEP_EMPTY_BUCKETS}) {
+ set.Insert(Page::kPageSize / 2);
+ set.RemoveRange(0, Page::kPageSize, mode);
+ for (uint32_t i = 0; i < Page::kPageSize; i += kPointerSize) {
+ EXPECT_FALSE(set.Lookup(i));
+ }
}
}
« no previous file with comments | « src/heap/slot-set.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698