Commit c74b7f3a authored by Michal Majewski's avatar Michal Majewski Committed by Commit Bot

Remove AllSpaces iterator since it's the same as SpaceIterator.

Bug: v8:6972
Change-Id: I1dff2fac359222cb13ec7f14d59be63ffd910701
Reviewed-on: https://chromium-review.googlesource.com/801734Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Michał Majewski <majeski@google.com>
Cr-Commit-Position: refs/heads/master@{#49825}
parent 5275c3c4
......@@ -296,9 +296,9 @@ size_t Heap::Available() {
if (!HasBeenSetUp()) return 0;
size_t total = 0;
AllSpaces spaces(this);
for (Space* space = spaces.next(); space != nullptr; space = spaces.next()) {
total += space->Available();
for (SpaceIterator it(this); it.has_next();) {
total += it.next()->Available();
}
return total;
}
......@@ -650,9 +650,9 @@ void Heap::GarbageCollectionPrologue() {
size_t Heap::SizeOfObjects() {
size_t total = 0;
AllSpaces spaces(this);
for (Space* space = spaces.next(); space != nullptr; space = spaces.next()) {
total += space->SizeOfObjects();
for (SpaceIterator it(this); it.has_next();) {
total += it.next()->SizeOfObjects();
}
return total;
}
......@@ -4569,9 +4569,9 @@ void Heap::CollectCodeStatistics() {
void Heap::Print() {
if (!HasBeenSetUp()) return;
isolate()->PrintStack(stdout);
AllSpaces spaces(this);
for (Space* space = spaces.next(); space != nullptr; space = spaces.next()) {
space->Print();
for (SpaceIterator it(this); it.has_next();) {
it.next()->Print();
}
}
......@@ -6109,22 +6109,6 @@ void Heap::RecordWritesIntoCode(Code* code) {
}
}
Space* AllSpaces::next() {
switch (counter_++) {
case NEW_SPACE:
return heap_->new_space();
case OLD_SPACE:
return heap_->old_space();
case CODE_SPACE:
return heap_->code_space();
case MAP_SPACE:
return heap_->map_space();
case LO_SPACE:
return heap_->lo_space();
default:
return nullptr;
}
}
PagedSpace* PagedSpaces::next() {
switch (counter_++) {
......
......@@ -2700,19 +2700,6 @@ class VerifySmisVisitor : public RootVisitor {
};
// Space iterator for iterating over all spaces of the heap. Returns each space
// in turn, and null when it is done.
class AllSpaces BASE_EMBEDDED {
public:
explicit AllSpaces(Heap* heap) : heap_(heap), counter_(FIRST_SPACE) {}
Space* next();
private:
Heap* heap_;
int counter_;
};
// Space iterator for iterating over all old spaces of the heap: Old space
// and code space. Returns each space in turn, and null when it is done.
class V8_EXPORT_PRIVATE OldSpaces BASE_EMBEDDED {
......
......@@ -71,16 +71,14 @@ bool HeapObjectIterator::AdvanceToNextPage() {
PauseAllocationObserversScope::PauseAllocationObserversScope(Heap* heap)
: heap_(heap) {
AllSpaces spaces(heap_);
for (Space* space = spaces.next(); space != nullptr; space = spaces.next()) {
space->PauseAllocationObservers();
for (SpaceIterator it(heap_); it.has_next();) {
it.next()->PauseAllocationObservers();
}
}
PauseAllocationObserversScope::~PauseAllocationObserversScope() {
AllSpaces spaces(heap_);
for (Space* space = spaces.next(); space != nullptr; space = spaces.next()) {
space->ResumeAllocationObservers();
for (SpaceIterator it(heap_); it.has_next();) {
it.next()->ResumeAllocationObservers();
}
}
......
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