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

Unified Diff: test/unittests/heap/remembered-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/cctest/test-unboxed-doubles.cc ('k') | test/unittests/heap/slot-set-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/heap/remembered-set-unittest.cc
diff --git a/test/unittests/heap/remembered-set-unittest.cc b/test/unittests/heap/remembered-set-unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1d34880cd93ca7497a651d8adbc30d1a603f9f43
--- /dev/null
+++ b/test/unittests/heap/remembered-set-unittest.cc
@@ -0,0 +1,45 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <limits>
+
+#include <set>
+
+#include "src/globals.h"
+#include "src/heap/remembered-set.h"
+#include "src/heap/spaces.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace v8 {
+namespace internal {
+
+TEST(LocalSlotsBuffer, InsertAndIterate) {
+ LocalSlotsBuffer buffer;
+ std::set<Address> untyped;
+ std::set<std::pair<SlotType, Address> > typed;
+
+ for (int k = 1000; k < 10000; k += NUMBER_OF_SLOT_TYPES) {
+ untyped.insert(reinterpret_cast<Address>(k));
+ buffer.Record(reinterpret_cast<Address>(k));
+ for (int i = 0; i < NUMBER_OF_SLOT_TYPES; i++) {
+ typed.insert(std::make_pair(static_cast<SlotType>(i),
+ reinterpret_cast<Address>(k + i)));
+ buffer.Record(static_cast<SlotType>(i), reinterpret_cast<Address>(k + i));
+ }
+ }
+ buffer.Iterate(
+ [&untyped](Address addr) {
+ EXPECT_NE(untyped.count(addr), 0);
+ untyped.erase(addr);
+ },
+ [&typed](SlotType type, Address addr) {
+ EXPECT_NE(typed.count(std::make_pair(type, addr)), 0);
+ typed.erase(std::make_pair(type, addr));
+ });
+ EXPECT_EQ(untyped.size(), 0);
+ EXPECT_EQ(typed.size(), 0);
+}
+
+} // namespace internal
+} // namespace v8
« no previous file with comments | « test/cctest/test-unboxed-doubles.cc ('k') | test/unittests/heap/slot-set-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698