| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 2533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2544 } | 2544 } |
| 2545 | 2545 |
| 2546 | 2546 |
| 2547 MaybeHandle<Object> Debug::MakePromiseEvent(Handle<JSObject> event_data) { | 2547 MaybeHandle<Object> Debug::MakePromiseEvent(Handle<JSObject> event_data) { |
| 2548 // Create the promise event object. | 2548 // Create the promise event object. |
| 2549 Handle<Object> argv[] = { event_data }; | 2549 Handle<Object> argv[] = { event_data }; |
| 2550 return MakeJSObject("MakePromiseEvent", ARRAY_SIZE(argv), argv); | 2550 return MakeJSObject("MakePromiseEvent", ARRAY_SIZE(argv), argv); |
| 2551 } | 2551 } |
| 2552 | 2552 |
| 2553 | 2553 |
| 2554 MaybeHandle<Object> Debug::MakeAsyncTaskEvent(Handle<JSObject> task_event) { |
| 2555 // Create the async task event object. |
| 2556 Handle<Object> argv[] = { task_event }; |
| 2557 return MakeJSObject("MakeAsyncTaskEvent", ARRAY_SIZE(argv), argv); |
| 2558 } |
| 2559 |
| 2560 |
| 2554 void Debug::OnException(Handle<Object> exception, bool uncaught) { | 2561 void Debug::OnException(Handle<Object> exception, bool uncaught) { |
| 2555 if (in_debug_scope() || ignore_events()) return; | 2562 if (in_debug_scope() || ignore_events()) return; |
| 2556 | 2563 |
| 2557 HandleScope scope(isolate_); | 2564 HandleScope scope(isolate_); |
| 2558 Handle<Object> promise = GetPromiseForUncaughtException(); | 2565 Handle<Object> promise = GetPromiseForUncaughtException(); |
| 2559 uncaught |= !promise->IsUndefined(); | 2566 uncaught |= !promise->IsUndefined(); |
| 2560 | 2567 |
| 2561 // Bail out if exception breaks are not active | 2568 // Bail out if exception breaks are not active |
| 2562 if (uncaught) { | 2569 if (uncaught) { |
| 2563 // Uncaught exceptions are reported by either flags. | 2570 // Uncaught exceptions are reported by either flags. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2708 // Bail out and don't call debugger if exception. | 2715 // Bail out and don't call debugger if exception. |
| 2709 if (!MakePromiseEvent(data).ToHandle(&event_data)) return; | 2716 if (!MakePromiseEvent(data).ToHandle(&event_data)) return; |
| 2710 | 2717 |
| 2711 // Process debug event. | 2718 // Process debug event. |
| 2712 ProcessDebugEvent(v8::PromiseEvent, | 2719 ProcessDebugEvent(v8::PromiseEvent, |
| 2713 Handle<JSObject>::cast(event_data), | 2720 Handle<JSObject>::cast(event_data), |
| 2714 true); | 2721 true); |
| 2715 } | 2722 } |
| 2716 | 2723 |
| 2717 | 2724 |
| 2725 void Debug::OnAsyncTaskEvent(Handle<JSObject> data) { |
| 2726 if (in_debug_scope() || ignore_events()) return; |
| 2727 |
| 2728 HandleScope scope(isolate_); |
| 2729 DebugScope debug_scope(this); |
| 2730 if (debug_scope.failed()) return; |
| 2731 |
| 2732 // Create the script collected state object. |
| 2733 Handle<Object> event_data; |
| 2734 // Bail out and don't call debugger if exception. |
| 2735 if (!MakeAsyncTaskEvent(data).ToHandle(&event_data)) return; |
| 2736 |
| 2737 // Process debug event. |
| 2738 ProcessDebugEvent(v8::AsyncTaskEvent, |
| 2739 Handle<JSObject>::cast(event_data), |
| 2740 true); |
| 2741 } |
| 2742 |
| 2743 |
| 2718 void Debug::ProcessDebugEvent(v8::DebugEvent event, | 2744 void Debug::ProcessDebugEvent(v8::DebugEvent event, |
| 2719 Handle<JSObject> event_data, | 2745 Handle<JSObject> event_data, |
| 2720 bool auto_continue) { | 2746 bool auto_continue) { |
| 2721 HandleScope scope(isolate_); | 2747 HandleScope scope(isolate_); |
| 2722 | 2748 |
| 2723 // Create the execution state. | 2749 // Create the execution state. |
| 2724 Handle<Object> exec_state; | 2750 Handle<Object> exec_state; |
| 2725 // Bail out and don't call debugger if exception. | 2751 // Bail out and don't call debugger if exception. |
| 2726 if (!MakeExecutionState().ToHandle(&exec_state)) return; | 2752 if (!MakeExecutionState().ToHandle(&exec_state)) return; |
| 2727 | 2753 |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3370 logger_->DebugEvent("Put", message.text()); | 3396 logger_->DebugEvent("Put", message.text()); |
| 3371 } | 3397 } |
| 3372 | 3398 |
| 3373 | 3399 |
| 3374 void LockingCommandMessageQueue::Clear() { | 3400 void LockingCommandMessageQueue::Clear() { |
| 3375 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 3401 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
| 3376 queue_.Clear(); | 3402 queue_.Clear(); |
| 3377 } | 3403 } |
| 3378 | 3404 |
| 3379 } } // namespace v8::internal | 3405 } } // namespace v8::internal |
| OLD | NEW |