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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // TODO(iposva): Make these isolate specific flags inaccessible using the | 77 // TODO(iposva): Make these isolate specific flags inaccessible using the |
78 // regular FLAG_xyz pattern. | 78 // regular FLAG_xyz pattern. |
79 // These flags are per-isolate and only influence the defaults. | 79 // These flags are per-isolate and only influence the defaults. |
80 DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements."); | 80 DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements."); |
81 DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks."); | 81 DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks."); |
82 DEFINE_FLAG(bool, error_on_bad_override, false, | 82 DEFINE_FLAG(bool, error_on_bad_override, false, |
83 "Report error for bad overrides."); | 83 "Report error for bad overrides."); |
84 DEFINE_FLAG(bool, error_on_bad_type, false, | 84 DEFINE_FLAG(bool, error_on_bad_type, false, |
85 "Report error for malformed types."); | 85 "Report error for malformed types."); |
86 | 86 |
| 87 DECLARE_FLAG(bool, warn_on_pause_with_no_debugger); |
| 88 |
87 static void CheckedModeHandler(bool value) { | 89 static void CheckedModeHandler(bool value) { |
88 FLAG_enable_asserts = value; | 90 FLAG_enable_asserts = value; |
89 FLAG_enable_type_checks = value; | 91 FLAG_enable_type_checks = value; |
90 } | 92 } |
91 | 93 |
92 // --enable-checked-mode and --checked both enable checked mode which is | 94 // --enable-checked-mode and --checked both enable checked mode which is |
93 // equivalent to setting --enable-asserts and --enable-type-checks. | 95 // equivalent to setting --enable-asserts and --enable-type-checks. |
94 DEFINE_FLAG_HANDLER(CheckedModeHandler, | 96 DEFINE_FLAG_HANDLER(CheckedModeHandler, |
95 enable_checked_mode, | 97 enable_checked_mode, |
96 "Enable checked mode."); | 98 "Enable checked mode."); |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 status = ProcessUnhandledException(Error::Cast(result)); | 564 status = ProcessUnhandledException(Error::Cast(result)); |
563 } else { | 565 } else { |
564 ASSERT(result.IsNull()); | 566 ASSERT(result.IsNull()); |
565 } | 567 } |
566 } | 568 } |
567 return status; | 569 return status; |
568 } | 570 } |
569 | 571 |
570 | 572 |
571 void IsolateMessageHandler::NotifyPauseOnStart() { | 573 void IsolateMessageHandler::NotifyPauseOnStart() { |
572 if (Service::debug_stream.enabled()) { | 574 if (Service::debug_stream.enabled() || FLAG_warn_on_pause_with_no_debugger) { |
573 StartIsolateScope start_isolate(I); | 575 StartIsolateScope start_isolate(I); |
574 StackZone zone(T); | 576 StackZone zone(T); |
575 HandleScope handle_scope(T); | 577 HandleScope handle_scope(T); |
576 ServiceEvent pause_event(I, ServiceEvent::kPauseStart); | 578 ServiceEvent pause_event(I, ServiceEvent::kPauseStart); |
577 Service::HandleEvent(&pause_event); | 579 Service::HandleEvent(&pause_event); |
578 } else if (FLAG_trace_service) { | 580 } else if (FLAG_trace_service) { |
579 OS::Print("vm-service: Dropping event of type PauseStart (%s)\n", | 581 OS::Print("vm-service: Dropping event of type PauseStart (%s)\n", |
580 I->name()); | 582 I->name()); |
581 } | 583 } |
582 } | 584 } |
583 | 585 |
584 | 586 |
585 void IsolateMessageHandler::NotifyPauseOnExit() { | 587 void IsolateMessageHandler::NotifyPauseOnExit() { |
586 if (Service::debug_stream.enabled()) { | 588 if (Service::debug_stream.enabled() || FLAG_warn_on_pause_with_no_debugger) { |
587 StartIsolateScope start_isolate(I); | 589 StartIsolateScope start_isolate(I); |
588 StackZone zone(T); | 590 StackZone zone(T); |
589 HandleScope handle_scope(T); | 591 HandleScope handle_scope(T); |
590 ServiceEvent pause_event(I, ServiceEvent::kPauseExit); | 592 ServiceEvent pause_event(I, ServiceEvent::kPauseExit); |
591 Service::HandleEvent(&pause_event); | 593 Service::HandleEvent(&pause_event); |
592 } else if (FLAG_trace_service) { | 594 } else if (FLAG_trace_service) { |
593 OS::Print("vm-service: Dropping event of type PauseExit (%s)\n", | 595 OS::Print("vm-service: Dropping event of type PauseExit (%s)\n", |
594 I->name()); | 596 I->name()); |
595 } | 597 } |
596 } | 598 } |
(...skipping 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2559 void IsolateSpawnState::DecrementSpawnCount() { | 2561 void IsolateSpawnState::DecrementSpawnCount() { |
2560 ASSERT(spawn_count_monitor_ != NULL); | 2562 ASSERT(spawn_count_monitor_ != NULL); |
2561 ASSERT(spawn_count_ != NULL); | 2563 ASSERT(spawn_count_ != NULL); |
2562 MonitorLocker ml(spawn_count_monitor_); | 2564 MonitorLocker ml(spawn_count_monitor_); |
2563 ASSERT(*spawn_count_ > 0); | 2565 ASSERT(*spawn_count_ > 0); |
2564 *spawn_count_ = *spawn_count_ - 1; | 2566 *spawn_count_ = *spawn_count_ - 1; |
2565 ml.Notify(); | 2567 ml.Notify(); |
2566 } | 2568 } |
2567 | 2569 |
2568 } // namespace dart | 2570 } // namespace dart |
OLD | NEW |