Before the max_old_space_size was set for each space, which is not intuitive and not what we want. There is still a miss match between capacity and actual committed memory which should be cleaned up in a follow up cl.
BUG=
Review URL: https://codereview.chromium.org/
979783002
Cr-Commit-Position: refs/heads/master@{#26985}
}
-intptr_t Heap::CommittedMemory() {
+intptr_t Heap::CommittedOldGenerationMemory() {
if (!HasBeenSetUp()) return 0;
- return new_space_.CommittedMemory() + old_pointer_space_->CommittedMemory() +
+ return old_pointer_space_->CommittedMemory() +
old_data_space_->CommittedMemory() + code_space_->CommittedMemory() +
map_space_->CommittedMemory() + cell_space_->CommittedMemory() +
property_cell_space_->CommittedMemory() + lo_space_->Size();
}
+intptr_t Heap::CommittedMemory() {
+ if (!HasBeenSetUp()) return 0;
+
+ return new_space_.CommittedMemory() + CommittedOldGenerationMemory();
+}
+
+
size_t Heap::CommittedPhysicalMemory() {
if (!HasBeenSetUp()) return 0;
// Returns the amount of memory currently committed for the heap.
intptr_t CommittedMemory();
+ // Returns the amount of memory currently committed for the old space.
+ intptr_t CommittedOldGenerationMemory();
+
// Returns the amount of executable memory currently committed for the heap.
intptr_t CommittedMemoryExecutable();
return old_data_space_->allocation_limit_address();
}
+ // TODO(hpayer): There is still a missmatch between capacity and actual
+ // committed memory size.
+ bool CanExpandOldGeneration(int size) {
+ return (CommittedOldGenerationMemory() + size) < MaxOldGenerationSize();
+ }
+
// Returns a deep copy of the JavaScript object.
// Properties and elements are copied too.
// Optionally takes an AllocationSite to be appended in an AllocationMemento.
bool PagedSpace::CanExpand() {
DCHECK(max_capacity_ % AreaSize() == 0);
-
- if (Capacity() == max_capacity_) return false;
-
- DCHECK(Capacity() < max_capacity_);
+ DCHECK(Capacity() <= heap()->MaxOldGenerationSize());
+ DCHECK(heap()->CommittedOldGenerationMemory() <=
+ heap()->MaxOldGenerationSize());
// Are we going to exceed capacity for this space?
- if ((Capacity() + Page::kPageSize) > max_capacity_) return false;
+ if (!heap()->CanExpandOldGeneration(Page::kPageSize)) return false;
return true;
}
// Pages created during bootstrapping may contain immortal immovable objects.
if (!heap()->deserialization_complete()) p->MarkNeverEvacuate();
- DCHECK(Capacity() <= max_capacity_);
+ DCHECK(Capacity() <= heap()->MaxOldGenerationSize());
+ DCHECK(heap()->CommittedOldGenerationMemory() <=
+ heap()->MaxOldGenerationSize());
p->InsertAfter(anchor_.prev_page());