| 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/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1619 gc_state_ = SCAVENGE; | 1619 gc_state_ = SCAVENGE; |
| 1620 | 1620 |
| 1621 // Implements Cheney's copying algorithm | 1621 // Implements Cheney's copying algorithm |
| 1622 LOG(isolate_, ResourceEvent("scavenge", "begin")); | 1622 LOG(isolate_, ResourceEvent("scavenge", "begin")); |
| 1623 | 1623 |
| 1624 // Used for updating survived_since_last_expansion_ at function end. | 1624 // Used for updating survived_since_last_expansion_ at function end. |
| 1625 intptr_t survived_watermark = PromotedSpaceSizeOfObjects(); | 1625 intptr_t survived_watermark = PromotedSpaceSizeOfObjects(); |
| 1626 | 1626 |
| 1627 scavenge_collector_->SelectScavengingVisitorsTable(); | 1627 scavenge_collector_->SelectScavengingVisitorsTable(); |
| 1628 | 1628 |
| 1629 array_buffer_tracker()->PrepareDiscoveryInNewSpace(); |
| 1630 |
| 1629 // Flip the semispaces. After flipping, to space is empty, from space has | 1631 // Flip the semispaces. After flipping, to space is empty, from space has |
| 1630 // live objects. | 1632 // live objects. |
| 1631 new_space_.Flip(); | 1633 new_space_.Flip(); |
| 1632 new_space_.ResetAllocationInfo(); | 1634 new_space_.ResetAllocationInfo(); |
| 1633 | 1635 |
| 1634 // We need to sweep newly copied objects which can be either in the | 1636 // We need to sweep newly copied objects which can be either in the |
| 1635 // to space or promoted to the old generation. For to-space | 1637 // to space or promoted to the old generation. For to-space |
| 1636 // objects, we treat the bottom of the to space as a queue. Newly | 1638 // objects, we treat the bottom of the to space as a queue. Newly |
| 1637 // copied and unswept objects lie between a 'front' mark and the | 1639 // copied and unswept objects lie between a 'front' mark and the |
| 1638 // allocation pointer. | 1640 // allocation pointer. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1738 incremental_marking()->UpdateMarkingDequeAfterScavenge(); | 1740 incremental_marking()->UpdateMarkingDequeAfterScavenge(); |
| 1739 | 1741 |
| 1740 ScavengeWeakObjectRetainer weak_object_retainer(this); | 1742 ScavengeWeakObjectRetainer weak_object_retainer(this); |
| 1741 ProcessYoungWeakReferences(&weak_object_retainer); | 1743 ProcessYoungWeakReferences(&weak_object_retainer); |
| 1742 | 1744 |
| 1743 DCHECK(new_space_front == new_space_.top()); | 1745 DCHECK(new_space_front == new_space_.top()); |
| 1744 | 1746 |
| 1745 // Set age mark. | 1747 // Set age mark. |
| 1746 new_space_.set_age_mark(new_space_.top()); | 1748 new_space_.set_age_mark(new_space_.top()); |
| 1747 | 1749 |
| 1748 array_buffer_tracker()->FreeDeadInNewSpace(); | 1750 array_buffer_tracker()->FreeDead(true); |
| 1749 | 1751 |
| 1750 // Update how much has survived scavenge. | 1752 // Update how much has survived scavenge. |
| 1751 IncrementYoungSurvivorsCounter(static_cast<int>( | 1753 IncrementYoungSurvivorsCounter(static_cast<int>( |
| 1752 (PromotedSpaceSizeOfObjects() - survived_watermark) + new_space_.Size())); | 1754 (PromotedSpaceSizeOfObjects() - survived_watermark) + new_space_.Size())); |
| 1753 | 1755 |
| 1754 LOG(isolate_, ResourceEvent("scavenge", "end")); | 1756 LOG(isolate_, ResourceEvent("scavenge", "end")); |
| 1755 | 1757 |
| 1756 gc_state_ = NOT_IN_GC; | 1758 gc_state_ = NOT_IN_GC; |
| 1757 } | 1759 } |
| 1758 | 1760 |
| (...skipping 4610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6369 } | 6371 } |
| 6370 | 6372 |
| 6371 | 6373 |
| 6372 // static | 6374 // static |
| 6373 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6375 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6374 return StaticVisitorBase::GetVisitorId(map); | 6376 return StaticVisitorBase::GetVisitorId(map); |
| 6375 } | 6377 } |
| 6376 | 6378 |
| 6377 } // namespace internal | 6379 } // namespace internal |
| 6378 } // namespace v8 | 6380 } // namespace v8 |
| OLD | NEW |