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 2536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2547 } | 2547 } |
2548 | 2548 |
2549 | 2549 |
2550 MaybeHandle<Object> Debug::MakePromiseEvent(Handle<JSObject> event_data) { | 2550 MaybeHandle<Object> Debug::MakePromiseEvent(Handle<JSObject> event_data) { |
2551 // Create the promise event object. | 2551 // Create the promise event object. |
2552 Handle<Object> argv[] = { event_data }; | 2552 Handle<Object> argv[] = { event_data }; |
2553 return MakeJSObject("MakePromiseEvent", ARRAY_SIZE(argv), argv); | 2553 return MakeJSObject("MakePromiseEvent", ARRAY_SIZE(argv), argv); |
2554 } | 2554 } |
2555 | 2555 |
2556 | 2556 |
| 2557 MaybeHandle<Object> Debug::MakeAsyncTaskEvent(Handle<JSObject> task_event) { |
| 2558 // Create the async task event object. |
| 2559 Handle<Object> argv[] = { task_event }; |
| 2560 return MakeJSObject("MakeAsyncTaskEvent", ARRAY_SIZE(argv), argv); |
| 2561 } |
| 2562 |
| 2563 |
2557 void Debug::OnException(Handle<Object> exception, bool uncaught) { | 2564 void Debug::OnException(Handle<Object> exception, bool uncaught) { |
2558 if (in_debug_scope() || ignore_events()) return; | 2565 if (in_debug_scope() || ignore_events()) return; |
2559 | 2566 |
2560 HandleScope scope(isolate_); | 2567 HandleScope scope(isolate_); |
2561 Handle<Object> promise = GetPromiseForUncaughtException(); | 2568 Handle<Object> promise = GetPromiseForUncaughtException(); |
2562 uncaught |= !promise->IsUndefined(); | 2569 uncaught |= !promise->IsUndefined(); |
2563 | 2570 |
2564 // Bail out if exception breaks are not active | 2571 // Bail out if exception breaks are not active |
2565 if (uncaught) { | 2572 if (uncaught) { |
2566 // Uncaught exceptions are reported by either flags. | 2573 // Uncaught exceptions are reported by either flags. |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2711 // Bail out and don't call debugger if exception. | 2718 // Bail out and don't call debugger if exception. |
2712 if (!MakePromiseEvent(data).ToHandle(&event_data)) return; | 2719 if (!MakePromiseEvent(data).ToHandle(&event_data)) return; |
2713 | 2720 |
2714 // Process debug event. | 2721 // Process debug event. |
2715 ProcessDebugEvent(v8::PromiseEvent, | 2722 ProcessDebugEvent(v8::PromiseEvent, |
2716 Handle<JSObject>::cast(event_data), | 2723 Handle<JSObject>::cast(event_data), |
2717 true); | 2724 true); |
2718 } | 2725 } |
2719 | 2726 |
2720 | 2727 |
| 2728 void Debug::OnAsyncTaskEvent(Handle<JSObject> data) { |
| 2729 if (in_debug_scope() || ignore_events()) return; |
| 2730 |
| 2731 HandleScope scope(isolate_); |
| 2732 DebugScope debug_scope(this); |
| 2733 if (debug_scope.failed()) return; |
| 2734 |
| 2735 // Create the script collected state object. |
| 2736 Handle<Object> event_data; |
| 2737 // Bail out and don't call debugger if exception. |
| 2738 if (!MakeAsyncTaskEvent(data).ToHandle(&event_data)) return; |
| 2739 |
| 2740 // Process debug event. |
| 2741 ProcessDebugEvent(v8::AsyncTaskEvent, |
| 2742 Handle<JSObject>::cast(event_data), |
| 2743 true); |
| 2744 } |
| 2745 |
| 2746 |
2721 void Debug::ProcessDebugEvent(v8::DebugEvent event, | 2747 void Debug::ProcessDebugEvent(v8::DebugEvent event, |
2722 Handle<JSObject> event_data, | 2748 Handle<JSObject> event_data, |
2723 bool auto_continue) { | 2749 bool auto_continue) { |
2724 HandleScope scope(isolate_); | 2750 HandleScope scope(isolate_); |
2725 | 2751 |
2726 // Create the execution state. | 2752 // Create the execution state. |
2727 Handle<Object> exec_state; | 2753 Handle<Object> exec_state; |
2728 // Bail out and don't call debugger if exception. | 2754 // Bail out and don't call debugger if exception. |
2729 if (!MakeExecutionState().ToHandle(&exec_state)) return; | 2755 if (!MakeExecutionState().ToHandle(&exec_state)) return; |
2730 | 2756 |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3372 logger_->DebugEvent("Put", message.text()); | 3398 logger_->DebugEvent("Put", message.text()); |
3373 } | 3399 } |
3374 | 3400 |
3375 | 3401 |
3376 void LockingCommandMessageQueue::Clear() { | 3402 void LockingCommandMessageQueue::Clear() { |
3377 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 3403 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
3378 queue_.Clear(); | 3404 queue_.Clear(); |
3379 } | 3405 } |
3380 | 3406 |
3381 } } // namespace v8::internal | 3407 } } // namespace v8::internal |
OLD | NEW |