| 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 "vm/code_observers.h" | 10 #include "vm/code_observers.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "vm/service_isolate.h" | 31 #include "vm/service_isolate.h" |
| 32 #include "vm/simulator.h" | 32 #include "vm/simulator.h" |
| 33 #include "vm/stack_frame.h" | 33 #include "vm/stack_frame.h" |
| 34 #include "vm/store_buffer.h" | 34 #include "vm/store_buffer.h" |
| 35 #include "vm/stub_code.h" | 35 #include "vm/stub_code.h" |
| 36 #include "vm/symbols.h" | 36 #include "vm/symbols.h" |
| 37 #include "vm/tags.h" | 37 #include "vm/tags.h" |
| 38 #include "vm/thread_interrupter.h" | 38 #include "vm/thread_interrupter.h" |
| 39 #include "vm/thread_registry.h" | 39 #include "vm/thread_registry.h" |
| 40 #include "vm/timeline.h" | 40 #include "vm/timeline.h" |
| 41 #include "vm/timeline_analysis.h" |
| 41 #include "vm/timer.h" | 42 #include "vm/timer.h" |
| 42 #include "vm/visitor.h" | 43 #include "vm/visitor.h" |
| 43 | 44 |
| 44 | 45 |
| 45 namespace dart { | 46 namespace dart { |
| 46 | 47 |
| 47 DECLARE_FLAG(bool, print_metrics); | 48 DECLARE_FLAG(bool, print_metrics); |
| 49 DECLARE_FLAG(bool, timing); |
| 48 DECLARE_FLAG(bool, trace_service); | 50 DECLARE_FLAG(bool, trace_service); |
| 49 | 51 |
| 50 DEFINE_FLAG(bool, trace_isolates, false, | 52 DEFINE_FLAG(bool, trace_isolates, false, |
| 51 "Trace isolate creation and shut down."); | 53 "Trace isolate creation and shut down."); |
| 52 DEFINE_FLAG(bool, pause_isolates_on_start, false, | 54 DEFINE_FLAG(bool, pause_isolates_on_start, false, |
| 53 "Pause isolates before starting."); | 55 "Pause isolates before starting."); |
| 54 DEFINE_FLAG(bool, pause_isolates_on_exit, false, | 56 DEFINE_FLAG(bool, pause_isolates_on_exit, false, |
| 55 "Pause isolates exiting."); | 57 "Pause isolates exiting."); |
| 56 DEFINE_FLAG(bool, break_at_isolate_spawn, false, | 58 DEFINE_FLAG(bool, break_at_isolate_spawn, false, |
| 57 "Insert a one-time breakpoint at the entrypoint for all spawned " | 59 "Insert a one-time breakpoint at the entrypoint for all spawned " |
| (...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1522 // Close all the ports owned by this isolate. | 1524 // Close all the ports owned by this isolate. |
| 1523 PortMap::ClosePorts(message_handler()); | 1525 PortMap::ClosePorts(message_handler()); |
| 1524 | 1526 |
| 1525 // Fail fast if anybody tries to post any more messsages to this isolate. | 1527 // Fail fast if anybody tries to post any more messsages to this isolate. |
| 1526 delete message_handler(); | 1528 delete message_handler(); |
| 1527 set_message_handler(NULL); | 1529 set_message_handler(NULL); |
| 1528 | 1530 |
| 1529 // Dump all accumulated timer data for the isolate. | 1531 // Dump all accumulated timer data for the isolate. |
| 1530 timer_list_.ReportTimers(); | 1532 timer_list_.ReportTimers(); |
| 1531 | 1533 |
| 1534 // Before analyzing the isolate's timeline blocks- close all of them. |
| 1535 CloseAllTimelineBlocks(); |
| 1536 |
| 1537 // Dump all timing data for the isolate. |
| 1538 if (FLAG_timing) { |
| 1539 TimelinePauseTrace tpt; |
| 1540 tpt.Print(); |
| 1541 } |
| 1542 |
| 1532 // Finalize any weak persistent handles with a non-null referent. | 1543 // Finalize any weak persistent handles with a non-null referent. |
| 1533 FinalizeWeakPersistentHandlesVisitor visitor; | 1544 FinalizeWeakPersistentHandlesVisitor visitor; |
| 1534 api_state()->weak_persistent_handles().VisitHandles(&visitor); | 1545 api_state()->weak_persistent_handles().VisitHandles(&visitor); |
| 1535 api_state()->prologue_weak_persistent_handles().VisitHandles(&visitor); | 1546 api_state()->prologue_weak_persistent_handles().VisitHandles(&visitor); |
| 1536 | 1547 |
| 1537 if (FLAG_trace_isolates) { | 1548 if (FLAG_trace_isolates) { |
| 1538 heap()->PrintSizes(); | 1549 heap()->PrintSizes(); |
| 1539 megamorphic_cache_table()->PrintSizes(); | 1550 megamorphic_cache_table()->PrintSizes(); |
| 1540 Symbols::DumpStats(); | 1551 Symbols::DumpStats(); |
| 1541 OS::Print("[-] Stopping isolate:\n" | 1552 OS::Print("[-] Stopping isolate:\n" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1563 | 1574 |
| 1564 // TODO(5411455): For now just make sure there are no current isolates | 1575 // TODO(5411455): For now just make sure there are no current isolates |
| 1565 // as we are shutting down the isolate. | 1576 // as we are shutting down the isolate. |
| 1566 Thread::ExitIsolate(); | 1577 Thread::ExitIsolate(); |
| 1567 // All threads should have exited by now. | 1578 // All threads should have exited by now. |
| 1568 thread_registry()->CheckNotScheduled(this); | 1579 thread_registry()->CheckNotScheduled(this); |
| 1569 Profiler::ShutdownProfilingForIsolate(this); | 1580 Profiler::ShutdownProfilingForIsolate(this); |
| 1570 } | 1581 } |
| 1571 | 1582 |
| 1572 | 1583 |
| 1584 void Isolate::CloseAllTimelineBlocks() { |
| 1585 // Close all blocks |
| 1586 thread_registry_->CloseAllTimelineBlocks(); |
| 1587 TimelineEventRecorder* recorder = Timeline::recorder(); |
| 1588 if (recorder != NULL) { |
| 1589 MutexLocker ml(&recorder->lock_); |
| 1590 Thread::Current()->CloseTimelineBlock(); |
| 1591 } |
| 1592 } |
| 1593 |
| 1594 |
| 1573 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; | 1595 Dart_IsolateCreateCallback Isolate::create_callback_ = NULL; |
| 1574 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; | 1596 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; |
| 1575 Dart_IsolateUnhandledExceptionCallback | 1597 Dart_IsolateUnhandledExceptionCallback |
| 1576 Isolate::unhandled_exception_callback_ = NULL; | 1598 Isolate::unhandled_exception_callback_ = NULL; |
| 1577 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; | 1599 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; |
| 1578 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; | 1600 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; |
| 1579 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; | 1601 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; |
| 1580 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL; | 1602 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL; |
| 1581 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL; | 1603 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL; |
| 1582 Dart_EntropySource Isolate::entropy_source_callback_ = NULL; | 1604 Dart_EntropySource Isolate::entropy_source_callback_ = NULL; |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2330 serialized_message_, serialized_message_len_); | 2352 serialized_message_, serialized_message_len_); |
| 2331 } | 2353 } |
| 2332 | 2354 |
| 2333 | 2355 |
| 2334 void IsolateSpawnState::Cleanup() { | 2356 void IsolateSpawnState::Cleanup() { |
| 2335 SwitchIsolateScope switch_scope(I); | 2357 SwitchIsolateScope switch_scope(I); |
| 2336 Dart::ShutdownIsolate(); | 2358 Dart::ShutdownIsolate(); |
| 2337 } | 2359 } |
| 2338 | 2360 |
| 2339 } // namespace dart | 2361 } // namespace dart |
| OLD | NEW |