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 2561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2572 MaybeHandle<Object> Debug::MakeScriptCollectedEvent(int id) { | 2572 MaybeHandle<Object> Debug::MakeScriptCollectedEvent(int id) { |
2573 Handle<Object> exec_state; | 2573 Handle<Object> exec_state; |
2574 if (!MakeExecutionState().ToHandle(&exec_state)) return MaybeHandle<Object>(); | 2574 if (!MakeExecutionState().ToHandle(&exec_state)) return MaybeHandle<Object>(); |
2575 // Create the script collected event object. | 2575 // Create the script collected event object. |
2576 Handle<Object> id_object = Handle<Smi>(Smi::FromInt(id), isolate_); | 2576 Handle<Object> id_object = Handle<Smi>(Smi::FromInt(id), isolate_); |
2577 Handle<Object> argv[] = { exec_state, id_object }; | 2577 Handle<Object> argv[] = { exec_state, id_object }; |
2578 return MakeJSObject("MakeScriptCollectedEvent", ARRAY_SIZE(argv), argv); | 2578 return MakeJSObject("MakeScriptCollectedEvent", ARRAY_SIZE(argv), argv); |
2579 } | 2579 } |
2580 | 2580 |
2581 | 2581 |
| 2582 MaybeHandle<Object> Debug::MakePromiseEvent(Handle<JSObject> event_data) { |
| 2583 // Create the promise event object. |
| 2584 Handle<Object> argv[] = { event_data }; |
| 2585 return MakeJSObject("MakePromiseEvent", ARRAY_SIZE(argv), argv); |
| 2586 } |
| 2587 |
| 2588 |
2582 void Debug::OnException(Handle<Object> exception, bool uncaught) { | 2589 void Debug::OnException(Handle<Object> exception, bool uncaught) { |
2583 if (in_debug_scope() || ignore_events()) return; | 2590 if (in_debug_scope() || ignore_events()) return; |
2584 | 2591 |
2585 HandleScope scope(isolate_); | 2592 HandleScope scope(isolate_); |
2586 Handle<Object> promise = GetPromiseForUncaughtException(); | 2593 Handle<Object> promise = GetPromiseForUncaughtException(); |
2587 uncaught |= !promise->IsUndefined(); | 2594 uncaught |= !promise->IsUndefined(); |
2588 | 2595 |
2589 // Bail out if exception breaks are not active | 2596 // Bail out if exception breaks are not active |
2590 if (uncaught) { | 2597 if (uncaught) { |
2591 // Uncaught exceptions are reported by either flags. | 2598 // Uncaught exceptions are reported by either flags. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2723 // Bail out and don't call debugger if exception. | 2730 // Bail out and don't call debugger if exception. |
2724 if (!MakeScriptCollectedEvent(id).ToHandle(&event_data)) return; | 2731 if (!MakeScriptCollectedEvent(id).ToHandle(&event_data)) return; |
2725 | 2732 |
2726 // Process debug event. | 2733 // Process debug event. |
2727 ProcessDebugEvent(v8::ScriptCollected, | 2734 ProcessDebugEvent(v8::ScriptCollected, |
2728 Handle<JSObject>::cast(event_data), | 2735 Handle<JSObject>::cast(event_data), |
2729 true); | 2736 true); |
2730 } | 2737 } |
2731 | 2738 |
2732 | 2739 |
| 2740 void Debug::OnPromiseEvent(Handle<JSObject> data) { |
| 2741 if (in_debug_scope() || ignore_events()) return; |
| 2742 |
| 2743 HandleScope scope(isolate_); |
| 2744 DebugScope debug_scope(this); |
| 2745 if (debug_scope.failed()) return; |
| 2746 |
| 2747 // Create the script collected state object. |
| 2748 Handle<Object> event_data; |
| 2749 // Bail out and don't call debugger if exception. |
| 2750 if (!MakePromiseEvent(data).ToHandle(&event_data)) return; |
| 2751 |
| 2752 // Process debug event. |
| 2753 ProcessDebugEvent(v8::PromiseEvent, |
| 2754 Handle<JSObject>::cast(event_data), |
| 2755 true); |
| 2756 } |
| 2757 |
| 2758 |
2733 void Debug::ProcessDebugEvent(v8::DebugEvent event, | 2759 void Debug::ProcessDebugEvent(v8::DebugEvent event, |
2734 Handle<JSObject> event_data, | 2760 Handle<JSObject> event_data, |
2735 bool auto_continue) { | 2761 bool auto_continue) { |
2736 HandleScope scope(isolate_); | 2762 HandleScope scope(isolate_); |
2737 | 2763 |
2738 // Create the execution state. | 2764 // Create the execution state. |
2739 Handle<Object> exec_state; | 2765 Handle<Object> exec_state; |
2740 // Bail out and don't call debugger if exception. | 2766 // Bail out and don't call debugger if exception. |
2741 if (!MakeExecutionState().ToHandle(&exec_state)) return; | 2767 if (!MakeExecutionState().ToHandle(&exec_state)) return; |
2742 | 2768 |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3390 logger_->DebugEvent("Put", message.text()); | 3416 logger_->DebugEvent("Put", message.text()); |
3391 } | 3417 } |
3392 | 3418 |
3393 | 3419 |
3394 void LockingCommandMessageQueue::Clear() { | 3420 void LockingCommandMessageQueue::Clear() { |
3395 LockGuard<Mutex> lock_guard(&mutex_); | 3421 LockGuard<Mutex> lock_guard(&mutex_); |
3396 queue_.Clear(); | 3422 queue_.Clear(); |
3397 } | 3423 } |
3398 | 3424 |
3399 } } // namespace v8::internal | 3425 } } // namespace v8::internal |
OLD | NEW |