| 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 break; | 331 break; |
| 332 } | 332 } |
| 333 case Isolate::kInterruptMsg: { | 333 case Isolate::kInterruptMsg: { |
| 334 // [ OOB, kInterruptMsg, pause capability ] | 334 // [ OOB, kInterruptMsg, pause capability ] |
| 335 if (message.Length() != 3) return Error::null(); | 335 if (message.Length() != 3) return Error::null(); |
| 336 Object& obj = Object::Handle(zone, message.At(2)); | 336 Object& obj = Object::Handle(zone, message.At(2)); |
| 337 if (!I->VerifyPauseCapability(obj)) return Error::null(); | 337 if (!I->VerifyPauseCapability(obj)) return Error::null(); |
| 338 | 338 |
| 339 // If we are already paused, don't pause again. | 339 // If we are already paused, don't pause again. |
| 340 if (FLAG_support_debugger && (I->debugger()->PauseEvent() == NULL)) { | 340 if (FLAG_support_debugger && (I->debugger()->PauseEvent() == NULL)) { |
| 341 return I->debugger()->SignalIsolateInterrupted(); | 341 return I->debugger()->PauseInterrupted(); |
| 342 } | 342 } |
| 343 break; | 343 break; |
| 344 } | 344 } |
| 345 | 345 |
| 346 case Isolate::kAddExitMsg: | 346 case Isolate::kAddExitMsg: |
| 347 case Isolate::kDelExitMsg: | 347 case Isolate::kDelExitMsg: |
| 348 case Isolate::kAddErrorMsg: | 348 case Isolate::kAddErrorMsg: |
| 349 case Isolate::kDelErrorMsg: { | 349 case Isolate::kDelErrorMsg: { |
| 350 // [ OOB, msg, listener port ] | 350 // [ OOB, msg, listener port ] |
| 351 if (message.Length() < 3) return Error::null(); | 351 if (message.Length() < 3) return Error::null(); |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 // withheld when being thrown. Do this after setting the sticky error | 663 // withheld when being thrown. Do this after setting the sticky error |
| 664 // so the isolate has an error set when paused with the unhandled | 664 // so the isolate has an error set when paused with the unhandled |
| 665 // exception. | 665 // exception. |
| 666 if (result.IsUnhandledException()) { | 666 if (result.IsUnhandledException()) { |
| 667 const UnhandledException& error = UnhandledException::Cast(result); | 667 const UnhandledException& error = UnhandledException::Cast(result); |
| 668 RawInstance* exception = error.exception(); | 668 RawInstance* exception = error.exception(); |
| 669 if ((exception == I->object_store()->out_of_memory()) || | 669 if ((exception == I->object_store()->out_of_memory()) || |
| 670 (exception == I->object_store()->stack_overflow())) { | 670 (exception == I->object_store()->stack_overflow())) { |
| 671 // We didn't notify the debugger when the stack was full. Do it now. | 671 // We didn't notify the debugger when the stack was full. Do it now. |
| 672 if (FLAG_support_debugger) { | 672 if (FLAG_support_debugger) { |
| 673 I->debugger()->SignalExceptionThrown(Instance::Handle(exception)); | 673 I->debugger()->PauseException(Instance::Handle(exception)); |
| 674 } | 674 } |
| 675 } | 675 } |
| 676 } | 676 } |
| 677 return kError; | 677 return kError; |
| 678 } | 678 } |
| 679 } | 679 } |
| 680 return kOK; | 680 return kOK; |
| 681 } | 681 } |
| 682 | 682 |
| 683 | 683 |
| (...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1765 } else if (message_handler()->is_paused_on_start() || | 1765 } else if (message_handler()->is_paused_on_start() || |
| 1766 message_handler()->should_pause_on_start()) { | 1766 message_handler()->should_pause_on_start()) { |
| 1767 ASSERT(debugger()->PauseEvent() == NULL); | 1767 ASSERT(debugger()->PauseEvent() == NULL); |
| 1768 ServiceEvent pause_event(this, ServiceEvent::kPauseStart); | 1768 ServiceEvent pause_event(this, ServiceEvent::kPauseStart); |
| 1769 jsobj.AddProperty("pauseEvent", &pause_event); | 1769 jsobj.AddProperty("pauseEvent", &pause_event); |
| 1770 } else if (message_handler()->is_paused_on_exit()) { | 1770 } else if (message_handler()->is_paused_on_exit()) { |
| 1771 ASSERT(debugger()->PauseEvent() == NULL); | 1771 ASSERT(debugger()->PauseEvent() == NULL); |
| 1772 ServiceEvent pause_event(this, ServiceEvent::kPauseExit); | 1772 ServiceEvent pause_event(this, ServiceEvent::kPauseExit); |
| 1773 jsobj.AddProperty("pauseEvent", &pause_event); | 1773 jsobj.AddProperty("pauseEvent", &pause_event); |
| 1774 } else if (debugger()->PauseEvent() != NULL && !resume_request_) { | 1774 } else if (debugger()->PauseEvent() != NULL && !resume_request_) { |
| 1775 ServiceEvent pause_event(debugger()->PauseEvent()); | 1775 jsobj.AddProperty("pauseEvent", debugger()->PauseEvent()); |
| 1776 jsobj.AddProperty("pauseEvent", &pause_event); | |
| 1777 } else { | 1776 } else { |
| 1778 ServiceEvent pause_event(this, ServiceEvent::kResume); | 1777 ServiceEvent pause_event(this, ServiceEvent::kResume); |
| 1779 | 1778 |
| 1780 // TODO(turnidge): Don't compute a full stack trace. | 1779 // TODO(turnidge): Don't compute a full stack trace. |
| 1781 DebuggerStackTrace* stack = debugger()->StackTrace(); | 1780 DebuggerStackTrace* stack = debugger()->StackTrace(); |
| 1782 if (stack->Length() > 0) { | 1781 if (stack->Length() > 0) { |
| 1783 pause_event.set_top_frame(stack->FrameAt(0)); | 1782 pause_event.set_top_frame(stack->FrameAt(0)); |
| 1784 } | 1783 } |
| 1785 jsobj.AddProperty("pauseEvent", &pause_event); | 1784 jsobj.AddProperty("pauseEvent", &pause_event); |
| 1786 } | 1785 } |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2717 void IsolateSpawnState::DecrementSpawnCount() { | 2716 void IsolateSpawnState::DecrementSpawnCount() { |
| 2718 ASSERT(spawn_count_monitor_ != NULL); | 2717 ASSERT(spawn_count_monitor_ != NULL); |
| 2719 ASSERT(spawn_count_ != NULL); | 2718 ASSERT(spawn_count_ != NULL); |
| 2720 MonitorLocker ml(spawn_count_monitor_); | 2719 MonitorLocker ml(spawn_count_monitor_); |
| 2721 ASSERT(*spawn_count_ > 0); | 2720 ASSERT(*spawn_count_ > 0); |
| 2722 *spawn_count_ = *spawn_count_ - 1; | 2721 *spawn_count_ = *spawn_count_ - 1; |
| 2723 ml.Notify(); | 2722 ml.Notify(); |
| 2724 } | 2723 } |
| 2725 | 2724 |
| 2726 } // namespace dart | 2725 } // namespace dart |
| OLD | NEW |