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

Unified Diff: runtime/vm/isolate.cc

Issue 2985863002: Changes new space allocation from simple bump pointer allocation from (Closed)
Patch Set: Created 3 years, 5 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
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index c8f8ff2227e514e23e6556dc92699c36ad82502d..76b50ab1971efbc1c15d2d36a6b41e5dc1f7b732 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -2557,9 +2557,12 @@ Thread* Isolate::ScheduleThread(bool is_mutator, bool bypass_safepoint) {
os_thread->set_thread(thread);
if (is_mutator) {
mutator_thread_ = thread;
rmacnak 2017/07/25 21:02:45 Consider lazy allocation of the TLAB.
danunez 2017/07/26 20:19:20 Done.
- 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()) {
+ intptr_t tlab_size = heap()->CalculateTLABSize();
+ uword top = heap()->new_space()->TryAllocateNewTLAB(tlab_size);
+ ASSERT(top != 0);
+ mutator_thread_->set_top(top);
+ mutator_thread_->set_end(heap()->new_space()->top());
}
}
Thread::SetCurrent(thread);
@@ -2600,11 +2603,11 @@ 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.
+ 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;

Powered by Google App Engine
This is Rietveld 408576698