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/heap/heap.h" | 5 #include "src/heap/heap.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/ast/context-slot-cache.h" | 9 #include "src/ast/context-slot-cache.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1626 // | 1626 // |
1627 // There is guaranteed to be enough room at the top of the to space | 1627 // There is guaranteed to be enough room at the top of the to space |
1628 // for the addresses of promoted objects: every object promoted | 1628 // for the addresses of promoted objects: every object promoted |
1629 // frees up its size in bytes from the top of the new space, and | 1629 // frees up its size in bytes from the top of the new space, and |
1630 // objects are at least one pointer in size. | 1630 // objects are at least one pointer in size. |
1631 Address new_space_front = new_space_->ToSpaceStart(); | 1631 Address new_space_front = new_space_->ToSpaceStart(); |
1632 promotion_queue_.Initialize(); | 1632 promotion_queue_.Initialize(); |
1633 | 1633 |
1634 ScavengeVisitor scavenge_visitor(this); | 1634 ScavengeVisitor scavenge_visitor(this); |
1635 | 1635 |
1636 if (FLAG_scavenge_reclaim_unmodified_objects) { | 1636 isolate()->global_handles()->IdentifyWeakUnmodifiedObjects( |
1637 isolate()->global_handles()->IdentifyWeakUnmodifiedObjects( | 1637 &IsUnmodifiedHeapObject); |
1638 &IsUnmodifiedHeapObject); | |
1639 } | |
1640 | 1638 |
1641 { | 1639 { |
1642 // Copy roots. | 1640 // Copy roots. |
1643 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_ROOTS); | 1641 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_ROOTS); |
1644 IterateRoots(&scavenge_visitor, VISIT_ALL_IN_SCAVENGE); | 1642 IterateRoots(&scavenge_visitor, VISIT_ALL_IN_SCAVENGE); |
1645 } | 1643 } |
1646 | 1644 |
1647 { | 1645 { |
1648 // Copy objects reachable from the old generation. | 1646 // Copy objects reachable from the old generation. |
1649 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_OLD_TO_NEW_POINTERS); | 1647 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_OLD_TO_NEW_POINTERS); |
(...skipping 27 matching lines...) Expand all Loading... |
1677 if (collector->is_code_flushing_enabled()) { | 1675 if (collector->is_code_flushing_enabled()) { |
1678 collector->code_flusher()->IteratePointersToFromSpace(&scavenge_visitor); | 1676 collector->code_flusher()->IteratePointersToFromSpace(&scavenge_visitor); |
1679 } | 1677 } |
1680 } | 1678 } |
1681 | 1679 |
1682 { | 1680 { |
1683 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_SEMISPACE); | 1681 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_SEMISPACE); |
1684 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); | 1682 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); |
1685 } | 1683 } |
1686 | 1684 |
1687 if (FLAG_scavenge_reclaim_unmodified_objects) { | 1685 isolate()->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending( |
1688 isolate()->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending( | 1686 &IsUnscavengedHeapObject); |
1689 &IsUnscavengedHeapObject); | |
1690 | 1687 |
1691 isolate()->global_handles()->IterateNewSpaceWeakUnmodifiedRoots( | 1688 isolate()->global_handles()->IterateNewSpaceWeakUnmodifiedRoots( |
1692 &scavenge_visitor); | 1689 &scavenge_visitor); |
1693 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); | 1690 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); |
1694 } else { | |
1695 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_OBJECT_GROUPS); | |
1696 while (isolate()->global_handles()->IterateObjectGroups( | |
1697 &scavenge_visitor, &IsUnscavengedHeapObject)) { | |
1698 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); | |
1699 } | |
1700 isolate()->global_handles()->RemoveObjectGroups(); | |
1701 isolate()->global_handles()->RemoveImplicitRefGroups(); | |
1702 | |
1703 isolate()->global_handles()->IdentifyNewSpaceWeakIndependentHandles( | |
1704 &IsUnscavengedHeapObject); | |
1705 | |
1706 isolate()->global_handles()->IterateNewSpaceWeakIndependentRoots( | |
1707 &scavenge_visitor); | |
1708 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); | |
1709 } | |
1710 | 1691 |
1711 UpdateNewSpaceReferencesInExternalStringTable( | 1692 UpdateNewSpaceReferencesInExternalStringTable( |
1712 &UpdateNewSpaceReferenceInExternalStringTableEntry); | 1693 &UpdateNewSpaceReferenceInExternalStringTableEntry); |
1713 | 1694 |
1714 promotion_queue_.Destroy(); | 1695 promotion_queue_.Destroy(); |
1715 | 1696 |
1716 incremental_marking()->UpdateMarkingDequeAfterScavenge(); | 1697 incremental_marking()->UpdateMarkingDequeAfterScavenge(); |
1717 | 1698 |
1718 ScavengeWeakObjectRetainer weak_object_retainer(this); | 1699 ScavengeWeakObjectRetainer weak_object_retainer(this); |
1719 ProcessYoungWeakReferences(&weak_object_retainer); | 1700 ProcessYoungWeakReferences(&weak_object_retainer); |
(...skipping 4754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6474 } | 6455 } |
6475 | 6456 |
6476 | 6457 |
6477 // static | 6458 // static |
6478 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6459 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6479 return StaticVisitorBase::GetVisitorId(map); | 6460 return StaticVisitorBase::GetVisitorId(map); |
6480 } | 6461 } |
6481 | 6462 |
6482 } // namespace internal | 6463 } // namespace internal |
6483 } // namespace v8 | 6464 } // namespace v8 |
OLD | NEW |