Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(863)

Side by Side Diff: src/debug.cc

Issue 781623004: [V8] Report v8::AfterCompile and v8::CompileError to listener on pause (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed tests Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/debug.h ('k') | test/mjsunit/debug-clearbreakpointgroup.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 return; 2623 return;
2624 } 2624 }
2625 2625
2626 // Process debug event. 2626 // Process debug event.
2627 ProcessDebugEvent(v8::Exception, Handle<JSObject>::cast(event_data), false); 2627 ProcessDebugEvent(v8::Exception, Handle<JSObject>::cast(event_data), false);
2628 // Return to continue execution from where the exception was thrown. 2628 // Return to continue execution from where the exception was thrown.
2629 } 2629 }
2630 2630
2631 2631
2632 void Debug::OnCompileError(Handle<Script> script) { 2632 void Debug::OnCompileError(Handle<Script> script) {
2633 // No more to do if not debugging. 2633 if (ignore_events()) return;
2634 if (in_debug_scope() || ignore_events()) return; 2634
2635 if (in_debug_scope()) {
2636 ProcessCompileEventInDebugScope(v8::CompileError, script);
2637 return;
2638 }
2635 2639
2636 HandleScope scope(isolate_); 2640 HandleScope scope(isolate_);
2637 DebugScope debug_scope(this); 2641 DebugScope debug_scope(this);
2638 if (debug_scope.failed()) return; 2642 if (debug_scope.failed()) return;
2639 2643
2640 // Create the compile state object. 2644 // Create the compile state object.
2641 Handle<Object> event_data; 2645 Handle<Object> event_data;
2642 // Bail out and don't call debugger if exception. 2646 // Bail out and don't call debugger if exception.
2643 if (!MakeCompileEvent(script, v8::CompileError).ToHandle(&event_data)) return; 2647 if (!MakeCompileEvent(script, v8::CompileError).ToHandle(&event_data)) return;
2644 2648
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2685 Handle<JSObject>::cast(event_data), 2689 Handle<JSObject>::cast(event_data),
2686 true); 2690 true);
2687 } 2691 }
2688 2692
2689 2693
2690 // Handle debugger actions when a new script is compiled. 2694 // Handle debugger actions when a new script is compiled.
2691 void Debug::OnAfterCompile(Handle<Script> script) { 2695 void Debug::OnAfterCompile(Handle<Script> script) {
2692 // Add the newly compiled script to the script cache. 2696 // Add the newly compiled script to the script cache.
2693 if (script_cache_ != NULL) script_cache_->Add(script); 2697 if (script_cache_ != NULL) script_cache_->Add(script);
2694 2698
2695 // No more to do if not debugging. 2699 if (ignore_events()) return;
2696 if (in_debug_scope() || ignore_events()) return; 2700
2701 if (in_debug_scope()) {
2702 ProcessCompileEventInDebugScope(v8::AfterCompile, script);
2703 return;
2704 }
2697 2705
2698 HandleScope scope(isolate_); 2706 HandleScope scope(isolate_);
2699 DebugScope debug_scope(this); 2707 DebugScope debug_scope(this);
2700 if (debug_scope.failed()) return; 2708 if (debug_scope.failed()) return;
2701 2709
2702 // If debugging there might be script break points registered for this 2710 // If debugging there might be script break points registered for this
2703 // script. Make sure that these break points are set. 2711 // script. Make sure that these break points are set.
2704 2712
2705 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js). 2713 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js).
2706 Handle<String> update_script_break_points_string = 2714 Handle<String> update_script_break_points_string =
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
2841 event_data, 2849 event_data,
2842 event_listener_data_ }; 2850 event_listener_data_ };
2843 Handle<JSReceiver> global(isolate_->global_proxy()); 2851 Handle<JSReceiver> global(isolate_->global_proxy());
2844 Execution::TryCall(Handle<JSFunction>::cast(event_listener_), 2852 Execution::TryCall(Handle<JSFunction>::cast(event_listener_),
2845 global, arraysize(argv), argv); 2853 global, arraysize(argv), argv);
2846 } 2854 }
2847 in_debug_event_listener_ = previous; 2855 in_debug_event_listener_ = previous;
2848 } 2856 }
2849 2857
2850 2858
2859 void Debug::ProcessCompileEventInDebugScope(v8::DebugEvent event,
2860 Handle<Script> script) {
2861 if (event_listener_.is_null()) return;
2862
2863 SuppressDebug while_processing(this);
2864 DebugScope debug_scope(this);
2865 if (debug_scope.failed()) return;
2866
2867 Handle<Object> event_data;
2868 // Bail out and don't call debugger if exception.
2869 if (!MakeCompileEvent(script, event).ToHandle(&event_data)) return;
2870
2871 // Create the execution state.
2872 Handle<Object> exec_state;
2873 // Bail out and don't call debugger if exception.
2874 if (!MakeExecutionState().ToHandle(&exec_state)) return;
2875
2876 CallEventCallback(event, exec_state, event_data, NULL);
2877 }
2878
2879
2851 Handle<Context> Debug::GetDebugContext() { 2880 Handle<Context> Debug::GetDebugContext() {
2852 DebugScope debug_scope(this); 2881 DebugScope debug_scope(this);
2853 // The global handle may be destroyed soon after. Return it reboxed. 2882 // The global handle may be destroyed soon after. Return it reboxed.
2854 return handle(*debug_context(), isolate_); 2883 return handle(*debug_context(), isolate_);
2855 } 2884 }
2856 2885
2857 2886
2858 void Debug::NotifyMessageHandler(v8::DebugEvent event, 2887 void Debug::NotifyMessageHandler(v8::DebugEvent event,
2859 Handle<JSObject> exec_state, 2888 Handle<JSObject> exec_state,
2860 Handle<JSObject> event_data, 2889 Handle<JSObject> event_data,
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
3445 logger_->DebugEvent("Put", message.text()); 3474 logger_->DebugEvent("Put", message.text());
3446 } 3475 }
3447 3476
3448 3477
3449 void LockingCommandMessageQueue::Clear() { 3478 void LockingCommandMessageQueue::Clear() {
3450 base::LockGuard<base::Mutex> lock_guard(&mutex_); 3479 base::LockGuard<base::Mutex> lock_guard(&mutex_);
3451 queue_.Clear(); 3480 queue_.Clear();
3452 } 3481 }
3453 3482
3454 } } // namespace v8::internal 3483 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/debug.h ('k') | test/mjsunit/debug-clearbreakpointgroup.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698