OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1633 } | 1633 } |
1634 return NULL; | 1634 return NULL; |
1635 } | 1635 } |
1636 | 1636 |
1637 private: | 1637 private: |
1638 Heap* heap_; | 1638 Heap* heap_; |
1639 }; | 1639 }; |
1640 | 1640 |
1641 | 1641 |
1642 void Heap::Scavenge() { | 1642 void Heap::Scavenge() { |
1643 GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::SCAVENGER_SCAVENGE); | |
1643 RelocationLock relocation_lock(this); | 1644 RelocationLock relocation_lock(this); |
1644 // There are soft limits in the allocation code, designed to trigger a mark | 1645 // There are soft limits in the allocation code, designed to trigger a mark |
1645 // sweep collection by failing allocations. There is no sense in trying to | 1646 // sweep collection by failing allocations. There is no sense in trying to |
1646 // trigger one during scavenge: scavenges allocation should always succeed. | 1647 // trigger one during scavenge: scavenges allocation should always succeed. |
1647 AlwaysAllocateScope scope(isolate()); | 1648 AlwaysAllocateScope scope(isolate()); |
1648 | 1649 |
1649 #ifdef VERIFY_HEAP | 1650 #ifdef VERIFY_HEAP |
1650 if (FLAG_verify_heap) VerifyNonPointerSpacePointers(this); | 1651 if (FLAG_verify_heap) VerifyNonPointerSpacePointers(this); |
1651 #endif | 1652 #endif |
1652 | 1653 |
(...skipping 30 matching lines...) Expand all Loading... | |
1683 // objects lie between a 'front' mark and a 'rear' mark that is | 1684 // objects lie between a 'front' mark and a 'rear' mark that is |
1684 // updated as a side effect of promoting an object. | 1685 // updated as a side effect of promoting an object. |
1685 // | 1686 // |
1686 // There is guaranteed to be enough room at the top of the to space | 1687 // There is guaranteed to be enough room at the top of the to space |
1687 // for the addresses of promoted objects: every object promoted | 1688 // for the addresses of promoted objects: every object promoted |
1688 // frees up its size in bytes from the top of the new space, and | 1689 // frees up its size in bytes from the top of the new space, and |
1689 // objects are at least one pointer in size. | 1690 // objects are at least one pointer in size. |
1690 Address new_space_front = new_space_.ToSpaceStart(); | 1691 Address new_space_front = new_space_.ToSpaceStart(); |
1691 promotion_queue_.Initialize(); | 1692 promotion_queue_.Initialize(); |
1692 | 1693 |
1693 ScavengeVisitor scavenge_visitor(this); | 1694 ScavengeVisitor scavenge_visitor(this); |
Hannes Payer (out of office)
2015/07/20 08:50:25
This is another interesting event.
Michael Lippautz
2015/07/20 09:34:05
Done.
| |
1694 // Copy roots. | 1695 // Copy roots. |
1695 IterateRoots(&scavenge_visitor, VISIT_ALL_IN_SCAVENGE); | 1696 IterateRoots(&scavenge_visitor, VISIT_ALL_IN_SCAVENGE); |
1696 | 1697 |
1697 // Copy objects reachable from the old generation. | 1698 // Copy objects reachable from the old generation. |
1698 { | 1699 { |
1700 GCTracer::Scope gc_scope(tracer(), | |
1701 GCTracer::Scope::SCAVENGER_OLD_TO_NEW_POINTERS); | |
1699 StoreBufferRebuildScope scope(this, store_buffer(), | 1702 StoreBufferRebuildScope scope(this, store_buffer(), |
1700 &ScavengeStoreBufferCallback); | 1703 &ScavengeStoreBufferCallback); |
1701 store_buffer()->IteratePointersToNewSpace(&ScavengeObject); | 1704 store_buffer()->IteratePointersToNewSpace(&ScavengeObject); |
1702 } | 1705 } |
1703 | 1706 |
1704 // Copy objects reachable from the encountered weak collections list. | 1707 // Copy objects reachable from the encountered weak collections list. |
Hannes Payer (out of office)
2015/07/20 08:50:25
This is another interesting event.
Michael Lippautz
2015/07/20 09:34:05
Done.
| |
1705 scavenge_visitor.VisitPointer(&encountered_weak_collections_); | 1708 scavenge_visitor.VisitPointer(&encountered_weak_collections_); |
1706 // Copy objects reachable from the encountered weak cells. | 1709 // Copy objects reachable from the encountered weak cells. |
1707 scavenge_visitor.VisitPointer(&encountered_weak_cells_); | 1710 scavenge_visitor.VisitPointer(&encountered_weak_cells_); |
1708 | 1711 |
1709 // Copy objects reachable from the code flushing candidates list. | 1712 // Copy objects reachable from the code flushing candidates list. |
1710 MarkCompactCollector* collector = mark_compact_collector(); | 1713 MarkCompactCollector* collector = mark_compact_collector(); |
1711 if (collector->is_code_flushing_enabled()) { | 1714 if (collector->is_code_flushing_enabled()) { |
1712 collector->code_flusher()->IteratePointersToFromSpace(&scavenge_visitor); | 1715 collector->code_flusher()->IteratePointersToFromSpace(&scavenge_visitor); |
1713 } | 1716 } |
1714 | 1717 |
1715 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); | 1718 { |
1719 GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::SCAVENGER_SEMISPACE); | |
1720 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); | |
1721 } | |
1716 | 1722 |
1717 while (isolate()->global_handles()->IterateObjectGroups( | 1723 while (isolate()->global_handles()->IterateObjectGroups( |
Hannes Payer (out of office)
2015/07/20 08:50:25
This is another interesting event.
Let's increase
Michael Lippautz
2015/07/20 09:34:05
Done.
| |
1718 &scavenge_visitor, &IsUnscavengedHeapObject)) { | 1724 &scavenge_visitor, &IsUnscavengedHeapObject)) { |
1719 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); | 1725 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); |
1720 } | 1726 } |
1721 isolate()->global_handles()->RemoveObjectGroups(); | 1727 isolate()->global_handles()->RemoveObjectGroups(); |
1722 isolate()->global_handles()->RemoveImplicitRefGroups(); | 1728 isolate()->global_handles()->RemoveImplicitRefGroups(); |
1723 | 1729 |
1724 isolate()->global_handles()->IdentifyNewSpaceWeakIndependentHandles( | 1730 isolate()->global_handles()->IdentifyNewSpaceWeakIndependentHandles( |
1725 &IsUnscavengedHeapObject); | 1731 &IsUnscavengedHeapObject); |
1726 | 1732 |
1727 isolate()->global_handles()->IterateNewSpaceWeakIndependentRoots( | 1733 isolate()->global_handles()->IterateNewSpaceWeakIndependentRoots( |
(...skipping 5158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6886 *object_type = "CODE_TYPE"; \ | 6892 *object_type = "CODE_TYPE"; \ |
6887 *object_sub_type = "CODE_AGE/" #name; \ | 6893 *object_sub_type = "CODE_AGE/" #name; \ |
6888 return true; | 6894 return true; |
6889 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6895 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
6890 #undef COMPARE_AND_RETURN_NAME | 6896 #undef COMPARE_AND_RETURN_NAME |
6891 } | 6897 } |
6892 return false; | 6898 return false; |
6893 } | 6899 } |
6894 } // namespace internal | 6900 } // namespace internal |
6895 } // namespace v8 | 6901 } // namespace v8 |
OLD | NEW |