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/debug/debug.h" | 5 #include "src/debug/debug.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1649 | 1649 |
1650 MaybeHandle<Object> Debug::MakeCompileEvent(Handle<Script> script, | 1650 MaybeHandle<Object> Debug::MakeCompileEvent(Handle<Script> script, |
1651 v8::DebugEvent type) { | 1651 v8::DebugEvent type) { |
1652 // Create the compile event object. | 1652 // Create the compile event object. |
1653 Handle<Object> script_wrapper = Script::GetWrapper(script); | 1653 Handle<Object> script_wrapper = Script::GetWrapper(script); |
1654 Handle<Object> argv[] = { script_wrapper, | 1654 Handle<Object> argv[] = { script_wrapper, |
1655 isolate_->factory()->NewNumberFromInt(type) }; | 1655 isolate_->factory()->NewNumberFromInt(type) }; |
1656 return CallFunction("MakeCompileEvent", arraysize(argv), argv); | 1656 return CallFunction("MakeCompileEvent", arraysize(argv), argv); |
1657 } | 1657 } |
1658 | 1658 |
1659 MaybeHandle<Object> Debug::MakeAsyncTaskEvent(Handle<String> type, | 1659 MaybeHandle<Object> Debug::MakeAsyncTaskEvent(Handle<Smi> type, Handle<Smi> id, |
1660 Handle<Object> id, | 1660 Handle<Smi> name) { |
1661 Handle<String> name) { | |
1662 DCHECK(id->IsNumber()); | 1661 DCHECK(id->IsNumber()); |
1663 // Create the async task event object. | 1662 // Create the async task event object. |
1664 Handle<Object> argv[] = {type, id, name}; | 1663 Handle<Object> argv[] = {type, id, name}; |
1665 return CallFunction("MakeAsyncTaskEvent", arraysize(argv), argv); | 1664 return CallFunction("MakeAsyncTaskEvent", arraysize(argv), argv); |
1666 } | 1665 } |
1667 | 1666 |
1668 | 1667 |
1669 void Debug::OnThrow(Handle<Object> exception) { | 1668 void Debug::OnThrow(Handle<Object> exception) { |
1670 if (in_debug_scope() || ignore_events()) return; | 1669 if (in_debug_scope() || ignore_events()) return; |
1671 PrepareStepOnThrow(); | 1670 PrepareStepOnThrow(); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 void Debug::OnCompileError(Handle<Script> script) { | 1771 void Debug::OnCompileError(Handle<Script> script) { |
1773 ProcessCompileEvent(v8::CompileError, script); | 1772 ProcessCompileEvent(v8::CompileError, script); |
1774 } | 1773 } |
1775 | 1774 |
1776 | 1775 |
1777 // Handle debugger actions when a new script is compiled. | 1776 // Handle debugger actions when a new script is compiled. |
1778 void Debug::OnAfterCompile(Handle<Script> script) { | 1777 void Debug::OnAfterCompile(Handle<Script> script) { |
1779 ProcessCompileEvent(v8::AfterCompile, script); | 1778 ProcessCompileEvent(v8::AfterCompile, script); |
1780 } | 1779 } |
1781 | 1780 |
1782 void Debug::OnAsyncTaskEvent(Handle<String> type, Handle<Object> id, | 1781 void Debug::OnAsyncTaskEvent(PromiseDebugActionType type, int id, |
1783 Handle<String> name) { | 1782 PromiseDebugActionName name) { |
1784 DCHECK(id->IsNumber()); | |
1785 if (in_debug_scope() || ignore_events()) return; | 1783 if (in_debug_scope() || ignore_events()) return; |
1786 | 1784 |
1787 HandleScope scope(isolate_); | 1785 HandleScope scope(isolate_); |
1788 DebugScope debug_scope(this); | 1786 DebugScope debug_scope(this); |
1789 if (debug_scope.failed()) return; | 1787 if (debug_scope.failed()) return; |
1790 | 1788 |
1791 // Create the script collected state object. | 1789 // Create the script collected state object. |
1792 Handle<Object> event_data; | 1790 Handle<Object> event_data; |
1793 // Bail out and don't call debugger if exception. | 1791 // Bail out and don't call debugger if exception. |
1794 if (!MakeAsyncTaskEvent(type, id, name).ToHandle(&event_data)) return; | 1792 if (!MakeAsyncTaskEvent(handle(Smi::FromInt(type), isolate_), |
| 1793 handle(Smi::FromInt(id), isolate_), |
| 1794 handle(Smi::FromInt(name), isolate_)) |
| 1795 .ToHandle(&event_data)) |
| 1796 return; |
1795 | 1797 |
1796 // Process debug event. | 1798 // Process debug event. |
1797 ProcessDebugEvent(v8::AsyncTaskEvent, Handle<JSObject>::cast(event_data), | 1799 ProcessDebugEvent(v8::AsyncTaskEvent, Handle<JSObject>::cast(event_data), |
1798 true); | 1800 true); |
1799 } | 1801 } |
1800 | 1802 |
1801 void Debug::ProcessDebugEvent(v8::DebugEvent event, Handle<JSObject> event_data, | 1803 void Debug::ProcessDebugEvent(v8::DebugEvent event, Handle<JSObject> event_data, |
1802 bool auto_continue) { | 1804 bool auto_continue) { |
1803 HandleScope scope(isolate_); | 1805 HandleScope scope(isolate_); |
1804 | 1806 |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2494 logger_->DebugEvent("Put", message.text()); | 2496 logger_->DebugEvent("Put", message.text()); |
2495 } | 2497 } |
2496 | 2498 |
2497 void LockingCommandMessageQueue::Clear() { | 2499 void LockingCommandMessageQueue::Clear() { |
2498 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2500 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2499 queue_.Clear(); | 2501 queue_.Clear(); |
2500 } | 2502 } |
2501 | 2503 |
2502 } // namespace internal | 2504 } // namespace internal |
2503 } // namespace v8 | 2505 } // namespace v8 |
OLD | NEW |