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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 // DebugInfo. | 401 // DebugInfo. |
401 class Debug { | 402 class Debug { |
402 public: | 403 public: |
403 // Debug event triggers. | 404 // Debug event triggers. |
404 void OnDebugBreak(Handle<Object> break_points_hit, bool auto_continue); | 405 void OnDebugBreak(Handle<Object> break_points_hit, bool auto_continue); |
405 | 406 |
406 void OnThrow(Handle<Object> exception); | 407 void OnThrow(Handle<Object> exception); |
407 void OnPromiseReject(Handle<Object> promise, Handle<Object> value); | 408 void OnPromiseReject(Handle<Object> promise, Handle<Object> value); |
408 void OnCompileError(Handle<Script> script); | 409 void OnCompileError(Handle<Script> script); |
409 void OnAfterCompile(Handle<Script> script); | 410 void OnAfterCompile(Handle<Script> script); |
410 void OnAsyncTaskEvent(Handle<String> type, Handle<Object> id, | 411 void OnAsyncTaskEvent(debug::AsyncTaskEventType, Handle<Object> id, |
411 Handle<String> name); | 412 Handle<String> name); |
412 | 413 |
413 // API facing. | 414 // API facing. |
414 void SetEventListener(Handle<Object> callback, Handle<Object> data); | 415 void SetEventListener(Handle<Object> callback, Handle<Object> data); |
415 void SetMessageHandler(v8::Debug::MessageHandler handler); | 416 void SetMessageHandler(v8::Debug::MessageHandler handler); |
416 void EnqueueCommandMessage(Vector<const uint16_t> command, | 417 void EnqueueCommandMessage(Vector<const uint16_t> command, |
417 v8::Debug::ClientData* client_data = NULL); | 418 v8::Debug::ClientData* client_data = NULL); |
418 MUST_USE_RESULT MaybeHandle<Object> Call(Handle<Object> fun, | 419 MUST_USE_RESULT MaybeHandle<Object> Call(Handle<Object> fun, |
419 Handle<Object> data); | 420 Handle<Object> data); |
420 Handle<Context> GetDebugContext(); | 421 Handle<Context> GetDebugContext(); |
(...skipping 27 matching lines...) Expand all Loading... |
448 void PrepareStepOnThrow(); | 449 void PrepareStepOnThrow(); |
449 void ClearStepping(); | 450 void ClearStepping(); |
450 void ClearStepOut(); | 451 void ClearStepOut(); |
451 | 452 |
452 bool PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared); | 453 bool PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared); |
453 bool GetPossibleBreakpoints(Handle<Script> script, int start_position, | 454 bool GetPossibleBreakpoints(Handle<Script> script, int start_position, |
454 int end_position, std::set<int>* positions); | 455 int end_position, std::set<int>* positions); |
455 | 456 |
456 void RecordGenerator(Handle<JSGeneratorObject> generator_object); | 457 void RecordGenerator(Handle<JSGeneratorObject> generator_object); |
457 | 458 |
| 459 Handle<Object> NextAsyncTaskId(Handle<JSObject> promise); |
| 460 |
458 // Returns whether the operation succeeded. Compilation can only be triggered | 461 // Returns whether the operation succeeded. Compilation can only be triggered |
459 // if a valid closure is passed as the second argument, otherwise the shared | 462 // if a valid closure is passed as the second argument, otherwise the shared |
460 // function needs to be compiled already. | 463 // function needs to be compiled already. |
461 bool EnsureDebugInfo(Handle<SharedFunctionInfo> shared, | 464 bool EnsureDebugInfo(Handle<SharedFunctionInfo> shared, |
462 Handle<JSFunction> function); | 465 Handle<JSFunction> function); |
463 void CreateDebugInfo(Handle<SharedFunctionInfo> shared); | 466 void CreateDebugInfo(Handle<SharedFunctionInfo> shared); |
464 static Handle<DebugInfo> GetDebugInfo(Handle<SharedFunctionInfo> shared); | 467 static Handle<DebugInfo> GetDebugInfo(Handle<SharedFunctionInfo> shared); |
465 | 468 |
466 template <typename C> | 469 template <typename C> |
467 bool CompileToRevealInnerFunctions(C* compilable); | 470 bool CompileToRevealInnerFunctions(C* compilable); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 // Constructors for debug event objects. | 580 // Constructors for debug event objects. |
578 MUST_USE_RESULT MaybeHandle<Object> MakeExecutionState(); | 581 MUST_USE_RESULT MaybeHandle<Object> MakeExecutionState(); |
579 MUST_USE_RESULT MaybeHandle<Object> MakeBreakEvent( | 582 MUST_USE_RESULT MaybeHandle<Object> MakeBreakEvent( |
580 Handle<Object> break_points_hit); | 583 Handle<Object> break_points_hit); |
581 MUST_USE_RESULT MaybeHandle<Object> MakeExceptionEvent( | 584 MUST_USE_RESULT MaybeHandle<Object> MakeExceptionEvent( |
582 Handle<Object> exception, | 585 Handle<Object> exception, |
583 bool uncaught, | 586 bool uncaught, |
584 Handle<Object> promise); | 587 Handle<Object> promise); |
585 MUST_USE_RESULT MaybeHandle<Object> MakeCompileEvent( | 588 MUST_USE_RESULT MaybeHandle<Object> MakeCompileEvent( |
586 Handle<Script> script, v8::DebugEvent type); | 589 Handle<Script> script, v8::DebugEvent type); |
587 MUST_USE_RESULT MaybeHandle<Object> MakeAsyncTaskEvent(Handle<String> type, | 590 MUST_USE_RESULT MaybeHandle<Object> MakeAsyncTaskEvent(Handle<Smi> type, |
588 Handle<Object> id, | 591 Handle<Object> id, |
589 Handle<String> name); | 592 Handle<String> name); |
590 | 593 |
591 // Mirror cache handling. | 594 // Mirror cache handling. |
592 void ClearMirrorCache(); | 595 void ClearMirrorCache(); |
593 | 596 |
594 void CallEventCallback(v8::DebugEvent event, | 597 void CallEventCallback(v8::DebugEvent event, |
595 Handle<Object> exec_state, | 598 Handle<Object> exec_state, |
596 Handle<Object> event_data, | 599 Handle<Object> event_data, |
597 v8::Debug::ClientData* client_data); | 600 v8::Debug::ClientData* client_data); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 | 698 |
696 // Stores the way how LiveEdit has patched the stack. It is used when | 699 // Stores the way how LiveEdit has patched the stack. It is used when |
697 // debugger returns control back to user script. | 700 // debugger returns control back to user script. |
698 LiveEditFrameDropMode frame_drop_mode_; | 701 LiveEditFrameDropMode frame_drop_mode_; |
699 | 702 |
700 // Value of accumulator in interpreter frames. In non-interpreter frames | 703 // Value of accumulator in interpreter frames. In non-interpreter frames |
701 // this value will be the hole. | 704 // this value will be the hole. |
702 Handle<Object> return_value_; | 705 Handle<Object> return_value_; |
703 | 706 |
704 Object* suspended_generator_; | 707 Object* suspended_generator_; |
| 708 |
| 709 int async_task_count_; |
| 710 Handle<JSWeakMap> async_task_ids_; |
705 }; | 711 }; |
706 | 712 |
707 // Storage location for registers when handling debug break calls | 713 // Storage location for registers when handling debug break calls |
708 ThreadLocal thread_local_; | 714 ThreadLocal thread_local_; |
709 | 715 |
710 Isolate* isolate_; | 716 Isolate* isolate_; |
711 | 717 |
712 friend class Isolate; | 718 friend class Isolate; |
713 friend class DebugScope; | 719 friend class DebugScope; |
714 friend class DisableBreak; | 720 friend class DisableBreak; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 Handle<Code> code); | 818 Handle<Code> code); |
813 static bool DebugBreakSlotIsPatched(Address pc); | 819 static bool DebugBreakSlotIsPatched(Address pc); |
814 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); | 820 static void ClearDebugBreakSlot(Isolate* isolate, Address pc); |
815 }; | 821 }; |
816 | 822 |
817 | 823 |
818 } // namespace internal | 824 } // namespace internal |
819 } // namespace v8 | 825 } // namespace v8 |
820 | 826 |
821 #endif // V8_DEBUG_DEBUG_H_ | 827 #endif // V8_DEBUG_DEBUG_H_ |
OLD | NEW |