| 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 27 matching lines...) Expand all Loading... |
| 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/timer.h" | 41 #include "vm/timer.h" |
| 42 #include "vm/visitor.h" | 42 #include "vm/visitor.h" |
| 43 | 43 |
| 44 | 44 |
| 45 namespace dart { | 45 namespace dart { |
| 46 | 46 |
| 47 DECLARE_FLAG(bool, print_metrics); | 47 DECLARE_FLAG(bool, print_metrics); |
| 48 DECLARE_FLAG(bool, trace_service); |
| 48 | 49 |
| 49 DEFINE_FLAG(bool, trace_isolates, false, | 50 DEFINE_FLAG(bool, trace_isolates, false, |
| 50 "Trace isolate creation and shut down."); | 51 "Trace isolate creation and shut down."); |
| 51 DEFINE_FLAG(bool, pause_isolates_on_start, false, | 52 DEFINE_FLAG(bool, pause_isolates_on_start, false, |
| 52 "Pause isolates before starting."); | 53 "Pause isolates before starting."); |
| 53 DEFINE_FLAG(bool, pause_isolates_on_exit, false, | 54 DEFINE_FLAG(bool, pause_isolates_on_exit, false, |
| 54 "Pause isolates exiting."); | 55 "Pause isolates exiting."); |
| 55 DEFINE_FLAG(bool, break_at_isolate_spawn, false, | 56 DEFINE_FLAG(bool, break_at_isolate_spawn, false, |
| 56 "Insert a one-time breakpoint at the entrypoint for all spawned " | 57 "Insert a one-time breakpoint at the entrypoint for all spawned " |
| 57 "isolates"); | 58 "isolates"); |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 } | 497 } |
| 497 | 498 |
| 498 | 499 |
| 499 void IsolateMessageHandler::NotifyPauseOnStart() { | 500 void IsolateMessageHandler::NotifyPauseOnStart() { |
| 500 if (Service::debug_stream.enabled()) { | 501 if (Service::debug_stream.enabled()) { |
| 501 StartIsolateScope start_isolate(isolate()); | 502 StartIsolateScope start_isolate(isolate()); |
| 502 StackZone zone(I); | 503 StackZone zone(I); |
| 503 HandleScope handle_scope(I); | 504 HandleScope handle_scope(I); |
| 504 ServiceEvent pause_event(isolate(), ServiceEvent::kPauseStart); | 505 ServiceEvent pause_event(isolate(), ServiceEvent::kPauseStart); |
| 505 Service::HandleEvent(&pause_event); | 506 Service::HandleEvent(&pause_event); |
| 507 } else if (FLAG_trace_service) { |
| 508 OS::Print("vm-service: Dropping event of type PauseStart (%s)\n", |
| 509 isolate()->name()); |
| 506 } | 510 } |
| 507 } | 511 } |
| 508 | 512 |
| 509 | 513 |
| 510 void IsolateMessageHandler::NotifyPauseOnExit() { | 514 void IsolateMessageHandler::NotifyPauseOnExit() { |
| 511 if (Service::debug_stream.enabled()) { | 515 if (Service::debug_stream.enabled()) { |
| 512 StartIsolateScope start_isolate(isolate()); | 516 StartIsolateScope start_isolate(isolate()); |
| 513 StackZone zone(I); | 517 StackZone zone(I); |
| 514 HandleScope handle_scope(I); | 518 HandleScope handle_scope(I); |
| 515 ServiceEvent pause_event(isolate(), ServiceEvent::kPauseExit); | 519 ServiceEvent pause_event(isolate(), ServiceEvent::kPauseExit); |
| 516 Service::HandleEvent(&pause_event); | 520 Service::HandleEvent(&pause_event); |
| 521 } else if (FLAG_trace_service) { |
| 522 OS::Print("vm-service: Dropping event of type PauseExit (%s)\n", |
| 523 isolate()->name()); |
| 517 } | 524 } |
| 518 } | 525 } |
| 519 | 526 |
| 520 | 527 |
| 521 #if defined(DEBUG) | 528 #if defined(DEBUG) |
| 522 void IsolateMessageHandler::CheckAccess() { | 529 void IsolateMessageHandler::CheckAccess() { |
| 523 ASSERT(IsCurrentIsolate()); | 530 ASSERT(IsCurrentIsolate()); |
| 524 } | 531 } |
| 525 #endif | 532 #endif |
| 526 | 533 |
| (...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2163 serialized_message_, serialized_message_len_); | 2170 serialized_message_, serialized_message_len_); |
| 2164 } | 2171 } |
| 2165 | 2172 |
| 2166 | 2173 |
| 2167 void IsolateSpawnState::Cleanup() { | 2174 void IsolateSpawnState::Cleanup() { |
| 2168 SwitchIsolateScope switch_scope(I); | 2175 SwitchIsolateScope switch_scope(I); |
| 2169 Dart::ShutdownIsolate(); | 2176 Dart::ShutdownIsolate(); |
| 2170 } | 2177 } |
| 2171 | 2178 |
| 2172 } // namespace dart | 2179 } // namespace dart |
| OLD | NEW |