[heap] move GetNextInlineAllocationStepSize to Space

Some preperatory refactoring to allow observation of inline allocations
from Old Space.

BUG=chromium:633920

Change-Id: Ia1232591860729fcd8942d816aa454171d3aec33
Reviewed-on: https://chromium-review.googlesource.com/617923
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ali Ijaz Sheikh <ofrobots@google.com>
Cr-Commit-Position: refs/heads/master@{#47413}
This commit is contained in:
Ali Ijaz Sheikh 2017-08-16 13:41:21 -07:00 committed by Commit Bot
parent 6e5606efda
commit 43040781a6
3 changed files with 14 additions and 16 deletions

View File

@ -2669,9 +2669,7 @@ class AllocationObserver {
intptr_t bytes_to_next_step_;
private:
friend class LargeObjectSpace;
friend class NewSpace;
friend class PagedSpace;
friend class Space;
DISALLOW_COPY_AND_ASSIGN(AllocationObserver);
};

View File

@ -1381,6 +1381,17 @@ void Space::AllocationStep(Address soon_object, int size) {
}
}
intptr_t Space::GetNextInlineAllocationStepSize() {
intptr_t next_step = 0;
for (int i = 0; i < allocation_observers_->length(); ++i) {
AllocationObserver* o = (*allocation_observers_)[i];
next_step = next_step ? Min(next_step, o->bytes_to_next_step())
: o->bytes_to_next_step();
}
DCHECK(allocation_observers_->length() == 0 || next_step != 0);
return next_step;
}
PagedSpace::PagedSpace(Heap* heap, AllocationSpace space,
Executability executable)
: Space(heap, space, executable), anchor_(this), free_list_(this) {
@ -2097,18 +2108,6 @@ void NewSpace::StartNextInlineAllocationStep() {
}
}
intptr_t NewSpace::GetNextInlineAllocationStepSize() {
intptr_t next_step = 0;
for (int i = 0; i < allocation_observers_->length(); ++i) {
AllocationObserver* o = (*allocation_observers_)[i];
next_step = next_step ? Min(next_step, o->bytes_to_next_step())
: o->bytes_to_next_step();
}
DCHECK(allocation_observers_->length() == 0 || next_step != 0);
return next_step;
}
void NewSpace::AddAllocationObserver(AllocationObserver* observer) {
Space::AddAllocationObserver(observer);
StartNextInlineAllocationStep();

View File

@ -969,6 +969,8 @@ class Space : public Malloced {
#endif
protected:
intptr_t GetNextInlineAllocationStepSize();
std::unique_ptr<List<AllocationObserver*>> allocation_observers_;
bool allocation_observers_paused_;
@ -2746,7 +2748,6 @@ class NewSpace : public Space {
// different when we cross a page boundary or reset the space.
void InlineAllocationStep(Address top, Address new_top, Address soon_object,
size_t size);
intptr_t GetNextInlineAllocationStepSize();
void StartNextInlineAllocationStep();
friend class SemiSpaceIterator;