| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 void Debug::Iterate(ObjectVisitor* v) { | 847 void Debug::Iterate(ObjectVisitor* v) { |
| 848 v->VisitPointer(BitCast<Object**, Code**>(&(debug_break_return_))); | 848 v->VisitPointer(BitCast<Object**, Code**>(&(debug_break_return_))); |
| 849 v->VisitPointer(BitCast<Object**, Code**>(&(debug_break_slot_))); | 849 v->VisitPointer(BitCast<Object**, Code**>(&(debug_break_slot_))); |
| 850 } | 850 } |
| 851 | 851 |
| 852 | 852 |
| 853 Object* Debug::Break(Arguments args) { | 853 Object* Debug::Break(Arguments args) { |
| 854 HandleScope scope; | 854 HandleScope scope; |
| 855 ASSERT(args.length() == 0); | 855 ASSERT(args.length() == 0); |
| 856 | 856 |
| 857 thread_local_.frames_are_dropped_ = false; | 857 thread_local_.frame_drop_mode_ = FRAMES_UNTOUCHED; |
| 858 | 858 |
| 859 // Get the top-most JavaScript frame. | 859 // Get the top-most JavaScript frame. |
| 860 JavaScriptFrameIterator it; | 860 JavaScriptFrameIterator it; |
| 861 JavaScriptFrame* frame = it.frame(); | 861 JavaScriptFrame* frame = it.frame(); |
| 862 | 862 |
| 863 // Just continue if breaks are disabled or debugger cannot be loaded. | 863 // Just continue if breaks are disabled or debugger cannot be loaded. |
| 864 if (disable_break() || !Load()) { | 864 if (disable_break() || !Load()) { |
| 865 SetAfterBreakTarget(frame); | 865 SetAfterBreakTarget(frame); |
| 866 return Heap::undefined_value(); | 866 return Heap::undefined_value(); |
| 867 } | 867 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 StepAction step_action = thread_local_.last_step_action_; | 925 StepAction step_action = thread_local_.last_step_action_; |
| 926 int step_count = thread_local_.step_count_; | 926 int step_count = thread_local_.step_count_; |
| 927 | 927 |
| 928 // Clear all current stepping setup. | 928 // Clear all current stepping setup. |
| 929 ClearStepping(); | 929 ClearStepping(); |
| 930 | 930 |
| 931 // Set up for the remaining steps. | 931 // Set up for the remaining steps. |
| 932 PrepareStep(step_action, step_count); | 932 PrepareStep(step_action, step_count); |
| 933 } | 933 } |
| 934 | 934 |
| 935 if (thread_local_.frames_are_dropped_) { | 935 if (thread_local_.frame_drop_mode_ == FRAMES_UNTOUCHED) { |
| 936 // We must have been calling IC stub. Do not return there anymore. | 936 SetAfterBreakTarget(frame); |
| 937 } else if (thread_local_.frame_drop_mode_ == FRAME_DROPPED_IN_IC_CALL) { |
| 938 // We must have been calling IC stub. Do not go there anymore. |
| 937 Code* plain_return = Builtins::builtin(Builtins::PlainReturn_LiveEdit); | 939 Code* plain_return = Builtins::builtin(Builtins::PlainReturn_LiveEdit); |
| 938 thread_local_.after_break_target_ = plain_return->entry(); | 940 thread_local_.after_break_target_ = plain_return->entry(); |
| 941 } else if (thread_local_.frame_drop_mode_ == |
| 942 FRAME_DROPPED_IN_DEBUG_SLOT_CALL) { |
| 943 // Debug break slot stub does not return normally, instead it manually |
| 944 // cleans the stack and jumps. We should patch the jump address. |
| 945 Code* plain_return = Builtins::builtin(Builtins::FrameDropper_LiveEdit); |
| 946 thread_local_.after_break_target_ = plain_return->entry(); |
| 947 } else if (thread_local_.frame_drop_mode_ == FRAME_DROPPED_IN_DIRECT_CALL) { |
| 948 // Nothing to do, after_break_target is not used here. |
| 939 } else { | 949 } else { |
| 940 SetAfterBreakTarget(frame); | 950 UNREACHABLE(); |
| 941 } | 951 } |
| 942 | 952 |
| 943 return Heap::undefined_value(); | 953 return Heap::undefined_value(); |
| 944 } | 954 } |
| 945 | 955 |
| 946 | 956 |
| 947 // Check the break point objects for whether one or more are actually | 957 // Check the break point objects for whether one or more are actually |
| 948 // triggered. This function returns a JSArray with the break point objects | 958 // triggered. This function returns a JSArray with the break point objects |
| 949 // which is triggered. | 959 // which is triggered. |
| 950 Handle<Object> Debug::CheckBreakPoints(Handle<Object> break_point_objects) { | 960 Handle<Object> Debug::CheckBreakPoints(Handle<Object> break_point_objects) { |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1742 if (RelocInfo::IsJSReturn(it.rinfo()->rmode())) { | 1752 if (RelocInfo::IsJSReturn(it.rinfo()->rmode())) { |
| 1743 return (it.rinfo()->pc() == | 1753 return (it.rinfo()->pc() == |
| 1744 addr - Assembler::kPatchReturnSequenceAddressOffset); | 1754 addr - Assembler::kPatchReturnSequenceAddressOffset); |
| 1745 } | 1755 } |
| 1746 it.next(); | 1756 it.next(); |
| 1747 } | 1757 } |
| 1748 return false; | 1758 return false; |
| 1749 } | 1759 } |
| 1750 | 1760 |
| 1751 | 1761 |
| 1752 void Debug::FramesHaveBeenDropped(StackFrame::Id new_break_frame_id) { | 1762 void Debug::FramesHaveBeenDropped(StackFrame::Id new_break_frame_id, |
| 1753 thread_local_.frames_are_dropped_ = true; | 1763 FrameDropMode mode) { |
| 1764 thread_local_.frame_drop_mode_ = mode; |
| 1754 thread_local_.break_frame_id_ = new_break_frame_id; | 1765 thread_local_.break_frame_id_ = new_break_frame_id; |
| 1755 } | 1766 } |
| 1756 | 1767 |
| 1757 | 1768 |
| 1758 bool Debug::IsDebugGlobal(GlobalObject* global) { | 1769 bool Debug::IsDebugGlobal(GlobalObject* global) { |
| 1759 return IsLoaded() && global == Debug::debug_context()->global(); | 1770 return IsLoaded() && global == Debug::debug_context()->global(); |
| 1760 } | 1771 } |
| 1761 | 1772 |
| 1762 | 1773 |
| 1763 void Debug::ClearMirrorCache() { | 1774 void Debug::ClearMirrorCache() { |
| (...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2922 { | 2933 { |
| 2923 Locker locker; | 2934 Locker locker; |
| 2924 Debugger::CallMessageDispatchHandler(); | 2935 Debugger::CallMessageDispatchHandler(); |
| 2925 } | 2936 } |
| 2926 } | 2937 } |
| 2927 } | 2938 } |
| 2928 | 2939 |
| 2929 #endif // ENABLE_DEBUGGER_SUPPORT | 2940 #endif // ENABLE_DEBUGGER_SUPPORT |
| 2930 | 2941 |
| 2931 } } // namespace v8::internal | 2942 } } // namespace v8::internal |
| OLD | NEW |