| Index: runtime/vm/isolate.h
|
| ===================================================================
|
| --- runtime/vm/isolate.h (revision 44762)
|
| +++ runtime/vm/isolate.h (working copy)
|
| @@ -122,7 +122,6 @@
|
| Thread* thread = Thread::Current();
|
| return thread == NULL ? NULL : thread->isolate();
|
| }
|
| - static void SetCurrent(Isolate* isolate);
|
|
|
| static void InitOnce();
|
| static Isolate* Init(const char* name_prefix, bool is_vm_isolate = false);
|
| @@ -170,7 +169,7 @@
|
| // No other threads operating on this isolate may execute Dart code.
|
| // TODO(koda): Remove after caching current thread in generated code.
|
| Thread* mutator_thread() {
|
| - DEBUG_ASSERT(IsIsolateOf(mutator_thread_));
|
| + DEBUG_ASSERT(mutator_thread_ == NULL || IsIsolateOf(mutator_thread_));
|
| return mutator_thread_;
|
| }
|
| #if defined(DEBUG)
|
| @@ -683,6 +682,10 @@
|
| user_tag_ = tag;
|
| }
|
|
|
| + void set_mutator_thread(Thread* thread) {
|
| + mutator_thread_ = thread;
|
| + }
|
| +
|
| template<class T> T* AllocateReusableHandle();
|
|
|
| Thread* mutator_thread_;
|
| @@ -825,6 +828,7 @@
|
| public:
|
| explicit StartIsolateScope(Isolate* new_isolate)
|
| : new_isolate_(new_isolate), saved_isolate_(Isolate::Current()) {
|
| + // TODO(koda): Audit users; passing NULL goes against naming of this class.
|
| if (new_isolate_ == NULL) {
|
| // Do nothing.
|
| return;
|
| @@ -831,7 +835,7 @@
|
| }
|
| if (saved_isolate_ != new_isolate_) {
|
| ASSERT(Isolate::Current() == NULL);
|
| - Isolate::SetCurrent(new_isolate_);
|
| + Thread::EnterIsolate(new_isolate_);
|
| new_isolate_->SetStackLimitFromStackBase(
|
| Isolate::GetCurrentStackPointer());
|
| }
|
| @@ -844,7 +848,10 @@
|
| }
|
| if (saved_isolate_ != new_isolate_) {
|
| new_isolate_->ClearStackLimit();
|
| - Isolate::SetCurrent(saved_isolate_);
|
| + Thread::ExitIsolate();
|
| + if (saved_isolate_ != NULL) {
|
| + Thread::EnterIsolate(saved_isolate_);
|
| + }
|
| }
|
| }
|
|
|
| @@ -865,9 +872,12 @@
|
| saved_isolate_(Isolate::Current()),
|
| saved_stack_limit_(saved_isolate_
|
| ? saved_isolate_->saved_stack_limit() : 0) {
|
| + // TODO(koda): Audit users; why would these two ever be equal?
|
| if (saved_isolate_ != new_isolate_) {
|
| - Isolate::SetCurrent(new_isolate_);
|
| - if (new_isolate_ != NULL) {
|
| + if (new_isolate_ == NULL) {
|
| + Thread::ExitIsolate();
|
| + } else {
|
| + Thread::EnterIsolate(new_isolate_);
|
| // Don't allow dart code to execute.
|
| new_isolate_->SetStackLimit(~static_cast<uword>(0));
|
| }
|
| @@ -876,8 +886,11 @@
|
|
|
| ~SwitchIsolateScope() {
|
| if (saved_isolate_ != new_isolate_) {
|
| - Isolate::SetCurrent(saved_isolate_);
|
| + if (new_isolate_ != NULL) {
|
| + Thread::ExitIsolate();
|
| + }
|
| if (saved_isolate_ != NULL) {
|
| + Thread::EnterIsolate(saved_isolate_);
|
| saved_isolate_->SetStackLimit(saved_stack_limit_);
|
| }
|
| }
|
|
|