| 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 #ifndef V8_DEBUG_DEBUG_H_ | 5 #ifndef V8_DEBUG_DEBUG_H_ |
| 6 #define V8_DEBUG_DEBUG_H_ | 6 #define V8_DEBUG_DEBUG_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
| 10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 460 |
| 461 bool PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared); | 461 bool PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared); |
| 462 bool GetPossibleBreakpoints(Handle<Script> script, int start_position, | 462 bool GetPossibleBreakpoints(Handle<Script> script, int start_position, |
| 463 int end_position, std::set<int>* positions); | 463 int end_position, std::set<int>* positions); |
| 464 | 464 |
| 465 void RecordGenerator(Handle<JSGeneratorObject> generator_object); | 465 void RecordGenerator(Handle<JSGeneratorObject> generator_object); |
| 466 | 466 |
| 467 int NextAsyncTaskId(Handle<JSObject> promise); | 467 int NextAsyncTaskId(Handle<JSObject> promise); |
| 468 | 468 |
| 469 void SetAsyncTaskListener(debug::AsyncTaskListener listener, void* data); | 469 void SetAsyncTaskListener(debug::AsyncTaskListener listener, void* data); |
| 470 void SetCompileEventListener(debug::CompileEventListener listener, |
| 471 void* data); |
| 470 | 472 |
| 471 // Returns whether the operation succeeded. Compilation can only be triggered | 473 // Returns whether the operation succeeded. Compilation can only be triggered |
| 472 // if a valid closure is passed as the second argument, otherwise the shared | 474 // if a valid closure is passed as the second argument, otherwise the shared |
| 473 // function needs to be compiled already. | 475 // function needs to be compiled already. |
| 474 bool EnsureDebugInfo(Handle<SharedFunctionInfo> shared, | 476 bool EnsureDebugInfo(Handle<SharedFunctionInfo> shared, |
| 475 Handle<JSFunction> function); | 477 Handle<JSFunction> function); |
| 476 void CreateDebugInfo(Handle<SharedFunctionInfo> shared); | 478 void CreateDebugInfo(Handle<SharedFunctionInfo> shared); |
| 477 static Handle<DebugInfo> GetDebugInfo(Handle<SharedFunctionInfo> shared); | 479 static Handle<DebugInfo> GetDebugInfo(Handle<SharedFunctionInfo> shared); |
| 478 | 480 |
| 479 template <typename C> | 481 template <typename C> |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 } | 590 } |
| 589 | 591 |
| 590 void clear_suspended_generator() { | 592 void clear_suspended_generator() { |
| 591 thread_local_.suspended_generator_ = Smi::kZero; | 593 thread_local_.suspended_generator_ = Smi::kZero; |
| 592 } | 594 } |
| 593 | 595 |
| 594 bool has_suspended_generator() const { | 596 bool has_suspended_generator() const { |
| 595 return thread_local_.suspended_generator_ != Smi::kZero; | 597 return thread_local_.suspended_generator_ != Smi::kZero; |
| 596 } | 598 } |
| 597 | 599 |
| 600 // There are three types of event listeners: C++ message_handler, |
| 601 // JavaScript event listener and C++ event listener. |
| 602 // Currently inspector still uses C++ event listener and installs |
| 603 // more specific event listeners for part of events. Calling of |
| 604 // C++ event listener is redundant when more specific event listener |
| 605 // is presented. Other clients can install JavaScript event listener |
| 606 // (e.g. some of NodeJS module). |
| 607 bool non_inspector_listener_exists() const { |
| 608 return message_handler_ != nullptr || |
| 609 (!event_listener_.is_null() && !event_listener_->IsForeign()); |
| 610 } |
| 611 |
| 598 void OnException(Handle<Object> exception, Handle<Object> promise); | 612 void OnException(Handle<Object> exception, Handle<Object> promise); |
| 599 | 613 |
| 600 // Constructors for debug event objects. | 614 // Constructors for debug event objects. |
| 601 MUST_USE_RESULT MaybeHandle<Object> MakeExecutionState(); | 615 MUST_USE_RESULT MaybeHandle<Object> MakeExecutionState(); |
| 602 MUST_USE_RESULT MaybeHandle<Object> MakeBreakEvent( | 616 MUST_USE_RESULT MaybeHandle<Object> MakeBreakEvent( |
| 603 Handle<Object> break_points_hit); | 617 Handle<Object> break_points_hit); |
| 604 MUST_USE_RESULT MaybeHandle<Object> MakeExceptionEvent( | 618 MUST_USE_RESULT MaybeHandle<Object> MakeExceptionEvent( |
| 605 Handle<Object> exception, | 619 Handle<Object> exception, |
| 606 bool uncaught, | 620 bool uncaught, |
| 607 Handle<Object> promise); | 621 Handle<Object> promise); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 | 674 |
| 661 // Global handles. | 675 // Global handles. |
| 662 Handle<Context> debug_context_; | 676 Handle<Context> debug_context_; |
| 663 Handle<Object> event_listener_; | 677 Handle<Object> event_listener_; |
| 664 Handle<Object> event_listener_data_; | 678 Handle<Object> event_listener_data_; |
| 665 | 679 |
| 666 v8::Debug::MessageHandler message_handler_; | 680 v8::Debug::MessageHandler message_handler_; |
| 667 | 681 |
| 668 debug::AsyncTaskListener async_task_listener_ = nullptr; | 682 debug::AsyncTaskListener async_task_listener_ = nullptr; |
| 669 void* async_task_listener_data_ = nullptr; | 683 void* async_task_listener_data_ = nullptr; |
| 684 debug::CompileEventListener compile_event_listener_ = nullptr; |
| 685 void* compile_event_listener_data_ = nullptr; |
| 670 | 686 |
| 671 static const int kQueueInitialSize = 4; | 687 static const int kQueueInitialSize = 4; |
| 672 base::Semaphore command_received_; // Signaled for each command received. | 688 base::Semaphore command_received_; // Signaled for each command received. |
| 673 LockingCommandMessageQueue command_queue_; | 689 LockingCommandMessageQueue command_queue_; |
| 674 | 690 |
| 675 // Debugger is active, i.e. there is a debug event listener attached. | 691 // Debugger is active, i.e. there is a debug event listener attached. |
| 676 bool is_active_; | 692 bool is_active_; |
| 677 // Debugger needs to be notified on every new function call. | 693 // Debugger needs to be notified on every new function call. |
| 678 // Used for stepping and read-only checks | 694 // Used for stepping and read-only checks |
| 679 bool hook_on_function_call_; | 695 bool hook_on_function_call_; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 Handle<Code> code); | 887 Handle<Code> code); |
| 872 static bool DebugBreakSlotIsPatched(Address pc); | 888 static bool DebugBreakSlotIsPatched(Address pc); |
| 873 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); | 889 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); |
| 874 }; | 890 }; |
| 875 | 891 |
| 876 | 892 |
| 877 } // namespace internal | 893 } // namespace internal |
| 878 } // namespace v8 | 894 } // namespace v8 |
| 879 | 895 |
| 880 #endif // V8_DEBUG_DEBUG_H_ | 896 #endif // V8_DEBUG_DEBUG_H_ |
| OLD | NEW |