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

Unified Diff: runtime/vm/thread.cc

Issue 1276753003: Correct thread state update order (fixes Windows crashes). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Mac, Android. 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 | « no previous file | runtime/vm/thread_interrupter_android.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 b339229cbefd14d3ce181998a9047ea0a669a2ed..3b3eb3308d30b292147168449f670ba1f62033f5 100644
--- a/runtime/vm/thread.cc
+++ b/runtime/vm/thread.cc
@@ -125,6 +125,12 @@ void Thread::EnterIsolate(Isolate* isolate) {
ASSERT(!isolate->HasMutatorThread());
thread->isolate_ = isolate;
isolate->MakeCurrentThreadMutator(thread);
+ isolate->set_vm_tag(VMTag::kVMTagId);
+ ASSERT(thread->store_buffer_block_ == NULL);
+ thread->store_buffer_block_ = isolate->store_buffer()->PopNonFullBlock();
+ ASSERT(isolate->heap() != NULL);
+ thread->heap_ = isolate->heap();
+ thread->Schedule(isolate);
ASSERT(thread->thread_state() == NULL);
InterruptableThreadState* thread_state =
ThreadInterrupter::GetCurrentThreadState();
@@ -136,12 +142,6 @@ void Thread::EnterIsolate(Isolate* isolate) {
ASSERT(thread_state != NULL);
// TODO(koda): Migrate profiler interface to use Thread.
Profiler::BeginExecution(isolate);
- isolate->set_vm_tag(VMTag::kVMTagId);
- ASSERT(thread->store_buffer_block_ == NULL);
- thread->store_buffer_block_ = isolate->store_buffer()->PopNonFullBlock();
- ASSERT(isolate->heap() != NULL);
- thread->heap_ = isolate->heap();
- thread->Schedule(isolate);
}
@@ -150,6 +150,8 @@ void Thread::ExitIsolate() {
// TODO(koda): Audit callers; they should know whether they're in an isolate.
if (thread == NULL || thread->isolate() == NULL) return;
Isolate* isolate = thread->isolate();
+ Profiler::EndExecution(isolate);
+ thread->set_thread_state(NULL);
thread->Unschedule();
StoreBufferBlock* block = thread->store_buffer_block_;
thread->store_buffer_block_ = NULL;
@@ -159,8 +161,6 @@ void Thread::ExitIsolate() {
} else {
isolate->set_vm_tag(VMTag::kLoadWaitTagId);
}
- Profiler::EndExecution(isolate);
- thread->set_thread_state(NULL);
isolate->ClearMutatorThread();
thread->isolate_ = NULL;
ASSERT(Isolate::Current() == NULL);
« no previous file with comments | « no previous file | runtime/vm/thread_interrupter_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698