Reviewers: Hannes Payer,
Message:
PTAL
Description:
Make sweeper threads respect the max_available_threads constraint.
BUG=
Please review this at https://codereview.chromium.org/916103005/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+13, -5 lines):
M src/heap/heap.h
M src/heap/heap.cc
M src/heap/incremental-marking.cc
M src/heap/mark-compact.cc
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index
a67bf050b2ee2aa6c677aff8d1cd308d05f654ea..fc871bc111781821a07ccf649e723cb95ad09cb2
100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -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.
@@ -5449,6 +5450,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);
Index: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index
0b353b70f1d269a79b747f65cedc23fc0d487958..cf76efbf3fb4268636cf77b134b4614608dabd23
100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -1299,6 +1299,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);
@@ -2110,6 +2112,8 @@ class Heap {
bool deserialization_complete_;
+ bool concurrent_sweeping_enabled_;
+
friend class AlwaysAllocateScope;
friend class Deserializer;
friend class Factory;
Index: src/heap/incremental-marking.cc
diff --git a/src/heap/incremental-marking.cc
b/src/heap/incremental-marking.cc
index
0ac8e56860a7167f97463bb353efdb137212e3e0..69f201c608e066a7c3659877aabdf3d770f683fa
100644
--- a/src/heap/incremental-marking.cc
+++ b/src/heap/incremental-marking.cc
@@ -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()) {
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index
37651e7133eb9c367b1cdff17e7a2df5b73ddadf..28674488b2155c22aac78c1f1e2465d5bd8d2458
100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -477,12 +477,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();
}
@@ -4147,7 +4147,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();
}
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.