Upgrade V8 to 5.1.281.57 DO NOT MERGE
FPIIM-449
Change-Id: Id981b686b4d587ac31697662eb98bb34be42ad90
(cherry picked from commit 3b9bc31999c9787eb726ecdbfd5796bfdec32a18)
diff --git a/test/unittests/heap/slot-set-unittest.cc b/test/unittests/heap/slot-set-unittest.cc
index 3761889..26a26f0 100644
--- a/test/unittests/heap/slot-set-unittest.cc
+++ b/test/unittests/heap/slot-set-unittest.cc
@@ -55,9 +55,9 @@
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(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