| Index: src/heap/heap.cc
|
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc
|
| index 1462afc26cc2d30af8e5a2044f20259b699ae754..22eea2dcad75f40fe5af4d5717d55614ebd0ece3 100644
|
| --- a/src/heap/heap.cc
|
| +++ b/src/heap/heap.cc
|
| @@ -87,6 +87,7 @@
|
| old_space_(NULL),
|
| code_space_(NULL),
|
| map_space_(NULL),
|
| + cell_space_(NULL),
|
| lo_space_(NULL),
|
| gc_state_(NOT_IN_GC),
|
| gc_post_processing_depth_(0),
|
| @@ -171,7 +172,8 @@
|
| if (!HasBeenSetUp()) return 0;
|
|
|
| return new_space_.Capacity() + old_space_->Capacity() +
|
| - code_space_->Capacity() + map_space_->Capacity();
|
| + code_space_->Capacity() + map_space_->Capacity() +
|
| + cell_space_->Capacity();
|
| }
|
|
|
|
|
| @@ -179,7 +181,8 @@
|
| if (!HasBeenSetUp()) return 0;
|
|
|
| return old_space_->CommittedMemory() + code_space_->CommittedMemory() +
|
| - map_space_->CommittedMemory() + lo_space_->Size();
|
| + map_space_->CommittedMemory() + cell_space_->CommittedMemory() +
|
| + lo_space_->Size();
|
| }
|
|
|
|
|
| @@ -197,6 +200,7 @@
|
| old_space_->CommittedPhysicalMemory() +
|
| code_space_->CommittedPhysicalMemory() +
|
| map_space_->CommittedPhysicalMemory() +
|
| + cell_space_->CommittedPhysicalMemory() +
|
| lo_space_->CommittedPhysicalMemory();
|
| }
|
|
|
| @@ -222,13 +226,14 @@
|
| if (!HasBeenSetUp()) return 0;
|
|
|
| return new_space_.Available() + old_space_->Available() +
|
| - code_space_->Available() + map_space_->Available();
|
| + code_space_->Available() + map_space_->Available() +
|
| + cell_space_->Available();
|
| }
|
|
|
|
|
| bool Heap::HasBeenSetUp() {
|
| return old_space_ != NULL && code_space_ != NULL && map_space_ != NULL &&
|
| - lo_space_ != NULL;
|
| + cell_space_ != NULL && lo_space_ != NULL;
|
| }
|
|
|
|
|
| @@ -352,6 +357,13 @@
|
| ", committed: %6" V8_PTR_PREFIX "d KB\n",
|
| map_space_->SizeOfObjects() / KB, map_space_->Available() / KB,
|
| map_space_->CommittedMemory() / KB);
|
| + PrintPID("Cell space, used: %6" V8_PTR_PREFIX
|
| + "d KB"
|
| + ", available: %6" V8_PTR_PREFIX
|
| + "d KB"
|
| + ", committed: %6" V8_PTR_PREFIX "d KB\n",
|
| + cell_space_->SizeOfObjects() / KB, cell_space_->Available() / KB,
|
| + cell_space_->CommittedMemory() / KB);
|
| PrintPID("Large object space, used: %6" V8_PTR_PREFIX
|
| "d KB"
|
| ", available: %6" V8_PTR_PREFIX
|
| @@ -634,6 +646,9 @@
|
| CommittedMemory()));
|
| isolate_->counters()->heap_fraction_map_space()->AddSample(static_cast<int>(
|
| (map_space()->CommittedMemory() * 100.0) / CommittedMemory()));
|
| + isolate_->counters()->heap_fraction_cell_space()->AddSample(
|
| + static_cast<int>((cell_space()->CommittedMemory() * 100.0) /
|
| + CommittedMemory()));
|
| isolate_->counters()->heap_fraction_lo_space()->AddSample(static_cast<int>(
|
| (lo_space()->CommittedMemory() * 100.0) / CommittedMemory()));
|
|
|
| @@ -643,6 +658,8 @@
|
| static_cast<int>(SizeOfObjects() / KB));
|
| isolate_->counters()->heap_sample_map_space_committed()->AddSample(
|
| static_cast<int>(map_space()->CommittedMemory() / KB));
|
| + isolate_->counters()->heap_sample_cell_space_committed()->AddSample(
|
| + static_cast<int>(cell_space()->CommittedMemory() / KB));
|
| isolate_->counters()->heap_sample_code_space_committed()->AddSample(
|
| static_cast<int>(code_space()->CommittedMemory() / KB));
|
|
|
| @@ -672,6 +689,7 @@
|
| UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(old_space)
|
| UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(code_space)
|
| UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(map_space)
|
| + UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(cell_space)
|
| UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(lo_space)
|
| #undef UPDATE_COUNTERS_FOR_SPACE
|
| #undef UPDATE_FRAGMENTATION_FOR_SPACE
|
| @@ -1536,6 +1554,18 @@
|
| store_buffer()->IteratePointersToNewSpace(&ScavengeObject);
|
| }
|
|
|
| + // Copy objects reachable from simple cells by scavenging cell values
|
| + // directly.
|
| + HeapObjectIterator cell_iterator(cell_space_);
|
| + for (HeapObject* heap_object = cell_iterator.Next(); heap_object != NULL;
|
| + heap_object = cell_iterator.Next()) {
|
| + if (heap_object->IsCell()) {
|
| + Cell* cell = Cell::cast(heap_object);
|
| + Address value_address = cell->ValueAddress();
|
| + scavenge_visitor.VisitPointer(reinterpret_cast<Object**>(value_address));
|
| + }
|
| + }
|
| +
|
| // Copy objects reachable from the encountered weak collections list.
|
| scavenge_visitor.VisitPointer(&encountered_weak_collections_);
|
| // Copy objects reachable from the encountered weak cells.
|
| @@ -2800,7 +2830,7 @@
|
|
|
| HeapObject* result;
|
| {
|
| - AllocationResult allocation = AllocateRaw(size, OLD_SPACE, OLD_SPACE);
|
| + AllocationResult allocation = AllocateRaw(size, CELL_SPACE, CELL_SPACE);
|
| if (!allocation.To(&result)) return allocation;
|
| }
|
| result->set_map_no_write_barrier(cell_map());
|
| @@ -4748,6 +4778,8 @@
|
| code_space_->ReportStatistics();
|
| PrintF("Map space : ");
|
| map_space_->ReportStatistics();
|
| + PrintF("Cell space : ");
|
| + cell_space_->ReportStatistics();
|
| PrintF("Large object space : ");
|
| lo_space_->ReportStatistics();
|
| PrintF(">>>>>> ========================================= >>>>>>\n");
|
| @@ -4763,7 +4795,7 @@
|
| return HasBeenSetUp() &&
|
| (new_space_.ToSpaceContains(addr) || old_space_->Contains(addr) ||
|
| code_space_->Contains(addr) || map_space_->Contains(addr) ||
|
| - lo_space_->SlowContains(addr));
|
| + cell_space_->Contains(addr) || lo_space_->SlowContains(addr));
|
| }
|
|
|
|
|
| @@ -4785,6 +4817,8 @@
|
| return code_space_->Contains(addr);
|
| case MAP_SPACE:
|
| return map_space_->Contains(addr);
|
| + case CELL_SPACE:
|
| + return cell_space_->Contains(addr);
|
| case LO_SPACE:
|
| return lo_space_->SlowContains(addr);
|
| }
|
| @@ -4831,6 +4865,7 @@
|
|
|
| VerifyPointersVisitor no_dirty_regions_visitor;
|
| code_space_->Verify(&no_dirty_regions_visitor);
|
| + cell_space_->Verify(&no_dirty_regions_visitor);
|
|
|
| lo_space_->Verify();
|
| }
|
| @@ -5140,6 +5175,8 @@
|
| *stats->code_space_capacity = code_space_->Capacity();
|
| *stats->map_space_size = map_space_->SizeOfObjects();
|
| *stats->map_space_capacity = map_space_->Capacity();
|
| + *stats->cell_space_size = cell_space_->SizeOfObjects();
|
| + *stats->cell_space_capacity = cell_space_->Capacity();
|
| *stats->lo_space_size = lo_space_->Size();
|
| isolate_->global_handles()->RecordStats(stats);
|
| *stats->memory_allocator_size = isolate()->memory_allocator()->Size();
|
| @@ -5163,7 +5200,8 @@
|
|
|
| intptr_t Heap::PromotedSpaceSizeOfObjects() {
|
| return old_space_->SizeOfObjects() + code_space_->SizeOfObjects() +
|
| - map_space_->SizeOfObjects() + lo_space_->SizeOfObjects();
|
| + map_space_->SizeOfObjects() + cell_space_->SizeOfObjects() +
|
| + lo_space_->SizeOfObjects();
|
| }
|
|
|
|
|
| @@ -5305,6 +5343,11 @@
|
| if (map_space_ == NULL) return false;
|
| if (!map_space_->SetUp()) return false;
|
|
|
| + // Initialize simple cell space.
|
| + cell_space_ = new CellSpace(this, max_old_generation_size_, CELL_SPACE);
|
| + if (cell_space_ == NULL) return false;
|
| + if (!cell_space_->SetUp()) return false;
|
| +
|
| // The large object code space may contain code or data. We set the memory
|
| // to be non-executable here for safety, but this means we need to enable it
|
| // explicitly when allocating large code objects.
|
| @@ -5413,6 +5456,8 @@
|
| code_space_->MaximumCommittedMemory());
|
| PrintF("maximum_committed_by_map_space=%" V8_PTR_PREFIX "d ",
|
| map_space_->MaximumCommittedMemory());
|
| + PrintF("maximum_committed_by_cell_space=%" V8_PTR_PREFIX "d ",
|
| + cell_space_->MaximumCommittedMemory());
|
| PrintF("maximum_committed_by_lo_space=%" V8_PTR_PREFIX "d ",
|
| lo_space_->MaximumCommittedMemory());
|
| PrintF("\n\n");
|
| @@ -5448,6 +5493,12 @@
|
| map_space_->TearDown();
|
| delete map_space_;
|
| map_space_ = NULL;
|
| + }
|
| +
|
| + if (cell_space_ != NULL) {
|
| + cell_space_->TearDown();
|
| + delete cell_space_;
|
| + cell_space_ = NULL;
|
| }
|
|
|
| if (lo_space_ != NULL) {
|
| @@ -5590,6 +5641,8 @@
|
| return heap_->code_space();
|
| case MAP_SPACE:
|
| return heap_->map_space();
|
| + case CELL_SPACE:
|
| + return heap_->cell_space();
|
| case LO_SPACE:
|
| return heap_->lo_space();
|
| default:
|
| @@ -5606,6 +5659,8 @@
|
| return heap_->code_space();
|
| case MAP_SPACE:
|
| return heap_->map_space();
|
| + case CELL_SPACE:
|
| + return heap_->cell_space();
|
| default:
|
| return NULL;
|
| }
|
| @@ -5682,6 +5737,9 @@
|
| break;
|
| case MAP_SPACE:
|
| iterator_ = new HeapObjectIterator(heap_->map_space(), size_func_);
|
| + break;
|
| + case CELL_SPACE:
|
| + iterator_ = new HeapObjectIterator(heap_->cell_space(), size_func_);
|
| break;
|
| case LO_SPACE:
|
| iterator_ = new LargeObjectIterator(heap_->lo_space(), size_func_);
|
|
|