OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "lib/mirrors.h" | 9 #include "lib/mirrors.h" |
| 10 #include "vm/code_observers.h" |
10 #include "vm/compiler_stats.h" | 11 #include "vm/compiler_stats.h" |
11 #include "vm/dart_api_state.h" | 12 #include "vm/dart_api_state.h" |
12 #include "vm/dart_entry.h" | 13 #include "vm/dart_entry.h" |
13 #include "vm/debugger.h" | 14 #include "vm/debugger.h" |
14 #include "vm/debuginfo.h" | |
15 #include "vm/heap.h" | 15 #include "vm/heap.h" |
16 #include "vm/message_handler.h" | 16 #include "vm/message_handler.h" |
17 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
18 #include "vm/parser.h" | 18 #include "vm/parser.h" |
19 #include "vm/port.h" | 19 #include "vm/port.h" |
20 #include "vm/stack_frame.h" | 20 #include "vm/stack_frame.h" |
21 #include "vm/stub_code.h" | 21 #include "vm/stub_code.h" |
22 #include "vm/symbols.h" | 22 #include "vm/symbols.h" |
23 #include "vm/thread.h" | 23 #include "vm/thread.h" |
24 #include "vm/timer.h" | 24 #include "vm/timer.h" |
25 #include "vm/visitor.h" | 25 #include "vm/visitor.h" |
26 | 26 |
27 namespace dart { | 27 namespace dart { |
28 | 28 |
29 DEFINE_FLAG(bool, report_usage_count, false, | 29 DEFINE_FLAG(bool, report_usage_count, false, |
30 "Track function usage and report."); | 30 "Track function usage and report."); |
31 DEFINE_FLAG(bool, trace_isolates, false, | 31 DEFINE_FLAG(bool, trace_isolates, false, |
32 "Trace isolate creation and shut down."); | 32 "Trace isolate creation and shut down."); |
33 DECLARE_FLAG(bool, generate_gdb_symbols); | |
34 | 33 |
35 | 34 |
36 class IsolateMessageHandler : public MessageHandler { | 35 class IsolateMessageHandler : public MessageHandler { |
37 public: | 36 public: |
38 explicit IsolateMessageHandler(Isolate* isolate); | 37 explicit IsolateMessageHandler(Isolate* isolate); |
39 ~IsolateMessageHandler(); | 38 ~IsolateMessageHandler(); |
40 | 39 |
41 const char* name() const; | 40 const char* name() const; |
42 void MessageNotify(Message::Priority priority); | 41 void MessageNotify(Message::Priority priority); |
43 bool HandleMessage(Message* message); | 42 bool HandleMessage(Message* message); |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 // Finalize any weak persistent handles with a non-null referent. | 535 // Finalize any weak persistent handles with a non-null referent. |
537 FinalizeWeakPersistentHandlesVisitor visitor; | 536 FinalizeWeakPersistentHandlesVisitor visitor; |
538 api_state()->weak_persistent_handles().VisitHandles(&visitor); | 537 api_state()->weak_persistent_handles().VisitHandles(&visitor); |
539 | 538 |
540 // Dump all accumalated timer data for the isolate. | 539 // Dump all accumalated timer data for the isolate. |
541 timer_list_.ReportTimers(); | 540 timer_list_.ReportTimers(); |
542 if (FLAG_report_usage_count) { | 541 if (FLAG_report_usage_count) { |
543 PrintInvokedFunctions(); | 542 PrintInvokedFunctions(); |
544 } | 543 } |
545 CompilerStats::Print(); | 544 CompilerStats::Print(); |
546 if (FLAG_generate_gdb_symbols) { | 545 // TODO(asiva): Move this code to Dart::Cleanup when we have that method |
547 DebugInfo::UnregisterAllSections(); | 546 // as the cleanup for Dart::InitOnce. |
548 } | 547 CodeObservers::DeleteAll(); |
549 if (FLAG_trace_isolates) { | 548 if (FLAG_trace_isolates) { |
550 StackZone zone(this); | 549 StackZone zone(this); |
551 HandleScope handle_scope(this); | 550 HandleScope handle_scope(this); |
552 heap()->PrintSizes(); | 551 heap()->PrintSizes(); |
553 megamorphic_cache_table()->PrintSizes(); | 552 megamorphic_cache_table()->PrintSizes(); |
554 Symbols::DumpStats(); | 553 Symbols::DumpStats(); |
555 OS::Print("[-] Stopping isolate:\n" | 554 OS::Print("[-] Stopping isolate:\n" |
556 "\tisolate: %s\n", name()); | 555 "\tisolate: %s\n", name()); |
557 } | 556 } |
558 // TODO(5411455): For now just make sure there are no current isolates | 557 // TODO(5411455): For now just make sure there are no current isolates |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 | 615 |
617 | 616 |
618 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, | 617 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, |
619 bool visit_prologue_weak_handles) { | 618 bool visit_prologue_weak_handles) { |
620 if (api_state() != NULL) { | 619 if (api_state() != NULL) { |
621 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); | 620 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); |
622 } | 621 } |
623 } | 622 } |
624 | 623 |
625 } // namespace dart | 624 } // namespace dart |
OLD | NEW |