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 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 SetGCState(SCAVENGE); | 1603 SetGCState(SCAVENGE); |
1604 | 1604 |
1605 // Implements Cheney's copying algorithm | 1605 // Implements Cheney's copying algorithm |
1606 LOG(isolate_, ResourceEvent("scavenge", "begin")); | 1606 LOG(isolate_, ResourceEvent("scavenge", "begin")); |
1607 | 1607 |
1608 // Used for updating survived_since_last_expansion_ at function end. | 1608 // Used for updating survived_since_last_expansion_ at function end. |
1609 size_t survived_watermark = PromotedSpaceSizeOfObjects(); | 1609 size_t survived_watermark = PromotedSpaceSizeOfObjects(); |
1610 | 1610 |
1611 scavenge_collector_->SelectScavengingVisitorsTable(); | 1611 scavenge_collector_->SelectScavengingVisitorsTable(); |
1612 | 1612 |
1613 local_embedder_heap_tracer()->RegisterWrappersWithRemoteTracer(); | |
1614 | |
1615 // Flip the semispaces. After flipping, to space is empty, from space has | 1613 // Flip the semispaces. After flipping, to space is empty, from space has |
1616 // live objects. | 1614 // live objects. |
1617 new_space_->Flip(); | 1615 new_space_->Flip(); |
1618 new_space_->ResetAllocationInfo(); | 1616 new_space_->ResetAllocationInfo(); |
1619 | 1617 |
1620 // We need to sweep newly copied objects which can be either in the | 1618 // We need to sweep newly copied objects which can be either in the |
1621 // to space or promoted to the old generation. For to-space | 1619 // to space or promoted to the old generation. For to-space |
1622 // objects, we treat the bottom of the to space as a queue. Newly | 1620 // objects, we treat the bottom of the to space as a queue. Newly |
1623 // copied and unswept objects lie between a 'front' mark and the | 1621 // copied and unswept objects lie between a 'front' mark and the |
1624 // allocation pointer. | 1622 // allocation pointer. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1712 // Set age mark. | 1710 // Set age mark. |
1713 new_space_->set_age_mark(new_space_->top()); | 1711 new_space_->set_age_mark(new_space_->top()); |
1714 | 1712 |
1715 ArrayBufferTracker::FreeDeadInNewSpace(this); | 1713 ArrayBufferTracker::FreeDeadInNewSpace(this); |
1716 | 1714 |
1717 // Update how much has survived scavenge. | 1715 // Update how much has survived scavenge. |
1718 DCHECK_GE(PromotedSpaceSizeOfObjects(), survived_watermark); | 1716 DCHECK_GE(PromotedSpaceSizeOfObjects(), survived_watermark); |
1719 IncrementYoungSurvivorsCounter(PromotedSpaceSizeOfObjects() + | 1717 IncrementYoungSurvivorsCounter(PromotedSpaceSizeOfObjects() + |
1720 new_space_->Size() - survived_watermark); | 1718 new_space_->Size() - survived_watermark); |
1721 | 1719 |
| 1720 // Scavenger may find new wrappers by iterating objects promoted onto a black |
| 1721 // page. |
| 1722 local_embedder_heap_tracer()->RegisterWrappersWithRemoteTracer(); |
| 1723 |
1722 LOG(isolate_, ResourceEvent("scavenge", "end")); | 1724 LOG(isolate_, ResourceEvent("scavenge", "end")); |
1723 | 1725 |
1724 SetGCState(NOT_IN_GC); | 1726 SetGCState(NOT_IN_GC); |
1725 } | 1727 } |
1726 | 1728 |
1727 | 1729 |
1728 String* Heap::UpdateNewSpaceReferenceInExternalStringTableEntry(Heap* heap, | 1730 String* Heap::UpdateNewSpaceReferenceInExternalStringTableEntry(Heap* heap, |
1729 Object** p) { | 1731 Object** p) { |
1730 MapWord first_word = HeapObject::cast(*p)->map_word(); | 1732 MapWord first_word = HeapObject::cast(*p)->map_word(); |
1731 | 1733 |
(...skipping 4770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6502 } | 6504 } |
6503 | 6505 |
6504 | 6506 |
6505 // static | 6507 // static |
6506 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6508 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6507 return StaticVisitorBase::GetVisitorId(map); | 6509 return StaticVisitorBase::GetVisitorId(map); |
6508 } | 6510 } |
6509 | 6511 |
6510 } // namespace internal | 6512 } // namespace internal |
6511 } // namespace v8 | 6513 } // namespace v8 |
OLD | NEW |