Fixes the regression caused by 7568e1f18e.

The IO tests unscheduled the mutator thread constantly, forcing the
isolate to fill new space and cause a GC.

Now, the mutator thread keeps its TLAB when unscheduled, taking
advantage of the fact the same thread object will always be the
mutator thread.

R=asiva@google.com, rmacnak@google.com

Review-Url: https://codereview.chromium.org/2993863002 .
This commit is contained in:
Diogenes Nunez
2017-08-08 10:17:15 -07:00
parent e0805221da
commit 479db734e3
3 changed files with 7 additions and 25 deletions
-12
View File
@@ -2563,11 +2563,6 @@ Thread* Isolate::ScheduleThread(bool is_mutator, bool bypass_safepoint) {
os_thread->set_thread(thread);
if (is_mutator) {
scheduled_mutator_thread_ = thread;
if ((Dart::vm_isolate() != NULL) &&
(heap() != Dart::vm_isolate()->heap())) {
scheduled_mutator_thread_->set_top(0);
scheduled_mutator_thread_->set_end(0);
}
}
Thread::SetCurrent(thread);
os_thread->EnableThreadInterrupts();
@@ -2606,13 +2601,6 @@ void Isolate::UnscheduleThread(Thread* thread,
os_thread->set_thread(NULL);
OSThread::SetCurrent(os_thread);
if (is_mutator) {
if ((Dart::vm_isolate() != NULL) &&
(heap() != Dart::vm_isolate()->heap())) {
if (scheduled_mutator_thread_->HasActiveTLAB()) {
heap()->AbandonRemainingTLAB(scheduled_mutator_thread_);
}
}
ASSERT(!scheduled_mutator_thread_->HasActiveTLAB());
scheduled_mutator_thread_ = NULL;
}
thread->isolate_ = NULL;
+7 -11
View File
@@ -405,10 +405,8 @@ void Scavenger::Epilogue(Isolate* isolate,
// Ensure the mutator thread will fail the next allocation. This will force
// mutator to allocate a new TLAB
if (isolate->IsMutatorThreadScheduled()) {
Thread* mutator_thread = isolate->mutator_thread();
ASSERT(!mutator_thread->HasActiveTLAB());
}
Thread* mutator_thread = isolate->mutator_thread();
ASSERT((mutator_thread == NULL) || (!mutator_thread->HasActiveTLAB()));
double avg_frac = stats_history_.Get(0).PromoCandidatesSuccessFraction();
if (stats_history_.Size() >= 2) {
@@ -716,8 +714,8 @@ void Scavenger::ProcessWeakReferences() {
void Scavenger::MakeNewSpaceIterable() const {
ASSERT(heap_ != NULL);
if (heap_->isolate()->IsMutatorThreadScheduled() && !scavenging_) {
Thread* mutator_thread = heap_->isolate()->mutator_thread();
Thread* mutator_thread = heap_->isolate()->mutator_thread();
if (mutator_thread != NULL && !scavenging_) {
if (mutator_thread->HasActiveTLAB()) {
ASSERT(mutator_thread->top() <=
mutator_thread->heap()->new_space()->top());
@@ -802,11 +800,9 @@ void Scavenger::Scavenge(bool invoke_api_callbacks) {
int64_t post_safe_point = OS::GetCurrentMonotonicMicros();
heap_->RecordTime(kSafePoint, post_safe_point - pre_safe_point);
if (isolate->IsMutatorThreadScheduled()) {
Thread* mutator_thread = isolate->mutator_thread();
if (mutator_thread->HasActiveTLAB()) {
heap_->AbandonRemainingTLAB(mutator_thread);
}
Thread* mutator_thread = isolate->mutator_thread();
if ((mutator_thread != NULL) && (mutator_thread->HasActiveTLAB())) {
heap_->AbandonRemainingTLAB(mutator_thread);
}
// TODO(koda): Make verification more compatible with concurrent sweep.
-2
View File
@@ -366,11 +366,9 @@ class Thread : public BaseThread {
static intptr_t heap_offset() { return OFFSET_OF(Thread, heap_); }
void set_top(uword value) {
ASSERT(heap_ != NULL);
top_ = value;
}
void set_end(uword value) {
ASSERT(heap_ != NULL);
end_ = value;
}