Make sweeper threads respect the max_available_threads constraint.
BUG= Review URL: https://codereview.chromium.org/916103005 Cr-Commit-Position: refs/heads/master@{#27091}
This commit is contained in:
parent
4f865389bc
commit
3f5ff276f3
@ -142,7 +142,8 @@ Heap::Heap()
|
||||
external_string_table_(this),
|
||||
chunks_queued_for_free_(NULL),
|
||||
gc_callbacks_depth_(0),
|
||||
deserialization_complete_(false) {
|
||||
deserialization_complete_(false),
|
||||
concurrent_sweeping_enabled_(false) {
|
||||
// Allow build-time customization of the max semispace size. Building
|
||||
// V8 with snapshots and a non-default max semispace size is much
|
||||
// easier if you can define it as part of the build environment.
|
||||
@ -5447,6 +5448,9 @@ bool Heap::SetUp() {
|
||||
if (!ConfigureHeapDefault()) return false;
|
||||
}
|
||||
|
||||
concurrent_sweeping_enabled_ =
|
||||
FLAG_concurrent_sweeping && isolate_->max_available_threads() > 1;
|
||||
|
||||
base::CallOnce(&initialize_gc_once, &InitializeGCOnce);
|
||||
|
||||
MarkMapPointersAsEncoded(false);
|
||||
|
@ -1316,6 +1316,8 @@ class Heap {
|
||||
// Returns the current sweep generation.
|
||||
int sweep_generation() { return sweep_generation_; }
|
||||
|
||||
bool concurrent_sweeping_enabled() { return concurrent_sweeping_enabled_; }
|
||||
|
||||
inline Isolate* isolate();
|
||||
|
||||
void CallGCPrologueCallbacks(GCType gc_type, GCCallbackFlags flags);
|
||||
@ -2131,6 +2133,8 @@ class Heap {
|
||||
|
||||
bool deserialization_complete_;
|
||||
|
||||
bool concurrent_sweeping_enabled_;
|
||||
|
||||
friend class AlwaysAllocateScope;
|
||||
friend class Deserializer;
|
||||
friend class Factory;
|
||||
|
@ -935,7 +935,7 @@ intptr_t IncrementalMarking::Step(intptr_t allocated_bytes,
|
||||
if (state_ == SWEEPING) {
|
||||
if (heap_->mark_compact_collector()->sweeping_in_progress() &&
|
||||
(heap_->mark_compact_collector()->IsSweepingCompleted() ||
|
||||
!FLAG_concurrent_sweeping)) {
|
||||
!heap_->concurrent_sweeping_enabled())) {
|
||||
heap_->mark_compact_collector()->EnsureSweepingCompleted();
|
||||
}
|
||||
if (!heap_->mark_compact_collector()->sweeping_in_progress()) {
|
||||
|
@ -481,12 +481,12 @@ void MarkCompactCollector::EnsureSweepingCompleted() {
|
||||
|
||||
// If sweeping is not completed or not running at all, we try to complete it
|
||||
// here.
|
||||
if (!FLAG_concurrent_sweeping || !IsSweepingCompleted()) {
|
||||
if (!heap()->concurrent_sweeping_enabled() || !IsSweepingCompleted()) {
|
||||
SweepInParallel(heap()->paged_space(OLD_DATA_SPACE), 0);
|
||||
SweepInParallel(heap()->paged_space(OLD_POINTER_SPACE), 0);
|
||||
}
|
||||
// Wait twice for both jobs.
|
||||
if (FLAG_concurrent_sweeping) {
|
||||
if (heap()->concurrent_sweeping_enabled()) {
|
||||
pending_sweeper_jobs_semaphore_.Wait();
|
||||
pending_sweeper_jobs_semaphore_.Wait();
|
||||
}
|
||||
@ -4371,7 +4371,7 @@ void MarkCompactCollector::SweepSpaces() {
|
||||
SweepSpace(heap()->old_data_space(), CONCURRENT_SWEEPING);
|
||||
}
|
||||
sweeping_in_progress_ = true;
|
||||
if (FLAG_concurrent_sweeping) {
|
||||
if (heap()->concurrent_sweeping_enabled()) {
|
||||
StartSweeperThreads();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user