if (size_difference > 0) {
Address address = proxy->address();
heap->CreateFillerObjectAt(address + map->instance_size(), size_difference);
- heap->AdjustLiveBytes(address, -size_difference,
+ heap->AdjustLiveBytes(*proxy, -size_difference,
Heap::CONCURRENT_TO_SWEEPER);
}
if (marks_handling == TRANSFER_MARKS) {
if (Marking::TransferColor(source, target)) {
- MemoryChunk::IncrementLiveBytesFromGC(target->address(), size);
+ MemoryChunk::IncrementLiveBytesFromGC(target, size);
}
}
}
}
-void Heap::AdjustLiveBytes(Address address, int by, InvocationMode mode) {
+void Heap::AdjustLiveBytes(HeapObject* object, int by, InvocationMode mode) {
if (incremental_marking()->IsMarking() &&
- Marking::IsBlack(Marking::MarkBitFrom(address))) {
+ Marking::IsBlack(Marking::MarkBitFrom(object->address()))) {
if (mode == SEQUENTIAL_TO_SWEEPER) {
- MemoryChunk::IncrementLiveBytesFromGC(address, by);
+ MemoryChunk::IncrementLiveBytesFromGC(object, by);
} else {
- MemoryChunk::IncrementLiveBytesFromMutator(address, by);
+ MemoryChunk::IncrementLiveBytesFromMutator(object, by);
}
}
}
// Maintain consistency of live bytes during incremental marking
marking()->TransferMark(object->address(), new_start);
- AdjustLiveBytes(new_start, -bytes_to_trim, Heap::CONCURRENT_TO_SWEEPER);
+ AdjustLiveBytes(new_object, -bytes_to_trim, Heap::CONCURRENT_TO_SWEEPER);
// Notify the heap profiler of change in object layout.
OnMoveEvent(new_object, object, new_object->Size());
object->synchronized_set_length(len - elements_to_trim);
// Maintain consistency of live bytes during incremental marking
- AdjustLiveBytes(object->address(), -bytes_to_trim, mode);
+ AdjustLiveBytes(object, -bytes_to_trim, mode);
// Notify the heap profiler of change in object layout. The array may not be
// moved during GC, and size has to be adjusted nevertheless.
enum InvocationMode { SEQUENTIAL_TO_SWEEPER, CONCURRENT_TO_SWEEPER };
// Maintain consistency of live bytes during incremental marking.
- void AdjustLiveBytes(Address address, int by, InvocationMode mode);
+ void AdjustLiveBytes(HeapObject* object, int by, InvocationMode mode);
// Trim the given array from the left. Note that this relocates the object
// start and hence is only valid if there is only a single reference to it.
DCHECK(IsMarking());
Marking::BlackToGrey(mark_bit);
int obj_size = obj->Size();
- MemoryChunk::IncrementLiveBytesFromGC(obj->address(), -obj_size);
+ MemoryChunk::IncrementLiveBytesFromGC(obj, -obj_size);
bytes_scanned_ -= obj_size;
int64_t old_bytes_rescanned = bytes_rescanned_;
bytes_rescanned_ = old_bytes_rescanned + obj_size;
HeapObject* heap_obj = HeapObject::cast(obj);
MarkBit mark_bit = Marking::MarkBitFrom(HeapObject::cast(obj));
if (Marking::IsBlack(mark_bit)) {
- MemoryChunk::IncrementLiveBytesFromGC(heap_obj->address(),
- -heap_obj->Size());
+ MemoryChunk::IncrementLiveBytesFromGC(heap_obj, -heap_obj->Size());
}
Marking::AnyToGrey(mark_bit);
}
DCHECK(!Marking::IsImpossible(mark_bit));
if (Marking::IsBlack(mark_bit)) return;
Marking::MarkBlack(mark_bit);
- MemoryChunk::IncrementLiveBytesFromGC(heap_object->address(), size);
+ MemoryChunk::IncrementLiveBytesFromGC(heap_object, size);
}
MarkBit mark_bit = Marking::MarkBitFrom(heap_object);
if (Marking::IsWhite(mark_bit)) {
Marking::MarkBlack(mark_bit);
- MemoryChunk::IncrementLiveBytesFromGC(heap_object->address(),
- heap_object->Size());
+ MemoryChunk::IncrementLiveBytesFromGC(heap_object, heap_object->Size());
return true;
}
return false;
if (FLAG_cleanup_code_caches_at_gc) {
PolymorphicCodeCache* poly_cache = heap_->polymorphic_code_cache();
Marking::GreyToBlack(Marking::MarkBitFrom(poly_cache));
- MemoryChunk::IncrementLiveBytesFromGC(poly_cache->address(),
+ MemoryChunk::IncrementLiveBytesFromGC(poly_cache,
PolymorphicCodeCache::kSize);
}
MarkBit mark_bit = Marking::MarkBitFrom(cache);
if (Marking::IsGrey(mark_bit)) {
Marking::GreyToBlack(mark_bit);
- MemoryChunk::IncrementLiveBytesFromGC(cache->address(), cache->Size());
+ MemoryChunk::IncrementLiveBytesFromGC(cache, cache->Size());
}
}
context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK);
DCHECK(Marking::MarkBitFrom(obj) == mark_bit);
if (Marking::IsWhite(mark_bit)) {
Marking::WhiteToBlack(mark_bit);
- MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size());
+ MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size());
DCHECK(obj->GetIsolate()->heap()->Contains(obj));
marking_deque_.PushBlack(obj);
}
DCHECK(Marking::IsWhite(mark_bit));
DCHECK(Marking::MarkBitFrom(obj) == mark_bit);
Marking::WhiteToBlack(mark_bit);
- MemoryChunk::IncrementLiveBytesFromGC(obj->address(), obj->Size());
+ MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size());
}
MarkBit markbit = Marking::MarkBitFrom(object);
if ((object->map() != filler_map) && Marking::IsGrey(markbit)) {
Marking::GreyToBlack(markbit);
- MemoryChunk::IncrementLiveBytesFromGC(object->address(), object->Size());
+ MemoryChunk::IncrementLiveBytesFromGC(object, object->Size());
marking_deque->PushBlack(object);
if (marking_deque->IsFull()) return;
}
Marking::GreyToBlack(markbit);
Address addr = cell_base + offset * kPointerSize;
HeapObject* object = HeapObject::FromAddress(addr);
- MemoryChunk::IncrementLiveBytesFromGC(object->address(), object->Size());
+ MemoryChunk::IncrementLiveBytesFromGC(object, object->Size());
marking_deque->PushBlack(object);
if (marking_deque->IsFull()) return;
offset += 2;
DCHECK(object->IsHeapObject());
if (IsFull()) {
Marking::BlackToGrey(object);
- MemoryChunk::IncrementLiveBytesFromGC(object->address(), -object->Size());
+ MemoryChunk::IncrementLiveBytesFromGC(object, -object->Size());
SetOverflowed();
} else {
array_[top_] = object;
DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object)));
if (IsFull()) {
Marking::BlackToGrey(object);
- MemoryChunk::IncrementLiveBytesFromGC(object->address(), -object->Size());
+ MemoryChunk::IncrementLiveBytesFromGC(object, -object->Size());
SetOverflowed();
} else {
bottom_ = ((bottom_ - 1) & mask_);
// -----------------------------------------------------------------------------
// MemoryChunk implementation
-void MemoryChunk::IncrementLiveBytesFromMutator(Address address, int by) {
- MemoryChunk* chunk = MemoryChunk::FromAddress(address);
+void MemoryChunk::IncrementLiveBytesFromMutator(HeapObject* object, int by) {
+ MemoryChunk* chunk = MemoryChunk::FromAddress(object->address());
if (!chunk->InNewSpace() && !static_cast<Page*>(chunk)->WasSwept()) {
static_cast<PagedSpace*>(chunk->owner())->IncrementUnsweptFreeBytes(-by);
}
progress_bar();
}
- static void IncrementLiveBytesFromGC(Address address, int by) {
- MemoryChunk::FromAddress(address)->IncrementLiveBytes(by);
+ static void IncrementLiveBytesFromGC(HeapObject* object, int by) {
+ MemoryChunk::FromAddress(object->address())->IncrementLiveBytes(by);
}
- static void IncrementLiveBytesFromMutator(Address address, int by);
+ static void IncrementLiveBytesFromMutator(HeapObject* object, int by);
static const intptr_t kAlignment =
(static_cast<uintptr_t>(1) << kPageSizeBits);
self->set_resource(resource);
if (is_internalized) self->Hash(); // Force regeneration of the hash value.
- heap->AdjustLiveBytes(this->address(), new_size - size,
- Heap::CONCURRENT_TO_SWEEPER);
+ heap->AdjustLiveBytes(this, new_size - size, Heap::CONCURRENT_TO_SWEEPER);
return true;
}
self->set_resource(resource);
if (is_internalized) self->Hash(); // Force regeneration of the hash value.
- heap->AdjustLiveBytes(this->address(), new_size - size,
- Heap::CONCURRENT_TO_SWEEPER);
+ heap->AdjustLiveBytes(this, new_size - size, Heap::CONCURRENT_TO_SWEEPER);
return true;
}
Address address = object->address();
heap->CreateFillerObjectAt(
address + new_instance_size, instance_size_delta);
- heap->AdjustLiveBytes(address, -instance_size_delta,
+ heap->AdjustLiveBytes(*object, -instance_size_delta,
Heap::CONCURRENT_TO_SWEEPER);
}
Heap* heap = isolate->heap();
heap->CreateFillerObjectAt(object->address() + new_instance_size,
instance_size_delta);
- heap->AdjustLiveBytes(object->address(), -instance_size_delta,
+ heap->AdjustLiveBytes(*object, -instance_size_delta,
Heap::CONCURRENT_TO_SWEEPER);
}
// that are a multiple of pointer size.
heap->CreateFillerObjectAt(start_of_string + new_size, delta);
}
- heap->AdjustLiveBytes(start_of_string, -delta, Heap::CONCURRENT_TO_SWEEPER);
+ heap->AdjustLiveBytes(*string, -delta, Heap::CONCURRENT_TO_SWEEPER);
// We are storing the new length using release store after creating a filler
// for the left-over space to avoid races with the sweeper thread.
if (!heap->lo_space()->Contains(*answer)) {
heap->CreateFillerObjectAt(end_of_string, delta);
}
- heap->AdjustLiveBytes(answer->address(), -delta, Heap::CONCURRENT_TO_SWEEPER);
+ heap->AdjustLiveBytes(*answer, -delta, Heap::CONCURRENT_TO_SWEEPER);
return *answer;
}