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

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

Issue 1735523002: Reland "Replace slots buffer with remembered set. (patchset #14 id:250001 of https://codereview.chr… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: one more int->size_t Created 4 years, 10 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 | « test/unittests/heap/remembered-set-unittest.cc ('k') | test/unittests/unittests.gyp » ('j') | 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 376188915a4b4004034c67087ad8029b0602f584..26a26f0258435e8096d30b364575a57601a60eed 100644
--- a/test/unittests/heap/slot-set-unittest.cc
+++ b/test/unittests/heap/slot-set-unittest.cc
@@ -55,9 +55,9 @@ TEST(SlotSet, Iterate) {
set.Iterate([](Address slot_address) {
uintptr_t intaddr = reinterpret_cast<uintptr_t>(slot_address);
if (intaddr % 3 == 0) {
- return SlotSet::KEEP_SLOT;
+ return KEEP_SLOT;
} else {
- return SlotSet::REMOVE_SLOT;
+ return REMOVE_SLOT;
}
});
@@ -139,5 +139,33 @@ TEST(SlotSet, RemoveRange) {
}
}
+TEST(TypedSlotSet, Iterate) {
+ TypedSlotSet set(0);
+ const int kDelta = 10000001;
+ int added = 0;
+ for (uint32_t i = 0; i < TypedSlotSet::kMaxOffset; i += kDelta) {
+ SlotType type = static_cast<SlotType>(i % NUMBER_OF_SLOT_TYPES);
+ set.Insert(type, i);
+ ++added;
+ }
+ int iterated = 0;
+ set.Iterate([&iterated, kDelta](SlotType type, Address addr) {
+ uint32_t i = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr));
+ EXPECT_EQ(i % NUMBER_OF_SLOT_TYPES, static_cast<uint32_t>(type));
+ EXPECT_EQ(0, i % kDelta);
+ ++iterated;
+ return i % 2 == 0 ? KEEP_SLOT : REMOVE_SLOT;
+ });
+ EXPECT_EQ(added, iterated);
+ iterated = 0;
+ set.Iterate([&iterated](SlotType type, Address addr) {
+ uint32_t i = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr));
+ EXPECT_EQ(0, i % 2);
+ ++iterated;
+ return KEEP_SLOT;
+ });
+ EXPECT_EQ(added / 2, iterated);
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « test/unittests/heap/remembered-set-unittest.cc ('k') | test/unittests/unittests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698