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

Unified Diff: runtime/vm/thread.cc

Issue 1814243002: Add Thread TaskKind (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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_test.cc » ('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 e0c1d55c5ad0aad381a26d8cf60e78ad934f4704..fd176c2c8255423e59f51045568533bbdb77d66c 100644
--- a/runtime/vm/thread.cc
+++ b/runtime/vm/thread.cc
@@ -63,6 +63,7 @@ Thread::Thread(Isolate* isolate)
top_exit_frame_info_(0),
store_buffer_block_(NULL),
vm_tag_(0),
+ task_kind_(kUnknownTask),
os_thread_(NULL),
thread_lock_(new Monitor()),
zone_(NULL),
@@ -224,6 +225,7 @@ bool Thread::EnterIsolate(Isolate* isolate) {
Thread* thread = isolate->ScheduleThread(kIsMutatorThread);
if (thread != NULL) {
ASSERT(thread->store_buffer_block_ == NULL);
+ thread->task_kind_ = kMutatorTask;
thread->StoreBufferAcquire();
return true;
}
@@ -235,7 +237,7 @@ void Thread::ExitIsolate() {
Thread* thread = Thread::Current();
ASSERT(thread != NULL && thread->IsMutatorThread());
DEBUG_ASSERT(!thread->IsAnyReusableHandleScopeActive());
-
+ thread->task_kind_ = kUnknownTask;
Isolate* isolate = thread->isolate();
ASSERT(isolate != NULL);
ASSERT(thread->execution_state() == Thread::kThreadInVM);
@@ -252,7 +254,10 @@ void Thread::ExitIsolate() {
}
-bool Thread::EnterIsolateAsHelper(Isolate* isolate, bool bypass_safepoint) {
+bool Thread::EnterIsolateAsHelper(Isolate* isolate,
+ TaskKind kind,
+ bool bypass_safepoint) {
+ ASSERT(kind != kMutatorTask);
const bool kIsNotMutatorThread = false;
Thread* thread = isolate->ScheduleThread(kIsNotMutatorThread,
bypass_safepoint);
@@ -263,6 +268,7 @@ bool Thread::EnterIsolateAsHelper(Isolate* isolate, bool bypass_safepoint) {
thread->store_buffer_block_ =
thread->isolate()->store_buffer()->PopEmptyBlock();
// This thread should not be the main mutator.
+ thread->task_kind_ = kind;
ASSERT(!thread->IsMutatorThread());
return true;
}
@@ -275,6 +281,7 @@ void Thread::ExitIsolateAsHelper(bool bypass_safepoint) {
ASSERT(thread != NULL);
ASSERT(!thread->IsMutatorThread());
ASSERT(thread->execution_state() == Thread::kThreadInVM);
+ thread->task_kind_ = kUnknownTask;
// Clear since GC will not visit the thread once it is unscheduled.
thread->ClearReusableHandles();
thread->StoreBufferRelease();
« no previous file with comments | « runtime/vm/thread.h ('k') | runtime/vm/thread_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698