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

Unified Diff: runtime/vm/thread.cc

Issue 1136143003: Remove fake isolate from concurrent sweeper and extend lifetime of VM threads. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 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
« no previous file with comments | « runtime/vm/thread.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread.cc
===================================================================
--- runtime/vm/thread.cc (revision 45808)
+++ runtime/vm/thread.cc (working copy)
@@ -38,9 +38,6 @@
void Thread::CleanUp() {
- // We currently deallocate the Thread, to ensure that embedder threads don't
- // leak the Thread structure. An alternative approach would be to clear and
- // reuse it, but register a destructor at the OS level.
Thread* current = Current();
if (current != NULL) {
delete current;
@@ -74,9 +71,8 @@
void Thread::ExitIsolate() {
Thread* thread = Thread::Current();
// TODO(koda): Audit callers; they should know whether they're in an isolate.
- if (thread == NULL) return;
+ if (thread == NULL || thread->isolate() == NULL) return;
Isolate* isolate = thread->isolate();
- ASSERT(isolate != NULL);
if (isolate->is_runnable()) {
isolate->set_vm_tag(VMTag::kIdleTagId);
} else {
@@ -87,10 +83,29 @@
isolate->set_mutator_thread(NULL);
thread->isolate_ = NULL;
ASSERT(Isolate::Current() == NULL);
- CleanUp();
}
+void Thread::EnterIsolateAsHelper(Isolate* isolate) {
+ EnsureInit();
+ Thread* thread = Thread::Current();
+ ASSERT(thread->isolate() == NULL);
+ thread->isolate_ = isolate;
+ // Do not update isolate->mutator_thread, but perform sanity check:
+ // this thread should not be both the main mutator and helper.
+ ASSERT(isolate->mutator_thread() != thread);
+}
+
+
+void Thread::ExitIsolateAsHelper() {
+ Thread* thread = Thread::Current();
+ Isolate* isolate = thread->isolate();
+ ASSERT(isolate != NULL);
+ thread->isolate_ = NULL;
+ ASSERT(isolate->mutator_thread() != thread);
+}
+
+
CHA* Thread::cha() const {
ASSERT(isolate_ != NULL);
return isolate_->cha_;
« no previous file with comments | « runtime/vm/thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698