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

Unified Diff: src/heap/heap.cc

Issue 1987363002: Revert of [heap] Do not invoke GC to make heap iterable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 months 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/heap.h ('k') | src/log.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 5dab9451677bf2c340bb075aadbbd2c6a541dc13..afdc7bb4cd397d69625ecdca09c295a668e0a6ae 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -893,8 +893,7 @@
isolate()->optimizing_compile_dispatcher()->Flush();
}
isolate()->ClearSerializerData();
- set_current_gc_flags(kAbortIncrementalMarkingMask |
- kReduceMemoryFootprintMask);
+ set_current_gc_flags(kMakeHeapIterableMask | kReduceMemoryFootprintMask);
isolate_->compilation_cache()->Clear();
const int kMaxNumberOfAttempts = 7;
const int kMinNumberOfAttempts = 2;
@@ -4033,10 +4032,22 @@
}
+bool Heap::IsHeapIterable() {
+ // TODO(hpayer): This function is not correct. Allocation folding in old
+ // space breaks the iterability.
+ return new_space_top_after_last_gc_ == new_space()->top();
+}
+
+
void Heap::MakeHeapIterable() {
+ DCHECK(AllowHeapAllocation::IsAllowed());
+ if (!IsHeapIterable()) {
+ CollectAllGarbage(kMakeHeapIterableMask, "Heap::MakeHeapIterable");
+ }
if (mark_compact_collector()->sweeping_in_progress()) {
mark_compact_collector()->EnsureSweepingCompleted();
}
+ DCHECK(IsHeapIterable());
}
@@ -4581,7 +4592,10 @@
CHECK(HasBeenSetUp());
HandleScope scope(isolate());
- MakeHeapIterable();
+ if (mark_compact_collector()->sweeping_in_progress()) {
+ // We have to wait here for the sweeper threads to have an iterable heap.
+ mark_compact_collector()->EnsureSweepingCompleted();
+ }
VerifyPointersVisitor visitor;
IterateRoots(&visitor, VISIT_ONLY_STRONG);
« no previous file with comments | « src/heap/heap.h ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698