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_H_ | 5 #ifndef V8_DEBUG_H_ |
6 #define V8_DEBUG_H_ | 6 #define V8_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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 void Put(const CommandMessage& message); | 326 void Put(const CommandMessage& message); |
327 void Clear(); | 327 void Clear(); |
328 private: | 328 private: |
329 Logger* logger_; | 329 Logger* logger_; |
330 CommandMessageQueue queue_; | 330 CommandMessageQueue queue_; |
331 mutable base::Mutex mutex_; | 331 mutable base::Mutex mutex_; |
332 DISALLOW_COPY_AND_ASSIGN(LockingCommandMessageQueue); | 332 DISALLOW_COPY_AND_ASSIGN(LockingCommandMessageQueue); |
333 }; | 333 }; |
334 | 334 |
335 | 335 |
336 class PromiseOnStack { | |
337 public: | |
338 PromiseOnStack(Isolate* isolate, PromiseOnStack* prev, | |
339 Handle<JSObject> getter); | |
340 ~PromiseOnStack(); | |
341 StackHandler* handler() { return handler_; } | |
342 Handle<JSObject> promise() { return promise_; } | |
343 PromiseOnStack* prev() { return prev_; } | |
344 private: | |
345 Isolate* isolate_; | |
346 StackHandler* handler_; | |
347 Handle<JSObject> promise_; | |
348 PromiseOnStack* prev_; | |
349 }; | |
350 | |
351 | |
352 // This class contains the debugger support. The main purpose is to handle | 336 // This class contains the debugger support. The main purpose is to handle |
353 // setting break points in the code. | 337 // setting break points in the code. |
354 // | 338 // |
355 // This class controls the debug info for all functions which currently have | 339 // This class controls the debug info for all functions which currently have |
356 // active breakpoints in them. This debug info is held in the heap root object | 340 // active breakpoints in them. This debug info is held in the heap root object |
357 // debug_info which is a FixedArray. Each entry in this list is of class | 341 // debug_info which is a FixedArray. Each entry in this list is of class |
358 // DebugInfo. | 342 // DebugInfo. |
359 class Debug { | 343 class Debug { |
360 public: | 344 public: |
361 // Debug event triggers. | 345 // Debug event triggers. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 static Handle<Object> GetSourceBreakLocations( | 429 static Handle<Object> GetSourceBreakLocations( |
446 Handle<SharedFunctionInfo> shared, | 430 Handle<SharedFunctionInfo> shared, |
447 BreakPositionAlignment position_aligment); | 431 BreakPositionAlignment position_aligment); |
448 | 432 |
449 // Check whether a global object is the debug global object. | 433 // Check whether a global object is the debug global object. |
450 bool IsDebugGlobal(GlobalObject* global); | 434 bool IsDebugGlobal(GlobalObject* global); |
451 | 435 |
452 // Check whether this frame is just about to return. | 436 // Check whether this frame is just about to return. |
453 bool IsBreakAtReturn(JavaScriptFrame* frame); | 437 bool IsBreakAtReturn(JavaScriptFrame* frame); |
454 | 438 |
455 // Promise handling. | |
456 // Push and pop a promise and the current try-catch handler. | |
457 void PushPromise(Handle<JSObject> promise); | |
458 void PopPromise(); | |
459 | |
460 // Support for LiveEdit | 439 // Support for LiveEdit |
461 void FramesHaveBeenDropped(StackFrame::Id new_break_frame_id, | 440 void FramesHaveBeenDropped(StackFrame::Id new_break_frame_id, |
462 LiveEdit::FrameDropMode mode, | 441 LiveEdit::FrameDropMode mode, |
463 Object** restarter_frame_function_pointer); | 442 Object** restarter_frame_function_pointer); |
464 | 443 |
465 // Passed to MakeWeak. | 444 // Passed to MakeWeak. |
466 static void HandleWeakDebugInfo( | 445 static void HandleWeakDebugInfo( |
467 const v8::WeakCallbackData<v8::Value, void>& data); | 446 const v8::WeakCallbackData<v8::Value, void>& data); |
468 | 447 |
469 // Threading support. | 448 // Threading support. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 Handle<Script> script, v8::DebugEvent type); | 523 Handle<Script> script, v8::DebugEvent type); |
545 MUST_USE_RESULT MaybeHandle<Object> MakePromiseEvent( | 524 MUST_USE_RESULT MaybeHandle<Object> MakePromiseEvent( |
546 Handle<JSObject> promise_event); | 525 Handle<JSObject> promise_event); |
547 MUST_USE_RESULT MaybeHandle<Object> MakeAsyncTaskEvent( | 526 MUST_USE_RESULT MaybeHandle<Object> MakeAsyncTaskEvent( |
548 Handle<JSObject> task_event); | 527 Handle<JSObject> task_event); |
549 | 528 |
550 // Mirror cache handling. | 529 // Mirror cache handling. |
551 void ClearMirrorCache(); | 530 void ClearMirrorCache(); |
552 | 531 |
553 // Returns a promise if the pushed try-catch handler matches the current one. | 532 // Returns a promise if the pushed try-catch handler matches the current one. |
554 Handle<Object> GetPromiseOnStackOnThrow(); | |
555 bool PromiseHasRejectHandler(Handle<JSObject> promise); | 533 bool PromiseHasRejectHandler(Handle<JSObject> promise); |
556 | 534 |
557 void CallEventCallback(v8::DebugEvent event, | 535 void CallEventCallback(v8::DebugEvent event, |
558 Handle<Object> exec_state, | 536 Handle<Object> exec_state, |
559 Handle<Object> event_data, | 537 Handle<Object> event_data, |
560 v8::Debug::ClientData* client_data); | 538 v8::Debug::ClientData* client_data); |
561 void ProcessDebugEvent(v8::DebugEvent event, | 539 void ProcessDebugEvent(v8::DebugEvent event, |
562 Handle<JSObject> event_data, | 540 Handle<JSObject> event_data, |
563 bool auto_continue); | 541 bool auto_continue); |
564 void NotifyMessageHandler(v8::DebugEvent event, | 542 void NotifyMessageHandler(v8::DebugEvent event, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 Address step_out_fp_; | 629 Address step_out_fp_; |
652 | 630 |
653 // Stores the way how LiveEdit has patched the stack. It is used when | 631 // Stores the way how LiveEdit has patched the stack. It is used when |
654 // debugger returns control back to user script. | 632 // debugger returns control back to user script. |
655 LiveEdit::FrameDropMode frame_drop_mode_; | 633 LiveEdit::FrameDropMode frame_drop_mode_; |
656 | 634 |
657 // When restarter frame is on stack, stores the address | 635 // When restarter frame is on stack, stores the address |
658 // of the pointer to function being restarted. Otherwise (most of the time) | 636 // of the pointer to function being restarted. Otherwise (most of the time) |
659 // stores NULL. This pointer is used with 'step in' implementation. | 637 // stores NULL. This pointer is used with 'step in' implementation. |
660 Object** restarter_frame_function_pointer_; | 638 Object** restarter_frame_function_pointer_; |
661 | |
662 // When a promise is being resolved, we may want to trigger a debug event | |
663 // if we catch a throw. For this purpose we remember the try-catch | |
664 // handler address that would catch the exception. We also hold onto a | |
665 // closure that returns a promise if the exception is considered uncaught. | |
666 // Due to the possibility of reentry we use a linked list. | |
667 PromiseOnStack* promise_on_stack_; | |
668 }; | 639 }; |
669 | 640 |
670 // Storage location for registers when handling debug break calls | 641 // Storage location for registers when handling debug break calls |
671 ThreadLocal thread_local_; | 642 ThreadLocal thread_local_; |
672 | 643 |
673 Isolate* isolate_; | 644 Isolate* isolate_; |
674 | 645 |
675 friend class Isolate; | 646 friend class Isolate; |
676 friend class DebugScope; | 647 friend class DebugScope; |
677 friend class DisableBreak; | 648 friend class DisableBreak; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 // several frames above. | 738 // several frames above. |
768 // There is no calling conventions here, because it never actually gets | 739 // There is no calling conventions here, because it never actually gets |
769 // called, it only gets returned to. | 740 // called, it only gets returned to. |
770 static void GenerateFrameDropperLiveEdit(MacroAssembler* masm); | 741 static void GenerateFrameDropperLiveEdit(MacroAssembler* masm); |
771 }; | 742 }; |
772 | 743 |
773 | 744 |
774 } } // namespace v8::internal | 745 } } // namespace v8::internal |
775 | 746 |
776 #endif // V8_DEBUG_H_ | 747 #endif // V8_DEBUG_H_ |
OLD | NEW |