Commit 3674876c authored by Dominik Inführ's avatar Dominik Inführ Committed by V8 LUCI CQ

[heap] Fix test failure with disabled map space

Fix failing tests with --no-use-map-space enabled.

Bug: v8:12578
Change-Id: I121b0d22cd69e76b6c5c02d1f83a166af0610b83
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3663343Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80717}
parent 377df357
......@@ -582,6 +582,7 @@ class OldGenerationMemoryChunkIterator {
PageIterator old_iterator_;
PageIterator code_iterator_;
PageIterator map_iterator_;
const PageIterator map_iterator_end_;
LargePageIterator lo_iterator_;
LargePageIterator code_lo_iterator_;
};
......
......@@ -105,6 +105,8 @@ OldGenerationMemoryChunkIterator::OldGenerationMemoryChunkIterator(Heap* heap)
code_iterator_(heap->code_space()->begin()),
map_iterator_(heap->map_space() ? heap->map_space()->begin()
: PageRange::iterator(nullptr)),
map_iterator_end_(heap->map_space() ? heap->map_space()->end()
: PageRange::iterator(nullptr)),
lo_iterator_(heap->lo_space()->begin()),
code_lo_iterator_(heap->code_lo_space()->begin()) {}
......@@ -116,7 +118,7 @@ MemoryChunk* OldGenerationMemoryChunkIterator::next() {
V8_FALLTHROUGH;
}
case kMapState: {
if (map_iterator_ != heap_->map_space()->end()) return *(map_iterator_++);
if (map_iterator_ != map_iterator_end_) return *(map_iterator_++);
state_ = kCodeState;
V8_FALLTHROUGH;
}
......
......@@ -144,7 +144,11 @@ void CrashKeyCallback(v8::CrashKeyId id, const std::string& value) {
} // namespace
TEST_F(IsolateTest, SetAddCrashKeyCallback) {
isolate()->SetAddCrashKeyCallback(CrashKeyCallback);
EXPECT_EQ(crash_keys.size(), 6u);
internal::Isolate* i_isolate =
reinterpret_cast<internal::Isolate*>(isolate());
const bool has_map_space = i_isolate->heap()->map_space() != nullptr;
EXPECT_EQ(crash_keys.size(), has_map_space ? 6u : 5u);
}
} // namespace v8
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment