Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/isolate.h" | 5 #include "vm/isolate.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/text_buffer.h" | 10 #include "platform/text_buffer.h" |
| (...skipping 2574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2585 bool is_mutator, | 2585 bool is_mutator, |
| 2586 bool bypass_safepoint) { | 2586 bool bypass_safepoint) { |
| 2587 // Disassociate the 'Thread' structure and unschedule the thread | 2587 // Disassociate the 'Thread' structure and unschedule the thread |
| 2588 // from this isolate. | 2588 // from this isolate. |
| 2589 // We are disassociating the thread from an isolate and it would | 2589 // We are disassociating the thread from an isolate and it would |
| 2590 // not be possible to correctly track no_safepoint_scope_depth for the | 2590 // not be possible to correctly track no_safepoint_scope_depth for the |
| 2591 // thread in the constructor/destructor of MonitorLocker, | 2591 // thread in the constructor/destructor of MonitorLocker, |
| 2592 // so we create a MonitorLocker object which does not do any | 2592 // so we create a MonitorLocker object which does not do any |
| 2593 // no_safepoint_scope_depth increments/decrements. | 2593 // no_safepoint_scope_depth increments/decrements. |
| 2594 MonitorLocker ml(threads_lock(), false); | 2594 MonitorLocker ml(threads_lock(), false); |
| 2595 thread->isolate()->object_store()->SetStickyErrorFromThread(thread); | |
|
siva
2016/03/08 08:54:59
If multiple threads exit at the same time won't th
srdjan
2016/03/08 20:21:09
Modified code to allow only mutator thread to prop
| |
| 2595 if (!bypass_safepoint) { | 2596 if (!bypass_safepoint) { |
| 2596 // Ensure that the thread reports itself as being at a safepoint. | 2597 // Ensure that the thread reports itself as being at a safepoint. |
| 2597 thread->EnterSafepoint(); | 2598 thread->EnterSafepoint(); |
| 2598 } | 2599 } |
| 2599 OSThread* os_thread = thread->os_thread(); | 2600 OSThread* os_thread = thread->os_thread(); |
| 2600 ASSERT(os_thread != NULL); | 2601 ASSERT(os_thread != NULL); |
| 2601 os_thread->DisableThreadInterrupts(); | 2602 os_thread->DisableThreadInterrupts(); |
| 2602 os_thread->set_thread(NULL); | 2603 os_thread->set_thread(NULL); |
| 2603 OSThread::SetCurrent(os_thread); | 2604 OSThread::SetCurrent(os_thread); |
| 2604 if (is_mutator) { | 2605 if (is_mutator) { |
| 2605 mutator_thread_ = NULL; | 2606 mutator_thread_ = NULL; |
| 2606 } | 2607 } |
| 2607 thread->isolate_ = NULL; | 2608 thread->isolate_ = NULL; |
| 2608 thread->heap_ = NULL; | 2609 thread->heap_ = NULL; |
| 2609 thread->set_os_thread(NULL); | 2610 thread->set_os_thread(NULL); |
| 2610 thread->set_execution_state(Thread::kThreadInVM); | 2611 thread->set_execution_state(Thread::kThreadInVM); |
| 2611 thread->set_safepoint_state(0); | 2612 thread->set_safepoint_state(0); |
| 2612 thread->clear_pending_functions(); | 2613 thread->clear_pending_functions(); |
| 2614 thread->clear_sticky_error(); | |
| 2613 ASSERT(thread->no_safepoint_scope_depth() == 0); | 2615 ASSERT(thread->no_safepoint_scope_depth() == 0); |
| 2614 // Return thread structure. | 2616 // Return thread structure. |
| 2615 thread_registry()->ReturnThreadLocked(is_mutator, thread); | 2617 thread_registry()->ReturnThreadLocked(is_mutator, thread); |
| 2616 } | 2618 } |
| 2617 | 2619 |
| 2618 | 2620 |
| 2619 static RawInstance* DeserializeObject(Thread* thread, | 2621 static RawInstance* DeserializeObject(Thread* thread, |
| 2620 uint8_t* obj_data, | 2622 uint8_t* obj_data, |
| 2621 intptr_t obj_len) { | 2623 intptr_t obj_len) { |
| 2622 if (obj_data == NULL) { | 2624 if (obj_data == NULL) { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2839 void IsolateSpawnState::DecrementSpawnCount() { | 2841 void IsolateSpawnState::DecrementSpawnCount() { |
| 2840 ASSERT(spawn_count_monitor_ != NULL); | 2842 ASSERT(spawn_count_monitor_ != NULL); |
| 2841 ASSERT(spawn_count_ != NULL); | 2843 ASSERT(spawn_count_ != NULL); |
| 2842 MonitorLocker ml(spawn_count_monitor_); | 2844 MonitorLocker ml(spawn_count_monitor_); |
| 2843 ASSERT(*spawn_count_ > 0); | 2845 ASSERT(*spawn_count_ > 0); |
| 2844 *spawn_count_ = *spawn_count_ - 1; | 2846 *spawn_count_ = *spawn_count_ - 1; |
| 2845 ml.Notify(); | 2847 ml.Notify(); |
| 2846 } | 2848 } |
| 2847 | 2849 |
| 2848 } // namespace dart | 2850 } // namespace dart |
| OLD | NEW |