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 "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "platform/json.h" | 9 #include "platform/json.h" |
10 #include "lib/mirrors.h" | 10 #include "lib/mirrors.h" |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 private: | 760 private: |
761 DISALLOW_COPY_AND_ASSIGN(FinalizeWeakPersistentHandlesVisitor); | 761 DISALLOW_COPY_AND_ASSIGN(FinalizeWeakPersistentHandlesVisitor); |
762 }; | 762 }; |
763 | 763 |
764 | 764 |
765 void Isolate::Shutdown() { | 765 void Isolate::Shutdown() { |
766 ASSERT(this == Isolate::Current()); | 766 ASSERT(this == Isolate::Current()); |
767 ASSERT(top_resource() == NULL); | 767 ASSERT(top_resource() == NULL); |
768 ASSERT((heap_ == NULL) || heap_->Verify()); | 768 ASSERT((heap_ == NULL) || heap_->Verify()); |
769 | 769 |
| 770 // Remove this isolate from the list *before* we start tearing it down, to |
| 771 // avoid exposing it in a state of decay. |
| 772 RemoveIsolateFromList(this); |
| 773 |
770 // Create an area where we do have a zone and a handle scope so that we can | 774 // Create an area where we do have a zone and a handle scope so that we can |
771 // call VM functions while tearing this isolate down. | 775 // call VM functions while tearing this isolate down. |
772 { | 776 { |
773 StackZone stack_zone(this); | 777 StackZone stack_zone(this); |
774 HandleScope handle_scope(this); | 778 HandleScope handle_scope(this); |
775 | 779 |
776 // Clean up debugger resources. | 780 // Clean up debugger resources. |
777 debugger()->Shutdown(); | 781 debugger()->Shutdown(); |
778 | 782 |
779 // Close all the ports owned by this isolate. | 783 // Close all the ports owned by this isolate. |
(...skipping 23 matching lines...) Expand all Loading... |
803 megamorphic_cache_table()->PrintSizes(); | 807 megamorphic_cache_table()->PrintSizes(); |
804 Symbols::DumpStats(); | 808 Symbols::DumpStats(); |
805 OS::Print("[-] Stopping isolate:\n" | 809 OS::Print("[-] Stopping isolate:\n" |
806 "\tisolate: %s\n", name()); | 810 "\tisolate: %s\n", name()); |
807 } | 811 } |
808 } | 812 } |
809 | 813 |
810 // TODO(5411455): For now just make sure there are no current isolates | 814 // TODO(5411455): For now just make sure there are no current isolates |
811 // as we are shutting down the isolate. | 815 // as we are shutting down the isolate. |
812 SetCurrent(NULL); | 816 SetCurrent(NULL); |
813 RemoveIsolateFromList(this); | |
814 Profiler::ShutdownProfilingForIsolate(this); | 817 Profiler::ShutdownProfilingForIsolate(this); |
815 } | 818 } |
816 | 819 |
817 | 820 |
818 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; | 821 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; |
819 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; | 822 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; |
820 Dart_IsolateUnhandledExceptionCallback | 823 Dart_IsolateUnhandledExceptionCallback |
821 Isolate::unhandled_exception_callback_ = NULL; | 824 Isolate::unhandled_exception_callback_ = NULL; |
822 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; | 825 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; |
823 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; | 826 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 return func.raw(); | 1240 return func.raw(); |
1238 } | 1241 } |
1239 | 1242 |
1240 | 1243 |
1241 void IsolateSpawnState::Cleanup() { | 1244 void IsolateSpawnState::Cleanup() { |
1242 SwitchIsolateScope switch_scope(isolate()); | 1245 SwitchIsolateScope switch_scope(isolate()); |
1243 Dart::ShutdownIsolate(); | 1246 Dart::ShutdownIsolate(); |
1244 } | 1247 } |
1245 | 1248 |
1246 } // namespace dart | 1249 } // namespace dart |
OLD | NEW |