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

Unified Diff: runtime/vm/thread.cc

Issue 1261923008: Begin migration of InterruptableThreadState into Thread. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Parentheses. Created 5 years, 4 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') | runtime/vm/thread_interrupter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread.cc
diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
index a79b086b7e5c0b587049a5e48c17b71d8c18d9ff..4f18b5dd9d1cfc0ea344243e6b1784edbd6f1b19 100644
--- a/runtime/vm/thread.cc
+++ b/runtime/vm/thread.cc
@@ -18,7 +18,6 @@ namespace dart {
// The single thread local key which stores all the thread local data
// for a thread.
-// TODO(koda): Can we merge this with ThreadInterrupter::thread_state_key_?
ThreadLocalKey Thread::thread_key_ = OSThread::kUnsetThreadLocalKey;
@@ -126,17 +125,17 @@ void Thread::EnterIsolate(Isolate* isolate) {
ASSERT(isolate->mutator_thread() == NULL);
thread->isolate_ = isolate;
isolate->set_mutator_thread(thread);
- // TODO(koda): Migrate thread_state_ and profile_data_ to Thread, to allow
- // helper threads concurrent with mutator.
- ASSERT(isolate->thread_state() == NULL);
+ ASSERT(thread->thread_state() == NULL);
InterruptableThreadState* thread_state =
ThreadInterrupter::GetCurrentThreadState();
#if defined(DEBUG)
+ thread->set_thread_state(NULL); // Exclude thread itself from the dupe check.
Isolate::CheckForDuplicateThreadState(thread_state);
+ thread->set_thread_state(thread_state);
#endif
ASSERT(thread_state != NULL);
+ // TODO(koda): Migrate profiler interface to use Thread.
Profiler::BeginExecution(isolate);
- isolate->set_thread_state(thread_state);
isolate->set_vm_tag(VMTag::kVMTagId);
ASSERT(thread->store_buffer_block_ == NULL);
thread->store_buffer_block_ = isolate->store_buffer()->PopBlock();
@@ -160,8 +159,8 @@ void Thread::ExitIsolate() {
} else {
isolate->set_vm_tag(VMTag::kLoadWaitTagId);
}
- isolate->set_thread_state(NULL);
Profiler::EndExecution(isolate);
+ thread->set_thread_state(NULL);
isolate->set_mutator_thread(NULL);
thread->isolate_ = NULL;
ASSERT(Isolate::Current() == NULL);
@@ -176,6 +175,7 @@ void Thread::EnterIsolateAsHelper(Isolate* isolate) {
thread->isolate_ = isolate;
ASSERT(isolate->heap() != NULL);
thread->heap_ = isolate->heap();
+ ASSERT(thread->thread_state() == NULL);
// 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);
@@ -191,6 +191,7 @@ void Thread::ExitIsolateAsHelper() {
Isolate* isolate = thread->isolate();
ASSERT(isolate != NULL);
thread->Unschedule();
+ thread->set_thread_state(NULL);
thread->isolate_ = NULL;
thread->heap_ = NULL;
ASSERT(isolate->mutator_thread() != thread);
« no previous file with comments | « runtime/vm/thread.h ('k') | runtime/vm/thread_interrupter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698