Commit 43040781 authored by Ali Ijaz Sheikh's avatar Ali Ijaz Sheikh Committed by Commit Bot

[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/617923Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ali Ijaz Sheikh <ofrobots@google.com>
Cr-Commit-Position: refs/heads/master@{#47413}
parent 6e5606ef
......@@ -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);
};
......
......@@ -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();
......
......@@ -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;
......
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