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

Unified Diff: src/heap/spaces-inl.h

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 | « src/heap/spaces.cc ('k') | src/heap/store-buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces-inl.h
diff --git a/src/heap/spaces-inl.h b/src/heap/spaces-inl.h
index 515a2027693c7d46954733df88e552dd225ef0ea..ccfb24f6e546d56b08e2dc6994190026a156ee89 100644
--- a/src/heap/spaces-inl.h
+++ b/src/heap/spaces-inl.h
@@ -147,6 +147,19 @@ HeapObject* HeapObjectIterator::FromCurrentPage() {
return NULL;
}
+// -----------------------------------------------------------------------------
+// LargePageIterator
+
+LargePageIterator::LargePageIterator(LargeObjectSpace* space)
+ : next_page_(space->first_page()) {}
+
+LargePage* LargePageIterator::next() {
+ LargePage* result = next_page_;
+ if (next_page_ != nullptr) {
+ next_page_ = next_page_->next_page();
+ }
+ return result;
+}
// -----------------------------------------------------------------------------
// MemoryAllocator
@@ -308,15 +321,15 @@ Page* Page::FromAnyPointerAddress(Heap* heap, Address addr) {
return static_cast<Page*>(MemoryChunk::FromAnyPointerAddress(heap, addr));
}
-
-PointerChunkIterator::PointerChunkIterator(Heap* heap)
+MemoryChunkIterator::MemoryChunkIterator(Heap* heap, Mode mode)
: state_(kOldSpaceState),
+ mode_(mode),
old_iterator_(heap->old_space()),
+ code_iterator_(heap->code_space()),
map_iterator_(heap->map_space()),
lo_iterator_(heap->lo_space()) {}
-
-MemoryChunk* PointerChunkIterator::next() {
+MemoryChunk* MemoryChunkIterator::next() {
switch (state_) {
case kOldSpaceState: {
if (old_iterator_.has_next()) {
@@ -326,33 +339,34 @@ MemoryChunk* PointerChunkIterator::next() {
// Fall through.
}
case kMapState: {
- if (map_iterator_.has_next()) {
+ if (mode_ != ALL_BUT_MAP_SPACE && map_iterator_.has_next()) {
return map_iterator_.next();
}
+ state_ = kCodeState;
+ // Fall through.
+ }
+ case kCodeState: {
+ if (mode_ != ALL_BUT_CODE_SPACE && code_iterator_.has_next()) {
+ return code_iterator_.next();
+ }
state_ = kLargeObjectState;
// Fall through.
}
case kLargeObjectState: {
- HeapObject* heap_object;
- do {
- heap_object = lo_iterator_.Next();
- if (heap_object == NULL) {
- state_ = kFinishedState;
- return NULL;
- }
- // Fixed arrays are the only pointer-containing objects in large
- // object space.
- } while (!heap_object->IsFixedArray());
- MemoryChunk* answer = MemoryChunk::FromAddress(heap_object->address());
- return answer;
+ MemoryChunk* answer = lo_iterator_.next();
+ if (answer != nullptr) {
+ return answer;
+ }
+ state_ = kFinishedState;
+ // Fall through;
}
case kFinishedState:
- return NULL;
+ return nullptr;
default:
break;
}
UNREACHABLE();
- return NULL;
+ return nullptr;
}
« no previous file with comments | « src/heap/spaces.cc ('k') | src/heap/store-buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698