Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: src/heap/heap.cc

Issue 1465633002: [heap] pause/resume inline allocation observers around scavenge (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/heap/spaces.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 1576
1577 1577
1578 void Heap::Scavenge() { 1578 void Heap::Scavenge() {
1579 GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::SCAVENGER_SCAVENGE); 1579 GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::SCAVENGER_SCAVENGE);
1580 RelocationLock relocation_lock(this); 1580 RelocationLock relocation_lock(this);
1581 // There are soft limits in the allocation code, designed to trigger a mark 1581 // There are soft limits in the allocation code, designed to trigger a mark
1582 // sweep collection by failing allocations. There is no sense in trying to 1582 // sweep collection by failing allocations. There is no sense in trying to
1583 // trigger one during scavenge: scavenges allocation should always succeed. 1583 // trigger one during scavenge: scavenges allocation should always succeed.
1584 AlwaysAllocateScope scope(isolate()); 1584 AlwaysAllocateScope scope(isolate());
1585 1585
1586 // Bump-pointer allocations done during scavenge are not real allocations.
1587 // Pause the inline allocation steps.
1588 new_space()->PauseInlineAllocationObservers();
1589
1586 #ifdef VERIFY_HEAP 1590 #ifdef VERIFY_HEAP
1587 if (FLAG_verify_heap) VerifyNonPointerSpacePointers(this); 1591 if (FLAG_verify_heap) VerifyNonPointerSpacePointers(this);
1588 #endif 1592 #endif
1589 1593
1590 gc_state_ = SCAVENGE; 1594 gc_state_ = SCAVENGE;
1591 1595
1592 // Implements Cheney's copying algorithm 1596 // Implements Cheney's copying algorithm
1593 LOG(isolate_, ResourceEvent("scavenge", "begin")); 1597 LOG(isolate_, ResourceEvent("scavenge", "begin"));
1594 1598
1595 // Clear descriptor cache. 1599 // Clear descriptor cache.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 incremental_marking()->UpdateMarkingDequeAfterScavenge(); 1709 incremental_marking()->UpdateMarkingDequeAfterScavenge();
1706 1710
1707 ScavengeWeakObjectRetainer weak_object_retainer(this); 1711 ScavengeWeakObjectRetainer weak_object_retainer(this);
1708 ProcessYoungWeakReferences(&weak_object_retainer); 1712 ProcessYoungWeakReferences(&weak_object_retainer);
1709 1713
1710 DCHECK(new_space_front == new_space_.top()); 1714 DCHECK(new_space_front == new_space_.top());
1711 1715
1712 // Set age mark. 1716 // Set age mark.
1713 new_space_.set_age_mark(new_space_.top()); 1717 new_space_.set_age_mark(new_space_.top());
1714 1718
1715 // We start a new step without accounting the objects copied into to space 1719 new_space()->ResumeInlineAllocationObservers();
1716 // as those are not allocations.
1717 new_space_.StartNextInlineAllocationStep();
1718 1720
1719 array_buffer_tracker()->FreeDead(true); 1721 array_buffer_tracker()->FreeDead(true);
1720 1722
1721 // Update how much has survived scavenge. 1723 // Update how much has survived scavenge.
1722 IncrementYoungSurvivorsCounter(static_cast<int>( 1724 IncrementYoungSurvivorsCounter(static_cast<int>(
1723 (PromotedSpaceSizeOfObjects() - survived_watermark) + new_space_.Size())); 1725 (PromotedSpaceSizeOfObjects() - survived_watermark) + new_space_.Size()));
1724 1726
1725 LOG(isolate_, ResourceEvent("scavenge", "end")); 1727 LOG(isolate_, ResourceEvent("scavenge", "end"));
1726 1728
1727 gc_state_ = NOT_IN_GC; 1729 gc_state_ = NOT_IN_GC;
(...skipping 4431 matching lines...) Expand 10 before | Expand all | Expand 10 after
6159 } 6161 }
6160 6162
6161 6163
6162 // static 6164 // static
6163 int Heap::GetStaticVisitorIdForMap(Map* map) { 6165 int Heap::GetStaticVisitorIdForMap(Map* map) {
6164 return StaticVisitorBase::GetVisitorId(map); 6166 return StaticVisitorBase::GetVisitorId(map);
6165 } 6167 }
6166 6168
6167 } // namespace internal 6169 } // namespace internal
6168 } // namespace v8 6170 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/heap/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698