OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 VerifyMarkbitsAreClean(heap_->old_data_space()); | 330 VerifyMarkbitsAreClean(heap_->old_data_space()); |
331 VerifyMarkbitsAreClean(heap_->code_space()); | 331 VerifyMarkbitsAreClean(heap_->code_space()); |
332 VerifyMarkbitsAreClean(heap_->cell_space()); | 332 VerifyMarkbitsAreClean(heap_->cell_space()); |
333 VerifyMarkbitsAreClean(heap_->map_space()); | 333 VerifyMarkbitsAreClean(heap_->map_space()); |
334 VerifyMarkbitsAreClean(heap_->new_space()); | 334 VerifyMarkbitsAreClean(heap_->new_space()); |
335 | 335 |
336 LargeObjectIterator it(heap_->lo_space()); | 336 LargeObjectIterator it(heap_->lo_space()); |
337 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { | 337 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
338 MarkBit mark_bit = Marking::MarkBitFrom(obj); | 338 MarkBit mark_bit = Marking::MarkBitFrom(obj); |
339 ASSERT(Marking::IsWhite(mark_bit)); | 339 ASSERT(Marking::IsWhite(mark_bit)); |
| 340 ASSERT_EQ(0, Page::FromAddress(obj->address())->LiveBytes()); |
340 } | 341 } |
341 } | 342 } |
342 #endif | 343 #endif |
343 | 344 |
344 | 345 |
345 static void ClearMarkbitsInPagedSpace(PagedSpace* space) { | 346 static void ClearMarkbitsInPagedSpace(PagedSpace* space) { |
346 PageIterator it(space); | 347 PageIterator it(space); |
347 | 348 |
348 while (it.has_next()) { | 349 while (it.has_next()) { |
349 Bitmap::Clear(it.next()); | 350 Bitmap::Clear(it.next()); |
(...skipping 16 matching lines...) Expand all Loading... |
366 ClearMarkbitsInPagedSpace(heap_->old_pointer_space()); | 367 ClearMarkbitsInPagedSpace(heap_->old_pointer_space()); |
367 ClearMarkbitsInPagedSpace(heap_->old_data_space()); | 368 ClearMarkbitsInPagedSpace(heap_->old_data_space()); |
368 ClearMarkbitsInPagedSpace(heap_->cell_space()); | 369 ClearMarkbitsInPagedSpace(heap_->cell_space()); |
369 ClearMarkbitsInNewSpace(heap_->new_space()); | 370 ClearMarkbitsInNewSpace(heap_->new_space()); |
370 | 371 |
371 LargeObjectIterator it(heap_->lo_space()); | 372 LargeObjectIterator it(heap_->lo_space()); |
372 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { | 373 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
373 MarkBit mark_bit = Marking::MarkBitFrom(obj); | 374 MarkBit mark_bit = Marking::MarkBitFrom(obj); |
374 mark_bit.Clear(); | 375 mark_bit.Clear(); |
375 mark_bit.Next().Clear(); | 376 mark_bit.Next().Clear(); |
| 377 Page::FromAddress(obj->address())->ResetLiveBytes(); |
376 } | 378 } |
377 } | 379 } |
378 | 380 |
379 | 381 |
380 bool Marking::TransferMark(Address old_start, Address new_start) { | 382 bool Marking::TransferMark(Address old_start, Address new_start) { |
381 // This is only used when resizing an object. | 383 // This is only used when resizing an object. |
382 ASSERT(MemoryChunk::FromAddress(old_start) == | 384 ASSERT(MemoryChunk::FromAddress(old_start) == |
383 MemoryChunk::FromAddress(new_start)); | 385 MemoryChunk::FromAddress(new_start)); |
384 | 386 |
385 // If the mark doesn't move, we don't check the color of the object. | 387 // If the mark doesn't move, we don't check the color of the object. |
(...skipping 2199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2585 | 2587 |
2586 | 2588 |
2587 void MarkCompactCollector::ProcessWeakMaps() { | 2589 void MarkCompactCollector::ProcessWeakMaps() { |
2588 Object* weak_map_obj = encountered_weak_maps(); | 2590 Object* weak_map_obj = encountered_weak_maps(); |
2589 while (weak_map_obj != Smi::FromInt(0)) { | 2591 while (weak_map_obj != Smi::FromInt(0)) { |
2590 ASSERT(MarkCompactCollector::IsMarked(HeapObject::cast(weak_map_obj))); | 2592 ASSERT(MarkCompactCollector::IsMarked(HeapObject::cast(weak_map_obj))); |
2591 JSWeakMap* weak_map = reinterpret_cast<JSWeakMap*>(weak_map_obj); | 2593 JSWeakMap* weak_map = reinterpret_cast<JSWeakMap*>(weak_map_obj); |
2592 ObjectHashTable* table = ObjectHashTable::cast(weak_map->table()); | 2594 ObjectHashTable* table = ObjectHashTable::cast(weak_map->table()); |
2593 for (int i = 0; i < table->Capacity(); i++) { | 2595 for (int i = 0; i < table->Capacity(); i++) { |
2594 if (MarkCompactCollector::IsMarked(HeapObject::cast(table->KeyAt(i)))) { | 2596 if (MarkCompactCollector::IsMarked(HeapObject::cast(table->KeyAt(i)))) { |
2595 Object* value = table->get(table->EntryToValueIndex(i)); | 2597 int idx = ObjectHashTable::EntryToValueIndex(i); |
2596 StaticMarkingVisitor::VisitPointer(heap(), &value); | 2598 Object** slot = |
2597 table->set_unchecked(heap(), | 2599 HeapObject::RawField(table, FixedArray::OffsetOfElementAt(idx)); |
2598 table->EntryToValueIndex(i), | 2600 StaticMarkingVisitor::VisitPointer(heap(), slot); |
2599 value, | |
2600 UPDATE_WRITE_BARRIER); | |
2601 } | 2601 } |
2602 } | 2602 } |
2603 weak_map_obj = weak_map->next(); | 2603 weak_map_obj = weak_map->next(); |
2604 } | 2604 } |
2605 } | 2605 } |
2606 | 2606 |
2607 | 2607 |
2608 void MarkCompactCollector::ClearWeakMaps() { | 2608 void MarkCompactCollector::ClearWeakMaps() { |
2609 Object* weak_map_obj = encountered_weak_maps(); | 2609 Object* weak_map_obj = encountered_weak_maps(); |
2610 while (weak_map_obj != Smi::FromInt(0)) { | 2610 while (weak_map_obj != Smi::FromInt(0)) { |
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4135 while (buffer != NULL) { | 4135 while (buffer != NULL) { |
4136 SlotsBuffer* next_buffer = buffer->next(); | 4136 SlotsBuffer* next_buffer = buffer->next(); |
4137 DeallocateBuffer(buffer); | 4137 DeallocateBuffer(buffer); |
4138 buffer = next_buffer; | 4138 buffer = next_buffer; |
4139 } | 4139 } |
4140 *buffer_address = NULL; | 4140 *buffer_address = NULL; |
4141 } | 4141 } |
4142 | 4142 |
4143 | 4143 |
4144 } } // namespace v8::internal | 4144 } } // namespace v8::internal |
OLD | NEW |