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

Unified Diff: runtime/vm/thread.cc

Issue 1537543002: Fix for issue 25236 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-comments Created 5 years 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_registry.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 db6f42e20438db6f2820330a6119baddf98e748a..56ea06e01667b7cafb16e4e31849bb1d08b52fb6 100644
--- a/runtime/vm/thread.cc
+++ b/runtime/vm/thread.cc
@@ -172,16 +172,20 @@ RawGrowableObjectArray* Thread::pending_functions() {
}
-void Thread::EnterIsolate(Isolate* isolate) {
+bool Thread::EnterIsolate(Isolate* isolate) {
const bool kIsMutatorThread = true;
const bool kDontBypassSafepoints = false;
ThreadRegistry* tr = isolate->thread_registry();
Thread* thread = tr->Schedule(
isolate, kIsMutatorThread, kDontBypassSafepoints);
- isolate->MakeCurrentThreadMutator(thread);
- thread->set_vm_tag(VMTag::kVMTagId);
- ASSERT(thread->store_buffer_block_ == NULL);
- thread->StoreBufferAcquire();
+ if (thread != NULL) {
+ isolate->MakeCurrentThreadMutator(thread);
+ thread->set_vm_tag(VMTag::kVMTagId);
+ ASSERT(thread->store_buffer_block_ == NULL);
+ thread->StoreBufferAcquire();
+ return true;
+ }
+ return false;
}
@@ -210,16 +214,21 @@ void Thread::ExitIsolate() {
}
-void Thread::EnterIsolateAsHelper(Isolate* isolate, bool bypass_safepoint) {
+bool Thread::EnterIsolateAsHelper(Isolate* isolate, bool bypass_safepoint) {
const bool kIsNotMutatorThread = false;
ThreadRegistry* tr = isolate->thread_registry();
Thread* thread = tr->Schedule(isolate, kIsNotMutatorThread, bypass_safepoint);
- ASSERT(thread->store_buffer_block_ == NULL);
- // TODO(koda): Use StoreBufferAcquire once we properly flush before Scavenge.
- thread->store_buffer_block_ =
- thread->isolate()->store_buffer()->PopEmptyBlock();
- // This thread should not be the main mutator.
- ASSERT(!thread->IsMutatorThread());
+ if (thread != NULL) {
+ ASSERT(thread->store_buffer_block_ == NULL);
+ // TODO(koda): Use StoreBufferAcquire once we properly flush
+ // before Scavenge.
+ thread->store_buffer_block_ =
+ thread->isolate()->store_buffer()->PopEmptyBlock();
+ // This thread should not be the main mutator.
+ ASSERT(!thread->IsMutatorThread());
+ return true;
+ }
+ return false;
}
« no previous file with comments | « runtime/vm/thread.h ('k') | runtime/vm/thread_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698