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 "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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 746 ASSERT(this == Isolate::Current()); | 746 ASSERT(this == Isolate::Current()); |
| 747 ASSERT(top_resource() == NULL); | 747 ASSERT(top_resource() == NULL); |
| 748 ASSERT((heap_ == NULL) || heap_->Verify()); | 748 ASSERT((heap_ == NULL) || heap_->Verify()); |
| 749 | 749 |
| 750 // Create an area where we do have a zone and a handle scope so that we can | 750 // Create an area where we do have a zone and a handle scope so that we can |
| 751 // call VM functions while tearing this isolate down. | 751 // call VM functions while tearing this isolate down. |
| 752 { | 752 { |
| 753 StackZone stack_zone(this); | 753 StackZone stack_zone(this); |
| 754 HandleScope handle_scope(this); | 754 HandleScope handle_scope(this); |
| 755 | 755 |
| 756 // TODO(regis): Remove this debug/coverage code before submitting. | |
| 757 { | |
| 758 ObjectStore* store = object_store(); | |
| 759 if (store != NULL) { | |
| 760 const Array& table = Array::Handle(store->canonical_type_arguments()); | |
| 761 ASSERT(table.Length() > 0); | |
| 762 TypeArguments& type_args = TypeArguments::Handle(); | |
| 763 const intptr_t table_size = table.Length() - 1; | |
| 764 JSONStream js; | |
| 765 for (intptr_t i = 0; i < table_size; i++) { | |
| 766 type_args ^= table.At(i); | |
| 767 if (!type_args.IsNull()) { | |
| 768 type_args.PrintToJSONStream(&js, false); | |
| 769 } | |
| 770 } | |
| 771 } | |
| 772 } | |
| 773 | |
| 756 // Clean up debugger resources. | 774 // Clean up debugger resources. |
| 757 debugger()->Shutdown(); | 775 debugger()->Shutdown(); |
| 758 | 776 |
| 759 // Close all the ports owned by this isolate. | 777 // Close all the ports owned by this isolate. |
| 760 PortMap::ClosePorts(message_handler()); | 778 PortMap::ClosePorts(message_handler()); |
| 761 | 779 |
| 762 // Fail fast if anybody tries to post any more messsages to this isolate. | 780 // Fail fast if anybody tries to post any more messsages to this isolate. |
| 763 delete message_handler(); | 781 delete message_handler(); |
| 764 set_message_handler(NULL); | 782 set_message_handler(NULL); |
| 765 | 783 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 906 // TODO(turnidge): Implement depth differently -- differentiate | 924 // TODO(turnidge): Implement depth differently -- differentiate |
| 907 // inlined frames. | 925 // inlined frames. |
| 908 jsobj.AddProperty("depth", (intptr_t)0); | 926 jsobj.AddProperty("depth", (intptr_t)0); |
| 909 } | 927 } |
| 910 | 928 |
| 911 const Library& lib = | 929 const Library& lib = |
| 912 Library::Handle(object_store()->root_library()); | 930 Library::Handle(object_store()->root_library()); |
| 913 jsobj.AddProperty("rootLib", lib); | 931 jsobj.AddProperty("rootLib", lib); |
| 914 | 932 |
| 915 timer_list().PrintTimersToJSONProperty(&jsobj); | 933 timer_list().PrintTimersToJSONProperty(&jsobj); |
| 934 | |
| 935 jsobj.AddPropertyF("canonicalTypeArguments", "isolates/%" Pd "/typearguments", | |
|
Ivan Posva
2014/03/11 08:02:32
Is this ("isolates/%" Pd "/...", main_port()) real
Cutch
2014/03/11 13:50:01
It's not necessary (and a bug) to include the isol
regis
2014/03/14 23:52:07
Done.
| |
| 936 static_cast<intptr_t>(main_port())); | |
| 937 | |
| 938 jsobj.AddPropertyF("canonicalTypeArgumentsWithCachedInstantiations", | |
|
Cutch
2014/03/11 13:50:01
Same here.
regis
2014/03/14 23:52:07
Done.
| |
| 939 "isolates/%" Pd "/typeargumentswithinstantiations", | |
| 940 static_cast<intptr_t>(main_port())); | |
| 916 } | 941 } |
| 917 | 942 |
| 918 | 943 |
| 919 void Isolate::VisitIsolates(IsolateVisitor* visitor) { | 944 void Isolate::VisitIsolates(IsolateVisitor* visitor) { |
| 920 if (visitor == NULL) { | 945 if (visitor == NULL) { |
| 921 return; | 946 return; |
| 922 } | 947 } |
| 923 MonitorLocker ml(isolates_list_monitor_); | 948 MonitorLocker ml(isolates_list_monitor_); |
| 924 Isolate* current = isolates_list_head_; | 949 Isolate* current = isolates_list_head_; |
| 925 while (current) { | 950 while (current) { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1078 return func.raw(); | 1103 return func.raw(); |
| 1079 } | 1104 } |
| 1080 | 1105 |
| 1081 | 1106 |
| 1082 void IsolateSpawnState::Cleanup() { | 1107 void IsolateSpawnState::Cleanup() { |
| 1083 SwitchIsolateScope switch_scope(isolate()); | 1108 SwitchIsolateScope switch_scope(isolate()); |
| 1084 Dart::ShutdownIsolate(); | 1109 Dart::ShutdownIsolate(); |
| 1085 } | 1110 } |
| 1086 | 1111 |
| 1087 } // namespace dart | 1112 } // namespace dart |
| OLD | NEW |