Chromium Code Reviews| Index: runtime/vm/isolate.cc |
| diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc |
| index 8589373d6fda2de551c70ceb77942a4a4ae4c2b7..f040466a26d90fe2eae507f93aa222d5b83ca040 100644 |
| --- a/runtime/vm/isolate.cc |
| +++ b/runtime/vm/isolate.cc |
| @@ -2574,9 +2574,9 @@ Thread* Isolate::ScheduleThread(bool is_mutator, bool bypass_safepoint) { |
| os_thread->set_thread(thread); |
| if (is_mutator) { |
| mutator_thread_ = thread; |
| - if (this != Dart::vm_isolate()) { |
| - mutator_thread_->set_top(heap()->new_space()->top()); |
| - mutator_thread_->set_end(heap()->new_space()->end()); |
| + if (Dart::vm_isolate() != NULL && heap() != Dart::vm_isolate()->heap()) { |
|
rmacnak
2017/07/26 21:30:30
if ((Dart::vm_isolate() != NULL) && (heap() != Dar
danunez
2017/07/26 22:07:11
Done.
|
| + mutator_thread_->set_top(0); |
| + mutator_thread_->set_end(0); |
| } |
| } |
| Thread::SetCurrent(thread); |
| @@ -2617,11 +2617,13 @@ void Isolate::UnscheduleThread(Thread* thread, |
| OSThread::SetCurrent(os_thread); |
| if (is_mutator) { |
| if (this != Dart::vm_isolate()) { |
| - heap()->new_space()->set_top(mutator_thread_->top_); |
| - heap()->new_space()->set_end(mutator_thread_->end_); |
| + // Ensure the new space is pointing right after the last object allocated. |
| + if (mutator_thread_->HasActiveTLAB()) { |
| + heap()->new_space()->set_top(mutator_thread_->top()); |
| + } |
| } |
| - mutator_thread_->top_ = 0; |
| - mutator_thread_->end_ = 0; |
| + mutator_thread_->set_top(0); |
| + mutator_thread_->set_end(0); |
| mutator_thread_ = NULL; |
| } |
| thread->isolate_ = NULL; |