| 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" |
| 11 #include "src/base/atomicops.h" | 11 #include "src/base/atomicops.h" |
| 12 #include "src/base/hashmap.h" | 12 #include "src/base/hashmap.h" |
| 13 #include "src/base/platform/platform.h" | 13 #include "src/base/platform/platform.h" |
| 14 #include "src/debug/debug-interface.h" | 14 #include "src/debug/debug-interface.h" |
| 15 #include "src/debug/interface-types.h" |
| 15 #include "src/execution.h" | 16 #include "src/execution.h" |
| 16 #include "src/factory.h" | 17 #include "src/factory.h" |
| 17 #include "src/flags.h" | 18 #include "src/flags.h" |
| 18 #include "src/frames.h" | 19 #include "src/frames.h" |
| 19 #include "src/globals.h" | 20 #include "src/globals.h" |
| 20 #include "src/runtime/runtime.h" | 21 #include "src/runtime/runtime.h" |
| 21 #include "src/source-position-table.h" | 22 #include "src/source-position-table.h" |
| 22 #include "src/string-stream.h" | 23 #include "src/string-stream.h" |
| 23 #include "src/v8threads.h" | 24 #include "src/v8threads.h" |
| 24 | 25 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 74 |
| 74 const int kDebugPromiseNoID = 0; | 75 const int kDebugPromiseNoID = 0; |
| 75 const int kDebugPromiseFirstID = 1; | 76 const int kDebugPromiseFirstID = 1; |
| 76 | 77 |
| 77 enum PromiseDebugActionName { | 78 enum PromiseDebugActionName { |
| 78 kDebugNotActive, | 79 kDebugNotActive, |
| 79 kDebugAsyncFunction, | 80 kDebugAsyncFunction, |
| 80 kDebugPromiseResolve, | 81 kDebugPromiseResolve, |
| 81 kDebugPromiseReject, | 82 kDebugPromiseReject, |
| 82 kDebugPromiseResolveThenableJob, | 83 kDebugPromiseResolveThenableJob, |
| 83 }; | 84 kDebugPromiseCollected, |
| 84 | |
| 85 enum PromiseDebugActionType { | |
| 86 kDebugEnqueue, | |
| 87 kDebugEnqueueRecurring, | |
| 88 kDebugCancel, | |
| 89 kDebugWillHandle, | |
| 90 kDebugDidHandle, | |
| 91 }; | 85 }; |
| 92 | 86 |
| 93 class BreakLocation { | 87 class BreakLocation { |
| 94 public: | 88 public: |
| 95 static BreakLocation FromFrame(Handle<DebugInfo> debug_info, | 89 static BreakLocation FromFrame(Handle<DebugInfo> debug_info, |
| 96 JavaScriptFrame* frame); | 90 JavaScriptFrame* frame); |
| 97 | 91 |
| 98 static void AllAtCurrentStatement(Handle<DebugInfo> debug_info, | 92 static void AllAtCurrentStatement(Handle<DebugInfo> debug_info, |
| 99 JavaScriptFrame* frame, | 93 JavaScriptFrame* frame, |
| 100 List<BreakLocation>* result_out); | 94 List<BreakLocation>* result_out); |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 // DebugInfo. | 413 // DebugInfo. |
| 420 class Debug { | 414 class Debug { |
| 421 public: | 415 public: |
| 422 // Debug event triggers. | 416 // Debug event triggers. |
| 423 void OnDebugBreak(Handle<Object> break_points_hit, bool auto_continue); | 417 void OnDebugBreak(Handle<Object> break_points_hit, bool auto_continue); |
| 424 | 418 |
| 425 void OnThrow(Handle<Object> exception); | 419 void OnThrow(Handle<Object> exception); |
| 426 void OnPromiseReject(Handle<Object> promise, Handle<Object> value); | 420 void OnPromiseReject(Handle<Object> promise, Handle<Object> value); |
| 427 void OnCompileError(Handle<Script> script); | 421 void OnCompileError(Handle<Script> script); |
| 428 void OnAfterCompile(Handle<Script> script); | 422 void OnAfterCompile(Handle<Script> script); |
| 429 void OnAsyncTaskEvent(PromiseDebugActionType type, int id, | 423 void OnAsyncTaskEvent(debug::PromiseDebugActionType type, int id, |
| 430 PromiseDebugActionName name); | 424 PromiseDebugActionName name); |
| 431 | 425 |
| 432 // API facing. | 426 // API facing. |
| 433 void SetEventListener(Handle<Object> callback, Handle<Object> data); | 427 void SetEventListener(Handle<Object> callback, Handle<Object> data); |
| 434 void SetMessageHandler(v8::Debug::MessageHandler handler); | 428 void SetMessageHandler(v8::Debug::MessageHandler handler); |
| 435 void EnqueueCommandMessage(Vector<const uint16_t> command, | 429 void EnqueueCommandMessage(Vector<const uint16_t> command, |
| 436 v8::Debug::ClientData* client_data = NULL); | 430 v8::Debug::ClientData* client_data = NULL); |
| 437 MUST_USE_RESULT MaybeHandle<Object> Call(Handle<Object> fun, | 431 MUST_USE_RESULT MaybeHandle<Object> Call(Handle<Object> fun, |
| 438 Handle<Object> data); | 432 Handle<Object> data); |
| 439 Handle<Context> GetDebugContext(); | 433 Handle<Context> GetDebugContext(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 467 void PrepareStepOnThrow(); | 461 void PrepareStepOnThrow(); |
| 468 void ClearStepping(); | 462 void ClearStepping(); |
| 469 void ClearStepOut(); | 463 void ClearStepOut(); |
| 470 | 464 |
| 471 bool PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared); | 465 bool PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared); |
| 472 bool GetPossibleBreakpoints(Handle<Script> script, int start_position, | 466 bool GetPossibleBreakpoints(Handle<Script> script, int start_position, |
| 473 int end_position, std::set<int>* positions); | 467 int end_position, std::set<int>* positions); |
| 474 | 468 |
| 475 void RecordGenerator(Handle<JSGeneratorObject> generator_object); | 469 void RecordGenerator(Handle<JSGeneratorObject> generator_object); |
| 476 | 470 |
| 471 int NextAsyncTaskId(Handle<JSObject> promise); |
| 472 |
| 477 // Returns whether the operation succeeded. Compilation can only be triggered | 473 // Returns whether the operation succeeded. Compilation can only be triggered |
| 478 // 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 |
| 479 // function needs to be compiled already. | 475 // function needs to be compiled already. |
| 480 bool EnsureDebugInfo(Handle<SharedFunctionInfo> shared, | 476 bool EnsureDebugInfo(Handle<SharedFunctionInfo> shared, |
| 481 Handle<JSFunction> function); | 477 Handle<JSFunction> function); |
| 482 void CreateDebugInfo(Handle<SharedFunctionInfo> shared); | 478 void CreateDebugInfo(Handle<SharedFunctionInfo> shared); |
| 483 static Handle<DebugInfo> GetDebugInfo(Handle<SharedFunctionInfo> shared); | 479 static Handle<DebugInfo> GetDebugInfo(Handle<SharedFunctionInfo> shared); |
| 484 | 480 |
| 485 template <typename C> | 481 template <typename C> |
| 486 bool CompileToRevealInnerFunctions(C* compilable); | 482 bool CompileToRevealInnerFunctions(C* compilable); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 | 710 |
| 715 // Stores the way how LiveEdit has patched the stack. It is used when | 711 // Stores the way how LiveEdit has patched the stack. It is used when |
| 716 // debugger returns control back to user script. | 712 // debugger returns control back to user script. |
| 717 LiveEditFrameDropMode frame_drop_mode_; | 713 LiveEditFrameDropMode frame_drop_mode_; |
| 718 | 714 |
| 719 // Value of accumulator in interpreter frames. In non-interpreter frames | 715 // Value of accumulator in interpreter frames. In non-interpreter frames |
| 720 // this value will be the hole. | 716 // this value will be the hole. |
| 721 Handle<Object> return_value_; | 717 Handle<Object> return_value_; |
| 722 | 718 |
| 723 Object* suspended_generator_; | 719 Object* suspended_generator_; |
| 720 |
| 721 int async_task_count_; |
| 724 }; | 722 }; |
| 725 | 723 |
| 726 // Storage location for registers when handling debug break calls | 724 // Storage location for registers when handling debug break calls |
| 727 ThreadLocal thread_local_; | 725 ThreadLocal thread_local_; |
| 728 | 726 |
| 729 Isolate* isolate_; | 727 Isolate* isolate_; |
| 730 | 728 |
| 731 friend class Isolate; | 729 friend class Isolate; |
| 732 friend class DebugScope; | 730 friend class DebugScope; |
| 733 friend class DisableBreak; | 731 friend class DisableBreak; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 Handle<Code> code); | 829 Handle<Code> code); |
| 832 static bool DebugBreakSlotIsPatched(Address pc); | 830 static bool DebugBreakSlotIsPatched(Address pc); |
| 833 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); | 831 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); |
| 834 }; | 832 }; |
| 835 | 833 |
| 836 | 834 |
| 837 } // namespace internal | 835 } // namespace internal |
| 838 } // namespace v8 | 836 } // namespace v8 |
| 839 | 837 |
| 840 #endif // V8_DEBUG_DEBUG_H_ | 838 #endif // V8_DEBUG_DEBUG_H_ |
| OLD | NEW |