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

Unified Diff: src/heap/spaces.cc

Issue 2464393002: [heap] Invoke incremental marking step before allocation. (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/incremental-marking.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index 17d2a70144b271c767270d2c87dbef185dec6042..2719fe35585d2dae2d64172d2a4e075661729036 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -2581,6 +2581,15 @@ HeapObject* FreeList::Allocate(size_t size_in_bytes) {
owner_->heap()->StartIncrementalMarkingIfAllocationLimitIsReached(
Heap::kNoGCFlags, kNoGCCallbackFlags);
+ // We cannot place incremental marking step in an AllocationObserver because
+ // 1) incremental marking step can change linear allocation area.
+ // 2) allocation observers are called after allocation.
+ // 3) allocation folding assumes that the newly allocated object immediately
+ // precedes the linear allocation area.
+ // See crbug.com/659165.
+ owner_->heap()
+ ->incremental_marking()
+ ->AdvanceIncrementalMarkingOnAllocation();
size_t new_node_size = 0;
FreeSpace* new_node = FindNodeFor(size_in_bytes, &new_node_size);
@@ -3010,6 +3019,8 @@ AllocationResult LargeObjectSpace::AllocateRaw(int object_size,
heap()->StartIncrementalMarkingIfAllocationLimitIsReached(Heap::kNoGCFlags,
kNoGCCallbackFlags);
+ heap()->incremental_marking()->AdvanceIncrementalMarkingOnAllocation();
+
AllocationStep(object->address(), object_size);
if (heap()->incremental_marking()->black_allocation()) {
« no previous file with comments | « src/heap/incremental-marking.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698