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 "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/text_buffer.h" | 10 #include "platform/text_buffer.h" |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 if (!FLAG_support_service) { | 580 if (!FLAG_support_service) { |
581 return; | 581 return; |
582 } | 582 } |
583 if (Service::debug_stream.enabled() || FLAG_warn_on_pause_with_no_debugger) { | 583 if (Service::debug_stream.enabled() || FLAG_warn_on_pause_with_no_debugger) { |
584 StartIsolateScope start_isolate(I); | 584 StartIsolateScope start_isolate(I); |
585 StackZone zone(T); | 585 StackZone zone(T); |
586 HandleScope handle_scope(T); | 586 HandleScope handle_scope(T); |
587 ServiceEvent pause_event(I, ServiceEvent::kPauseStart); | 587 ServiceEvent pause_event(I, ServiceEvent::kPauseStart); |
588 Service::HandleEvent(&pause_event); | 588 Service::HandleEvent(&pause_event); |
589 } else if (FLAG_trace_service) { | 589 } else if (FLAG_trace_service) { |
590 OS::Print("vm-service: Dropping event of type PauseStart (%s)\n", | 590 OS::PrintErr("vm-service: Dropping event of type PauseStart (%s)\n", |
591 I->name()); | 591 I->name()); |
592 } | 592 } |
593 } | 593 } |
594 | 594 |
595 void IsolateMessageHandler::NotifyPauseOnExit() { | 595 void IsolateMessageHandler::NotifyPauseOnExit() { |
596 if (!FLAG_support_service) { | 596 if (!FLAG_support_service) { |
597 return; | 597 return; |
598 } | 598 } |
599 if (Service::debug_stream.enabled() || FLAG_warn_on_pause_with_no_debugger) { | 599 if (Service::debug_stream.enabled() || FLAG_warn_on_pause_with_no_debugger) { |
600 StartIsolateScope start_isolate(I); | 600 StartIsolateScope start_isolate(I); |
601 StackZone zone(T); | 601 StackZone zone(T); |
602 HandleScope handle_scope(T); | 602 HandleScope handle_scope(T); |
603 ServiceEvent pause_event(I, ServiceEvent::kPauseExit); | 603 ServiceEvent pause_event(I, ServiceEvent::kPauseExit); |
604 Service::HandleEvent(&pause_event); | 604 Service::HandleEvent(&pause_event); |
605 } else if (FLAG_trace_service) { | 605 } else if (FLAG_trace_service) { |
606 OS::Print("vm-service: Dropping event of type PauseExit (%s)\n", I->name()); | 606 OS::PrintErr("vm-service: Dropping event of type PauseExit (%s)\n", |
| 607 I->name()); |
607 } | 608 } |
608 } | 609 } |
609 #endif // !PRODUCT | 610 #endif // !PRODUCT |
610 | 611 |
611 #if defined(DEBUG) | 612 #if defined(DEBUG) |
612 void IsolateMessageHandler::CheckAccess() { | 613 void IsolateMessageHandler::CheckAccess() { |
613 ASSERT(IsCurrentIsolate()); | 614 ASSERT(IsCurrentIsolate()); |
614 } | 615 } |
615 #endif | 616 #endif |
616 | 617 |
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2154 ASSERT(!parameter_values.IsNull()); | 2155 ASSERT(!parameter_values.IsNull()); |
2155 arguments.SetAt(kPendingValuesIndex, parameter_values); | 2156 arguments.SetAt(kPendingValuesIndex, parameter_values); |
2156 reply_port ^= calls.At(i + kPendingReplyPortIndex); | 2157 reply_port ^= calls.At(i + kPendingReplyPortIndex); |
2157 ASSERT(!reply_port.IsNull()); | 2158 ASSERT(!reply_port.IsNull()); |
2158 arguments.SetAt(kPendingReplyPortIndex, reply_port); | 2159 arguments.SetAt(kPendingReplyPortIndex, reply_port); |
2159 id ^= calls.At(i + kPendingIdIndex); | 2160 id ^= calls.At(i + kPendingIdIndex); |
2160 arguments.SetAt(kPendingIdIndex, id); | 2161 arguments.SetAt(kPendingIdIndex, id); |
2161 arguments.SetAt(kPendingEntrySize, Bool::Get(FLAG_trace_service)); | 2162 arguments.SetAt(kPendingEntrySize, Bool::Get(FLAG_trace_service)); |
2162 | 2163 |
2163 if (FLAG_trace_service) { | 2164 if (FLAG_trace_service) { |
2164 OS::Print("[+%" Pd64 "ms] Isolate %s invoking _runExtension for %s\n", | 2165 OS::PrintErr("[+%" Pd64 "ms] Isolate %s invoking _runExtension for %s\n", |
2165 Dart::UptimeMillis(), name(), method_name.ToCString()); | 2166 Dart::UptimeMillis(), name(), method_name.ToCString()); |
2166 } | 2167 } |
2167 result = DartEntry::InvokeFunction(run_extension, arguments); | 2168 result = DartEntry::InvokeFunction(run_extension, arguments); |
2168 if (FLAG_trace_service) { | 2169 if (FLAG_trace_service) { |
2169 OS::Print("[+%" Pd64 "ms] Isolate %s : _runExtension complete for %s\n", | 2170 OS::PrintErr("[+%" Pd64 "ms] Isolate %s _runExtension complete for %s\n", |
2170 Dart::UptimeMillis(), name(), method_name.ToCString()); | 2171 Dart::UptimeMillis(), name(), method_name.ToCString()); |
2171 } | 2172 } |
2172 // Propagate the error. | 2173 // Propagate the error. |
2173 if (result.IsError()) { | 2174 if (result.IsError()) { |
2174 // Remaining service extension calls are dropped. | 2175 // Remaining service extension calls are dropped. |
2175 if (!result.IsUnwindError()) { | 2176 if (!result.IsUnwindError()) { |
2176 // Send error back over the protocol. | 2177 // Send error back over the protocol. |
2177 Service::PostError(method_name, parameter_keys, parameter_values, | 2178 Service::PostError(method_name, parameter_keys, parameter_values, |
2178 reply_port, id, Error::Cast(result)); | 2179 reply_port, id, Error::Cast(result)); |
2179 } | 2180 } |
2180 return result.raw(); | 2181 return result.raw(); |
(...skipping 15 matching lines...) Expand all Loading... |
2196 return r; | 2197 return r; |
2197 } | 2198 } |
2198 | 2199 |
2199 void Isolate::AppendServiceExtensionCall(const Instance& closure, | 2200 void Isolate::AppendServiceExtensionCall(const Instance& closure, |
2200 const String& method_name, | 2201 const String& method_name, |
2201 const Array& parameter_keys, | 2202 const Array& parameter_keys, |
2202 const Array& parameter_values, | 2203 const Array& parameter_values, |
2203 const Instance& reply_port, | 2204 const Instance& reply_port, |
2204 const Instance& id) { | 2205 const Instance& id) { |
2205 if (FLAG_trace_service) { | 2206 if (FLAG_trace_service) { |
2206 OS::Print("[+%" Pd64 "ms] Isolate %s ENQUEUING request for extension %s\n", | 2207 OS::PrintErr("[+%" Pd64 |
2207 Dart::UptimeMillis(), name(), method_name.ToCString()); | 2208 "ms] Isolate %s ENQUEUING request for extension %s\n", |
| 2209 Dart::UptimeMillis(), name(), method_name.ToCString()); |
2208 } | 2210 } |
2209 GrowableObjectArray& calls = | 2211 GrowableObjectArray& calls = |
2210 GrowableObjectArray::Handle(pending_service_extension_calls()); | 2212 GrowableObjectArray::Handle(pending_service_extension_calls()); |
2211 if (calls.IsNull()) { | 2213 if (calls.IsNull()) { |
2212 calls ^= GrowableObjectArray::New(); | 2214 calls ^= GrowableObjectArray::New(); |
2213 ASSERT(!calls.IsNull()); | 2215 ASSERT(!calls.IsNull()); |
2214 set_pending_service_extension_calls(calls); | 2216 set_pending_service_extension_calls(calls); |
2215 } | 2217 } |
2216 ASSERT(kPendingHandlerIndex == 0); | 2218 ASSERT(kPendingHandlerIndex == 0); |
2217 calls.Add(closure); | 2219 calls.Add(closure); |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2842 void IsolateSpawnState::DecrementSpawnCount() { | 2844 void IsolateSpawnState::DecrementSpawnCount() { |
2843 ASSERT(spawn_count_monitor_ != NULL); | 2845 ASSERT(spawn_count_monitor_ != NULL); |
2844 ASSERT(spawn_count_ != NULL); | 2846 ASSERT(spawn_count_ != NULL); |
2845 MonitorLocker ml(spawn_count_monitor_); | 2847 MonitorLocker ml(spawn_count_monitor_); |
2846 ASSERT(*spawn_count_ > 0); | 2848 ASSERT(*spawn_count_ > 0); |
2847 *spawn_count_ = *spawn_count_ - 1; | 2849 *spawn_count_ = *spawn_count_ - 1; |
2848 ml.Notify(); | 2850 ml.Notify(); |
2849 } | 2851 } |
2850 | 2852 |
2851 } // namespace dart | 2853 } // namespace dart |
OLD | NEW |