Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2010 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 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1575 for (int i = 0; i < kFreeListsLength; i++) { | 1575 for (int i = 0; i < kFreeListsLength; i++) { |
| 1576 Address cur_addr = free_[i].head_node_; | 1576 Address cur_addr = free_[i].head_node_; |
| 1577 while (cur_addr != NULL) { | 1577 while (cur_addr != NULL) { |
| 1578 FreeListNode* cur_node = FreeListNode::FromAddress(cur_addr); | 1578 FreeListNode* cur_node = FreeListNode::FromAddress(cur_addr); |
| 1579 if (cur_node == node) return true; | 1579 if (cur_node == node) return true; |
| 1580 cur_addr = cur_node->next(); | 1580 cur_addr = cur_node->next(); |
| 1581 } | 1581 } |
| 1582 } | 1582 } |
| 1583 return false; | 1583 return false; |
| 1584 } | 1584 } |
| 1585 | |
| 1586 | |
| 1587 void OldSpaceFreeList::Zap() { | |
| 1588 for (int i = 0; i < kFreeListsLength; i++) { | |
| 1589 Address cur_addr = free_[i].head_node_; | |
| 1590 while (cur_addr != NULL) { | |
| 1591 FreeListNode* cur_node = FreeListNode::FromAddress(cur_addr); | |
| 1592 if (cur_node->IsByteArray()) { | |
| 1593 ByteArray* ba = ByteArray::cast(cur_node); | |
| 1594 Address payload_start = ba->GetDataStartAddress(); | |
|
Vyacheslav Egorov (Chromium)
2011/01/21 18:18:18
This way you zap the next field of the cur_node!
Erik Corry
2011/01/24 13:56:00
Good catch. Done.
| |
| 1595 Address payload_end = ba->address() + ba->Size(); | |
| 1596 for (Address cur = payload_start; | |
| 1597 cur < payload_end; | |
| 1598 cur += kPointerSize) { | |
| 1599 *reinterpret_cast<Object**>(cur) = Smi::FromInt(0); | |
| 1600 } | |
| 1601 } | |
| 1602 cur_addr = cur_node->next(); | |
| 1603 } | |
| 1604 } | |
| 1605 } | |
| 1606 | |
| 1607 | |
| 1608 void FixedSizeFreeList::Zap() { | |
| 1609 Address cur_addr = head_; | |
| 1610 while (cur_addr != NULL && cur_addr != tail_) { | |
| 1611 FreeListNode* cur_node = FreeListNode::FromAddress(cur_addr); | |
|
Vyacheslav Egorov (Chromium)
2011/01/21 18:18:18
cur_node->Zap();
see above.
Erik Corry
2011/01/24 13:56:00
Done.
| |
| 1612 Address current = cur_addr + Map::kPointerFieldsBeginOffset; | |
| 1613 Address limit = cur_addr + Map::kPointerFieldsEndOffset; | |
| 1614 for (Address cur = current; cur < limit; cur += kPointerSize) { | |
| 1615 *reinterpret_cast<Object**>(cur) = Smi::FromInt(0); | |
| 1616 } | |
| 1617 cur_addr = cur_node->next(); | |
| 1618 } | |
| 1619 } | |
| 1585 #endif | 1620 #endif |
| 1586 | 1621 |
| 1587 | 1622 |
| 1588 FixedSizeFreeList::FixedSizeFreeList(AllocationSpace owner, int object_size) | 1623 FixedSizeFreeList::FixedSizeFreeList(AllocationSpace owner, int object_size) |
| 1589 : owner_(owner), object_size_(object_size) { | 1624 : owner_(owner), object_size_(object_size) { |
| 1590 Reset(); | 1625 Reset(); |
| 1591 } | 1626 } |
| 1592 | 1627 |
| 1593 | 1628 |
| 1594 void FixedSizeFreeList::Reset() { | 1629 void FixedSizeFreeList::Reset() { |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2300 } | 2335 } |
| 2301 | 2336 |
| 2302 | 2337 |
| 2303 void LargeObjectSpace::IterateDirtyRegions(ObjectSlotCallback copy_object) { | 2338 void LargeObjectSpace::IterateDirtyRegions(ObjectSlotCallback copy_object) { |
| 2304 LargeObjectIterator it(this); | 2339 LargeObjectIterator it(this); |
| 2305 for (HeapObject* object = it.next(); object != NULL; object = it.next()) { | 2340 for (HeapObject* object = it.next(); object != NULL; object = it.next()) { |
| 2306 // We only have code, sequential strings, or fixed arrays in large | 2341 // We only have code, sequential strings, or fixed arrays in large |
| 2307 // object space, and only fixed arrays can possibly contain pointers to | 2342 // object space, and only fixed arrays can possibly contain pointers to |
| 2308 // the young generation. | 2343 // the young generation. |
| 2309 if (object->IsFixedArray()) { | 2344 if (object->IsFixedArray()) { |
| 2310 Page* page = Page::FromAddress(object->address()); | |
| 2311 uint32_t marks = page->GetRegionMarks(); | |
| 2312 | |
| 2313 // TODO(gc): we can no longer assume that LargePage is bigger than normal | 2345 // TODO(gc): we can no longer assume that LargePage is bigger than normal |
| 2314 // page. | 2346 // page. |
| 2315 ASSERT(marks == Page::kAllRegionsDirtyMarks); | |
|
Vyacheslav Egorov (Chromium)
2011/01/21 18:18:18
Kill all constants/fields related to cardmarking.
Erik Corry
2011/01/24 13:56:00
Soon.
Nice time stamp.
| |
| 2316 USE(marks); | |
| 2317 | 2347 |
| 2318 Address start = object->address(); | 2348 Address start = object->address(); |
| 2319 Address object_end = start + object->Size(); | 2349 Address object_end = start + object->Size(); |
| 2320 Heap::IteratePointersInDirtyRegion(start, object_end, copy_object); | 2350 Heap::IteratePointersInDirtyRegion(start, object_end, copy_object); |
| 2321 } | 2351 } |
| 2322 } | 2352 } |
| 2323 } | 2353 } |
| 2324 | 2354 |
| 2325 | 2355 |
| 2326 void LargeObjectSpace::FreeUnmarkedObjects() { | 2356 void LargeObjectSpace::FreeUnmarkedObjects() { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2460 for (HeapObject* obj = obj_it.next(); obj != NULL; obj = obj_it.next()) { | 2490 for (HeapObject* obj = obj_it.next(); obj != NULL; obj = obj_it.next()) { |
| 2461 if (obj->IsCode()) { | 2491 if (obj->IsCode()) { |
| 2462 Code* code = Code::cast(obj); | 2492 Code* code = Code::cast(obj); |
| 2463 code_kind_statistics[code->kind()] += code->Size(); | 2493 code_kind_statistics[code->kind()] += code->Size(); |
| 2464 } | 2494 } |
| 2465 } | 2495 } |
| 2466 } | 2496 } |
| 2467 #endif // DEBUG | 2497 #endif // DEBUG |
| 2468 | 2498 |
| 2469 } } // namespace v8::internal | 2499 } } // namespace v8::internal |
| OLD | NEW |