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

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

Issue 2496913002: Fix more -Wsign-compare warnings in heap, mips, base, etc. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <limits> 5 #include <limits>
6 #include <map> 6 #include <map>
7 7
8 #include "src/globals.h" 8 #include "src/globals.h"
9 #include "src/heap/slot-set.h" 9 #include "src/heap/slot-set.h"
10 #include "src/heap/spaces.h" 10 #include "src/heap/spaces.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 ++added; 161 ++added;
162 } 162 }
163 int iterated = 0; 163 int iterated = 0;
164 set.Iterate( 164 set.Iterate(
165 [&iterated, kDelta, kHostDelta](SlotType type, Address host_addr, 165 [&iterated, kDelta, kHostDelta](SlotType type, Address host_addr,
166 Address addr) { 166 Address addr) {
167 uint32_t i = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr)); 167 uint32_t i = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr));
168 uint32_t j = 168 uint32_t j =
169 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(host_addr)); 169 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(host_addr));
170 EXPECT_EQ(i % CLEARED_SLOT, static_cast<uint32_t>(type)); 170 EXPECT_EQ(i % CLEARED_SLOT, static_cast<uint32_t>(type));
171 EXPECT_EQ(0, i % kDelta); 171 EXPECT_EQ(0u, i % kDelta);
172 EXPECT_EQ(0, j % kHostDelta); 172 EXPECT_EQ(0u, j % kHostDelta);
173 ++iterated; 173 ++iterated;
174 return i % 2 == 0 ? KEEP_SLOT : REMOVE_SLOT; 174 return i % 2 == 0 ? KEEP_SLOT : REMOVE_SLOT;
175 }, 175 },
176 TypedSlotSet::KEEP_EMPTY_CHUNKS); 176 TypedSlotSet::KEEP_EMPTY_CHUNKS);
177 EXPECT_EQ(added, iterated); 177 EXPECT_EQ(added, iterated);
178 iterated = 0; 178 iterated = 0;
179 set.Iterate( 179 set.Iterate(
180 [&iterated](SlotType type, Address host_addr, Address addr) { 180 [&iterated](SlotType type, Address host_addr, Address addr) {
181 uint32_t i = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr)); 181 uint32_t i = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr));
182 EXPECT_EQ(0, i % 2); 182 EXPECT_EQ(0u, i % 2);
183 ++iterated; 183 ++iterated;
184 return KEEP_SLOT; 184 return KEEP_SLOT;
185 }, 185 },
186 TypedSlotSet::KEEP_EMPTY_CHUNKS); 186 TypedSlotSet::KEEP_EMPTY_CHUNKS);
187 EXPECT_EQ(added / 2, iterated); 187 EXPECT_EQ(added / 2, iterated);
188 } 188 }
189 189
190 TEST(TypedSlotSet, RemoveInvalidSlots) { 190 TEST(TypedSlotSet, RemoveInvalidSlots) {
191 TypedSlotSet set(0); 191 TypedSlotSet set(0);
192 const int kHostDelta = 100; 192 const int kHostDelta = 100;
(...skipping 19 matching lines...) Expand all
212 CHECK(reinterpret_cast<uintptr_t>(host_addr) < start || 212 CHECK(reinterpret_cast<uintptr_t>(host_addr) < start ||
213 reinterpret_cast<uintptr_t>(host_addr) >= end); 213 reinterpret_cast<uintptr_t>(host_addr) >= end);
214 return KEEP_SLOT; 214 return KEEP_SLOT;
215 }, 215 },
216 TypedSlotSet::KEEP_EMPTY_CHUNKS); 216 TypedSlotSet::KEEP_EMPTY_CHUNKS);
217 } 217 }
218 } 218 }
219 219
220 } // namespace internal 220 } // namespace internal
221 } // namespace v8 221 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/heap/marking-unittest.cc ('k') | test/unittests/zone/zone-chunk-list-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698