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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 edge_counter_increment_size_(-1), | 662 edge_counter_increment_size_(-1), |
663 compiler_stats_(NULL), | 663 compiler_stats_(NULL), |
664 is_service_isolate_(false), | 664 is_service_isolate_(false), |
665 log_(new class Log()), | 665 log_(new class Log()), |
666 stacktrace_(NULL), | 666 stacktrace_(NULL), |
667 stack_frame_index_(-1), | 667 stack_frame_index_(-1), |
668 last_allocationprofile_accumulator_reset_timestamp_(0), | 668 last_allocationprofile_accumulator_reset_timestamp_(0), |
669 last_allocationprofile_gc_timestamp_(0), | 669 last_allocationprofile_gc_timestamp_(0), |
670 object_id_ring_(NULL), | 670 object_id_ring_(NULL), |
671 trace_buffer_(NULL), | 671 trace_buffer_(NULL), |
672 timeline_event_buffer_(NULL), | 672 timeline_event_recorder_(NULL), |
673 profiler_data_(NULL), | 673 profiler_data_(NULL), |
674 thread_state_(NULL), | 674 thread_state_(NULL), |
675 tag_table_(GrowableObjectArray::null()), | 675 tag_table_(GrowableObjectArray::null()), |
676 current_tag_(UserTag::null()), | 676 current_tag_(UserTag::null()), |
677 default_tag_(UserTag::null()), | 677 default_tag_(UserTag::null()), |
678 deoptimized_code_array_(GrowableObjectArray::null()), | 678 deoptimized_code_array_(GrowableObjectArray::null()), |
679 metrics_list_head_(NULL), | 679 metrics_list_head_(NULL), |
680 cha_(NULL), | 680 cha_(NULL), |
681 next_(NULL), | 681 next_(NULL), |
682 pause_loop_monitor_(NULL), | 682 pause_loop_monitor_(NULL), |
(...skipping 28 matching lines...) Expand all Loading... |
711 delete log_; | 711 delete log_; |
712 log_ = NULL; | 712 log_ = NULL; |
713 delete object_id_ring_; | 713 delete object_id_ring_; |
714 object_id_ring_ = NULL; | 714 object_id_ring_ = NULL; |
715 delete pause_loop_monitor_; | 715 delete pause_loop_monitor_; |
716 pause_loop_monitor_ = NULL; | 716 pause_loop_monitor_ = NULL; |
717 if (compiler_stats_ != NULL) { | 717 if (compiler_stats_ != NULL) { |
718 delete compiler_stats_; | 718 delete compiler_stats_; |
719 compiler_stats_ = NULL; | 719 compiler_stats_ = NULL; |
720 } | 720 } |
721 RemoveTimelineEventBuffer(); | 721 RemoveTimelineEventRecorder(); |
722 } | 722 } |
723 | 723 |
724 | 724 |
725 #if defined(DEBUG) | 725 #if defined(DEBUG) |
726 bool Isolate::IsIsolateOf(Thread* thread) { | 726 bool Isolate::IsIsolateOf(Thread* thread) { |
727 return this == thread->isolate(); | 727 return this == thread->isolate(); |
728 } | 728 } |
729 #endif // DEBUG | 729 #endif // DEBUG |
730 | 730 |
731 | 731 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 message_handler()->set_pause_on_start(FLAG_pause_isolates_on_start); | 976 message_handler()->set_pause_on_start(FLAG_pause_isolates_on_start); |
977 message_handler()->set_pause_on_exit(FLAG_pause_isolates_on_exit); | 977 message_handler()->set_pause_on_exit(FLAG_pause_isolates_on_exit); |
978 } | 978 } |
979 IsolateSpawnState* state = spawn_state(); | 979 IsolateSpawnState* state = spawn_state(); |
980 if (state != NULL) { | 980 if (state != NULL) { |
981 ASSERT(this == state->isolate()); | 981 ASSERT(this == state->isolate()); |
982 Run(); | 982 Run(); |
983 } | 983 } |
984 TimelineStream* stream = GetIsolateStream(); | 984 TimelineStream* stream = GetIsolateStream(); |
985 ASSERT(stream != NULL); | 985 ASSERT(stream != NULL); |
986 TimelineEvent* event = stream->RecordEvent(); | 986 TimelineEvent* event = stream->StartEvent(); |
987 if (event != NULL) { | 987 if (event != NULL) { |
988 event->Instant(stream, "Runnable"); | 988 event->Instant("Runnable"); |
| 989 event->Complete(); |
989 } | 990 } |
990 return true; | 991 return true; |
991 } | 992 } |
992 | 993 |
993 | 994 |
994 bool Isolate::VerifyPauseCapability(const Object& capability) const { | 995 bool Isolate::VerifyPauseCapability(const Object& capability) const { |
995 return !capability.IsNull() && | 996 return !capability.IsNull() && |
996 capability.IsCapability() && | 997 capability.IsCapability() && |
997 (pause_capability() == Capability::Cast(capability).Id()); | 998 (pause_capability() == Capability::Cast(capability).Id()); |
998 } | 999 } |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1470 api_state()->prologue_weak_persistent_handles().VisitHandles(&visitor); | 1471 api_state()->prologue_weak_persistent_handles().VisitHandles(&visitor); |
1471 | 1472 |
1472 if (FLAG_trace_isolates) { | 1473 if (FLAG_trace_isolates) { |
1473 heap()->PrintSizes(); | 1474 heap()->PrintSizes(); |
1474 megamorphic_cache_table()->PrintSizes(); | 1475 megamorphic_cache_table()->PrintSizes(); |
1475 Symbols::DumpStats(); | 1476 Symbols::DumpStats(); |
1476 OS::Print("[-] Stopping isolate:\n" | 1477 OS::Print("[-] Stopping isolate:\n" |
1477 "\tisolate: %s\n", name()); | 1478 "\tisolate: %s\n", name()); |
1478 } | 1479 } |
1479 | 1480 |
1480 if ((timeline_event_buffer_ != NULL) && (FLAG_timeline_trace_dir != NULL)) { | 1481 if ((timeline_event_recorder_ != NULL) && |
1481 timeline_event_buffer_->WriteTo(FLAG_timeline_trace_dir); | 1482 (FLAG_timeline_trace_dir != NULL)) { |
| 1483 timeline_event_recorder_->WriteTo(FLAG_timeline_trace_dir); |
1482 } | 1484 } |
1483 } | 1485 } |
1484 | 1486 |
1485 // TODO(5411455): For now just make sure there are no current isolates | 1487 // TODO(5411455): For now just make sure there are no current isolates |
1486 // as we are shutting down the isolate. | 1488 // as we are shutting down the isolate. |
1487 Thread::ExitIsolate(); | 1489 Thread::ExitIsolate(); |
1488 Profiler::ShutdownProfilingForIsolate(this); | 1490 Profiler::ShutdownProfilingForIsolate(this); |
1489 } | 1491 } |
1490 | 1492 |
1491 | 1493 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 } | 1573 } |
1572 | 1574 |
1573 | 1575 |
1574 void Isolate::VisitPrologueWeakPersistentHandles(HandleVisitor* visitor) { | 1576 void Isolate::VisitPrologueWeakPersistentHandles(HandleVisitor* visitor) { |
1575 if (api_state() != NULL) { | 1577 if (api_state() != NULL) { |
1576 api_state()->VisitPrologueWeakHandles(visitor); | 1578 api_state()->VisitPrologueWeakHandles(visitor); |
1577 } | 1579 } |
1578 } | 1580 } |
1579 | 1581 |
1580 | 1582 |
1581 void Isolate::SetTimelineEventBuffer( | 1583 void Isolate::SetTimelineEventRecorder( |
1582 TimelineEventBuffer* timeline_event_buffer) { | 1584 TimelineEventRecorder* timeline_event_recorder) { |
1583 #define ISOLATE_TIMELINE_STREAM_SET_BUFFER(name, enabled_by_default) \ | 1585 #define ISOLATE_TIMELINE_STREAM_SET_BUFFER(name, enabled_by_default) \ |
1584 stream_##name##_.set_buffer(timeline_event_buffer); | 1586 stream_##name##_.set_recorder(timeline_event_recorder); |
1585 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_SET_BUFFER) | 1587 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_SET_BUFFER) |
1586 #undef ISOLATE_TIMELINE_STREAM_SET_BUFFER | 1588 #undef ISOLATE_TIMELINE_STREAM_SET_BUFFER |
1587 timeline_event_buffer_ = timeline_event_buffer; | 1589 timeline_event_recorder_ = timeline_event_recorder; |
1588 } | 1590 } |
1589 | 1591 |
1590 void Isolate::RemoveTimelineEventBuffer() { | 1592 void Isolate::RemoveTimelineEventRecorder() { |
1591 SetTimelineEventBuffer(NULL); | 1593 SetTimelineEventRecorder(NULL); |
1592 delete timeline_event_buffer_; | 1594 delete timeline_event_recorder_; |
1593 } | 1595 } |
1594 | 1596 |
1595 | 1597 |
1596 void Isolate::PrintJSON(JSONStream* stream, bool ref) { | 1598 void Isolate::PrintJSON(JSONStream* stream, bool ref) { |
1597 JSONObject jsobj(stream); | 1599 JSONObject jsobj(stream); |
1598 jsobj.AddProperty("type", (ref ? "@Isolate" : "Isolate")); | 1600 jsobj.AddProperty("type", (ref ? "@Isolate" : "Isolate")); |
1599 jsobj.AddFixedServiceId("isolates/%" Pd "", | 1601 jsobj.AddFixedServiceId("isolates/%" Pd "", |
1600 static_cast<intptr_t>(main_port())); | 1602 static_cast<intptr_t>(main_port())); |
1601 | 1603 |
1602 jsobj.AddProperty("name", debugger_name()); | 1604 jsobj.AddProperty("name", debugger_name()); |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2074 serialized_message_, serialized_message_len_); | 2076 serialized_message_, serialized_message_len_); |
2075 } | 2077 } |
2076 | 2078 |
2077 | 2079 |
2078 void IsolateSpawnState::Cleanup() { | 2080 void IsolateSpawnState::Cleanup() { |
2079 SwitchIsolateScope switch_scope(I); | 2081 SwitchIsolateScope switch_scope(I); |
2080 Dart::ShutdownIsolate(); | 2082 Dart::ShutdownIsolate(); |
2081 } | 2083 } |
2082 | 2084 |
2083 } // namespace dart | 2085 } // namespace dart |
OLD | NEW |