Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(644)

Side by Side Diff: src/debug/debug.cc

Issue 2415023002: [promises] Move async debug event creation to c++ (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/debug/debug.h ('k') | src/debug/debug.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 1651
1652 MaybeHandle<Object> Debug::MakeCompileEvent(Handle<Script> script, 1652 MaybeHandle<Object> Debug::MakeCompileEvent(Handle<Script> script,
1653 v8::DebugEvent type) { 1653 v8::DebugEvent type) {
1654 // Create the compile event object. 1654 // Create the compile event object.
1655 Handle<Object> script_wrapper = Script::GetWrapper(script); 1655 Handle<Object> script_wrapper = Script::GetWrapper(script);
1656 Handle<Object> argv[] = { script_wrapper, 1656 Handle<Object> argv[] = { script_wrapper,
1657 isolate_->factory()->NewNumberFromInt(type) }; 1657 isolate_->factory()->NewNumberFromInt(type) };
1658 return CallFunction("MakeCompileEvent", arraysize(argv), argv); 1658 return CallFunction("MakeCompileEvent", arraysize(argv), argv);
1659 } 1659 }
1660 1660
1661 1661 MaybeHandle<Object> Debug::MakeAsyncTaskEvent(Handle<String> type,
1662 MaybeHandle<Object> Debug::MakeAsyncTaskEvent(Handle<JSObject> task_event) { 1662 Handle<Object> id,
1663 Handle<String> name) {
1664 DCHECK(id->IsNumber());
1663 // Create the async task event object. 1665 // Create the async task event object.
1664 Handle<Object> argv[] = { task_event }; 1666 Handle<Object> argv[] = {type, id, name};
1665 return CallFunction("MakeAsyncTaskEvent", arraysize(argv), argv); 1667 return CallFunction("MakeAsyncTaskEvent", arraysize(argv), argv);
1666 } 1668 }
1667 1669
1668 1670
1669 void Debug::OnThrow(Handle<Object> exception) { 1671 void Debug::OnThrow(Handle<Object> exception) {
1670 if (in_debug_scope() || ignore_events()) return; 1672 if (in_debug_scope() || ignore_events()) return;
1671 PrepareStepOnThrow(); 1673 PrepareStepOnThrow();
1672 // Temporarily clear any scheduled_exception to allow evaluating 1674 // Temporarily clear any scheduled_exception to allow evaluating
1673 // JavaScript from the debug event handler. 1675 // JavaScript from the debug event handler.
1674 HandleScope scope(isolate_); 1676 HandleScope scope(isolate_);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 void Debug::OnBeforeCompile(Handle<Script> script) { 1776 void Debug::OnBeforeCompile(Handle<Script> script) {
1775 ProcessCompileEvent(v8::BeforeCompile, script); 1777 ProcessCompileEvent(v8::BeforeCompile, script);
1776 } 1778 }
1777 1779
1778 1780
1779 // Handle debugger actions when a new script is compiled. 1781 // Handle debugger actions when a new script is compiled.
1780 void Debug::OnAfterCompile(Handle<Script> script) { 1782 void Debug::OnAfterCompile(Handle<Script> script) {
1781 ProcessCompileEvent(v8::AfterCompile, script); 1783 ProcessCompileEvent(v8::AfterCompile, script);
1782 } 1784 }
1783 1785
1784 1786 void Debug::OnAsyncTaskEvent(Handle<String> type, Handle<Object> id,
1785 void Debug::OnAsyncTaskEvent(Handle<JSObject> data) { 1787 Handle<String> name) {
1788 DCHECK(id->IsNumber());
1786 if (in_debug_scope() || ignore_events()) return; 1789 if (in_debug_scope() || ignore_events()) return;
1787 1790
1788 HandleScope scope(isolate_); 1791 HandleScope scope(isolate_);
1789 DebugScope debug_scope(this); 1792 DebugScope debug_scope(this);
1790 if (debug_scope.failed()) return; 1793 if (debug_scope.failed()) return;
1791 1794
1792 // Create the script collected state object. 1795 // Create the script collected state object.
1793 Handle<Object> event_data; 1796 Handle<Object> event_data;
1794 // Bail out and don't call debugger if exception. 1797 // Bail out and don't call debugger if exception.
1795 if (!MakeAsyncTaskEvent(data).ToHandle(&event_data)) return; 1798 if (!MakeAsyncTaskEvent(type, id, name).ToHandle(&event_data)) return;
1796 1799
1797 // Process debug event. 1800 // Process debug event.
1798 ProcessDebugEvent(v8::AsyncTaskEvent, 1801 ProcessDebugEvent(v8::AsyncTaskEvent,
1799 Handle<JSObject>::cast(event_data), 1802 Handle<JSObject>::cast(event_data),
1800 true); 1803 true);
1801 } 1804 }
1802 1805
1803 1806
1804 void Debug::ProcessDebugEvent(v8::DebugEvent event, 1807 void Debug::ProcessDebugEvent(v8::DebugEvent event,
1805 Handle<JSObject> event_data, 1808 Handle<JSObject> event_data,
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
2558 } 2561 }
2559 2562
2560 2563
2561 void LockingCommandMessageQueue::Clear() { 2564 void LockingCommandMessageQueue::Clear() {
2562 base::LockGuard<base::Mutex> lock_guard(&mutex_); 2565 base::LockGuard<base::Mutex> lock_guard(&mutex_);
2563 queue_.Clear(); 2566 queue_.Clear();
2564 } 2567 }
2565 2568
2566 } // namespace internal 2569 } // namespace internal
2567 } // namespace v8 2570 } // namespace v8
OLDNEW
« no previous file with comments | « src/debug/debug.h ('k') | src/debug/debug.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698