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 | |
1631 // Flip the semispaces. After flipping, to space is empty, from space has | 1629 // Flip the semispaces. After flipping, to space is empty, from space has |
1632 // live objects. | 1630 // live objects. |
1633 new_space_.Flip(); | 1631 new_space_.Flip(); |
1634 new_space_.ResetAllocationInfo(); | 1632 new_space_.ResetAllocationInfo(); |
1635 | 1633 |
1636 // We need to sweep newly copied objects which can be either in the | 1634 // We need to sweep newly copied objects which can be either in the |
1637 // to space or promoted to the old generation. For to-space | 1635 // to space or promoted to the old generation. For to-space |
1638 // objects, we treat the bottom of the to space as a queue. Newly | 1636 // objects, we treat the bottom of the to space as a queue. Newly |
1639 // copied and unswept objects lie between a 'front' mark and the | 1637 // copied and unswept objects lie between a 'front' mark and the |
1640 // allocation pointer. | 1638 // allocation pointer. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 incremental_marking()->UpdateMarkingDequeAfterScavenge(); | 1735 incremental_marking()->UpdateMarkingDequeAfterScavenge(); |
1738 | 1736 |
1739 ScavengeWeakObjectRetainer weak_object_retainer(this); | 1737 ScavengeWeakObjectRetainer weak_object_retainer(this); |
1740 ProcessYoungWeakReferences(&weak_object_retainer); | 1738 ProcessYoungWeakReferences(&weak_object_retainer); |
1741 | 1739 |
1742 DCHECK(new_space_front == new_space_.top()); | 1740 DCHECK(new_space_front == new_space_.top()); |
1743 | 1741 |
1744 // Set age mark. | 1742 // Set age mark. |
1745 new_space_.set_age_mark(new_space_.top()); | 1743 new_space_.set_age_mark(new_space_.top()); |
1746 | 1744 |
1747 array_buffer_tracker()->FreeDead(true); | 1745 array_buffer_tracker()->FreeDeadInNewSpace(); |
1748 | 1746 |
1749 // Update how much has survived scavenge. | 1747 // Update how much has survived scavenge. |
1750 IncrementYoungSurvivorsCounter(static_cast<int>( | 1748 IncrementYoungSurvivorsCounter(static_cast<int>( |
1751 (PromotedSpaceSizeOfObjects() - survived_watermark) + new_space_.Size())); | 1749 (PromotedSpaceSizeOfObjects() - survived_watermark) + new_space_.Size())); |
1752 | 1750 |
1753 LOG(isolate_, ResourceEvent("scavenge", "end")); | 1751 LOG(isolate_, ResourceEvent("scavenge", "end")); |
1754 | 1752 |
1755 gc_state_ = NOT_IN_GC; | 1753 gc_state_ = NOT_IN_GC; |
1756 } | 1754 } |
1757 | 1755 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2017 return object; | 2015 return object; |
2018 } | 2016 } |
2019 | 2017 |
2020 | 2018 |
2021 HeapObject* Heap::DoubleAlignForDeserialization(HeapObject* object, int size) { | 2019 HeapObject* Heap::DoubleAlignForDeserialization(HeapObject* object, int size) { |
2022 return AlignWithFiller(object, size - kPointerSize, size, kDoubleAligned); | 2020 return AlignWithFiller(object, size - kPointerSize, size, kDoubleAligned); |
2023 } | 2021 } |
2024 | 2022 |
2025 | 2023 |
2026 void Heap::RegisterNewArrayBuffer(JSArrayBuffer* buffer) { | 2024 void Heap::RegisterNewArrayBuffer(JSArrayBuffer* buffer) { |
2027 return array_buffer_tracker()->RegisterNew(buffer); | 2025 const bool track_live = Marking::IsBlack(Marking::MarkBitFrom(buffer)); |
| 2026 return array_buffer_tracker()->RegisterNew(buffer, track_live); |
2028 } | 2027 } |
2029 | 2028 |
2030 | 2029 |
2031 void Heap::UnregisterArrayBuffer(JSArrayBuffer* buffer) { | 2030 void Heap::UnregisterArrayBuffer(JSArrayBuffer* buffer) { |
2032 return array_buffer_tracker()->Unregister(buffer); | 2031 return array_buffer_tracker()->Unregister(buffer); |
2033 } | 2032 } |
2034 | 2033 |
2035 | 2034 |
2036 void Heap::ConfigureInitialOldGenerationSize() { | 2035 void Heap::ConfigureInitialOldGenerationSize() { |
2037 if (!old_generation_size_configured_ && tracer()->SurvivalEventsRecorded()) { | 2036 if (!old_generation_size_configured_ && tracer()->SurvivalEventsRecorded()) { |
(...skipping 4330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6368 } | 6367 } |
6369 | 6368 |
6370 | 6369 |
6371 // static | 6370 // static |
6372 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6371 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6373 return StaticVisitorBase::GetVisitorId(map); | 6372 return StaticVisitorBase::GetVisitorId(map); |
6374 } | 6373 } |
6375 | 6374 |
6376 } // namespace internal | 6375 } // namespace internal |
6377 } // namespace v8 | 6376 } // namespace v8 |
OLD | NEW |