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

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: 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 2463 matching lines...) Expand 10 before | Expand all | Expand 10 after
2474 int offset = static_cast<int>( 2474 int offset = static_cast<int>(
2475 it.frame()->pc() - code->instruction_start()); 2475 it.frame()->pc() - code->instruction_start());
2476 script->set_eval_from_instructions_offset(Smi::FromInt(offset)); 2476 script->set_eval_from_instructions_offset(Smi::FromInt(offset));
2477 } 2477 }
2478 } 2478 }
2479 2479
2480 2480
2481 MaybeHandle<Object> Debug::MakeJSObject(const char* constructor_name, 2481 MaybeHandle<Object> Debug::MakeJSObject(const char* constructor_name,
2482 int argc, 2482 int argc,
2483 Handle<Object> argv[]) { 2483 Handle<Object> argv[]) {
2484 AssertDebugContext();
2485 // Create the execution state object. 2484 // Create the execution state object.
2486 Handle<GlobalObject> global(isolate_->global_object()); 2485 Handle<GlobalObject> global = in_debug_scope() ? Handle<GlobalObject>(debug_co ntext()->global_object()) : Handle<GlobalObject>(isolate_->global_object());
yurys 2014/12/08 07:19:28 This way we will create debugger objects in the us
kozy 2014/12/08 14:19:30 Done.
2487 Handle<Object> constructor = Object::GetProperty( 2486 Handle<Object> constructor = Object::GetProperty(
2488 isolate_, global, constructor_name).ToHandleChecked(); 2487 isolate_, global, constructor_name).ToHandleChecked();
2489 DCHECK(constructor->IsJSFunction()); 2488 DCHECK(constructor->IsJSFunction());
2490 if (!constructor->IsJSFunction()) return MaybeHandle<Object>(); 2489 if (!constructor->IsJSFunction()) return MaybeHandle<Object>();
2491 // We do not handle interrupts here. In particular, termination interrupts. 2490 // We do not handle interrupts here. In particular, termination interrupts.
2492 PostponeInterruptsScope no_interrupts(isolate_); 2491 PostponeInterruptsScope no_interrupts(isolate_);
2493 return Execution::TryCall(Handle<JSFunction>::cast(constructor), 2492 return Execution::TryCall(Handle<JSFunction>::cast(constructor),
2494 handle(debug_context()->global_proxy()), 2493 handle(debug_context()->global_proxy()),
2495 argc, 2494 argc,
2496 argv); 2495 argv);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 return; 2622 return;
2624 } 2623 }
2625 2624
2626 // Process debug event. 2625 // Process debug event.
2627 ProcessDebugEvent(v8::Exception, Handle<JSObject>::cast(event_data), false); 2626 ProcessDebugEvent(v8::Exception, Handle<JSObject>::cast(event_data), false);
2628 // Return to continue execution from where the exception was thrown. 2627 // Return to continue execution from where the exception was thrown.
2629 } 2628 }
2630 2629
2631 2630
2632 void Debug::OnCompileError(Handle<Script> script) { 2631 void Debug::OnCompileError(Handle<Script> script) {
2633 // No more to do if not debugging. 2632 if (ignore_events()) return;
2634 if (in_debug_scope() || ignore_events()) return; 2633
2634 if (in_debug_scope()) {
2635 ProcessCompileEventInDebugScope(v8::CompileError, script);
2636 return;
2637 }
2635 2638
2636 HandleScope scope(isolate_); 2639 HandleScope scope(isolate_);
2637 DebugScope debug_scope(this); 2640 DebugScope debug_scope(this);
2638 if (debug_scope.failed()) return; 2641 if (debug_scope.failed()) return;
2639 2642
2640 // Create the compile state object. 2643 // Create the compile state object.
2641 Handle<Object> event_data; 2644 Handle<Object> event_data;
2642 // Bail out and don't call debugger if exception. 2645 // Bail out and don't call debugger if exception.
2643 if (!MakeCompileEvent(script, v8::CompileError).ToHandle(&event_data)) return; 2646 if (!MakeCompileEvent(script, v8::CompileError).ToHandle(&event_data)) return;
2644 2647
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2685 Handle<JSObject>::cast(event_data), 2688 Handle<JSObject>::cast(event_data),
2686 true); 2689 true);
2687 } 2690 }
2688 2691
2689 2692
2690 // Handle debugger actions when a new script is compiled. 2693 // Handle debugger actions when a new script is compiled.
2691 void Debug::OnAfterCompile(Handle<Script> script) { 2694 void Debug::OnAfterCompile(Handle<Script> script) {
2692 // Add the newly compiled script to the script cache. 2695 // Add the newly compiled script to the script cache.
2693 if (script_cache_ != NULL) script_cache_->Add(script); 2696 if (script_cache_ != NULL) script_cache_->Add(script);
2694 2697
2695 // No more to do if not debugging. 2698 if (ignore_events()) return;
2696 if (in_debug_scope() || ignore_events()) return; 2699
2700 if (in_debug_scope()) {
2701 ProcessCompileEventInDebugScope(v8::AfterCompile, script);
2702 return;
2703 }
2697 2704
2698 HandleScope scope(isolate_); 2705 HandleScope scope(isolate_);
2699 DebugScope debug_scope(this); 2706 DebugScope debug_scope(this);
2700 if (debug_scope.failed()) return; 2707 if (debug_scope.failed()) return;
2701 2708
2702 // If debugging there might be script break points registered for this 2709 // If debugging there might be script break points registered for this
2703 // script. Make sure that these break points are set. 2710 // script. Make sure that these break points are set.
2704 2711
2705 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js). 2712 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js).
2706 Handle<String> update_script_break_points_string = 2713 Handle<String> update_script_break_points_string =
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
2841 event_data, 2848 event_data,
2842 event_listener_data_ }; 2849 event_listener_data_ };
2843 Handle<JSReceiver> global(isolate_->global_proxy()); 2850 Handle<JSReceiver> global(isolate_->global_proxy());
2844 Execution::TryCall(Handle<JSFunction>::cast(event_listener_), 2851 Execution::TryCall(Handle<JSFunction>::cast(event_listener_),
2845 global, arraysize(argv), argv); 2852 global, arraysize(argv), argv);
2846 } 2853 }
2847 in_debug_event_listener_ = previous; 2854 in_debug_event_listener_ = previous;
2848 } 2855 }
2849 2856
2850 2857
2858 void Debug::ProcessCompileEventInDebugScope(v8::DebugEvent event,
2859 Handle<Script> script) {
2860 if (event_listener_.is_null()) return;
yurys 2014/12/08 10:55:51 I believe you can reenter debug context here if it
kozy 2014/12/08 14:19:30 Done.
2861
2862 Handle<Object> event_data;
2863 // Bail out and don't call debugger if exception.
2864 if (!MakeCompileEvent(script, event).ToHandle(&event_data)) return;
2865
2866 // Create the execution state.
2867 Handle<Object> exec_state;
2868 // Bail out and don't call debugger if exception.
2869 if (!MakeExecutionState().ToHandle(&exec_state)) return;
2870
2871 CallEventCallback(event, exec_state, event_data, NULL);
2872 }
2873
2874
2851 Handle<Context> Debug::GetDebugContext() { 2875 Handle<Context> Debug::GetDebugContext() {
2852 DebugScope debug_scope(this); 2876 DebugScope debug_scope(this);
2853 // The global handle may be destroyed soon after. Return it reboxed. 2877 // The global handle may be destroyed soon after. Return it reboxed.
2854 return handle(*debug_context(), isolate_); 2878 return handle(*debug_context(), isolate_);
2855 } 2879 }
2856 2880
2857 2881
2858 void Debug::NotifyMessageHandler(v8::DebugEvent event, 2882 void Debug::NotifyMessageHandler(v8::DebugEvent event,
2859 Handle<JSObject> exec_state, 2883 Handle<JSObject> exec_state,
2860 Handle<JSObject> event_data, 2884 Handle<JSObject> event_data,
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
3445 logger_->DebugEvent("Put", message.text()); 3469 logger_->DebugEvent("Put", message.text());
3446 } 3470 }
3447 3471
3448 3472
3449 void LockingCommandMessageQueue::Clear() { 3473 void LockingCommandMessageQueue::Clear() {
3450 base::LockGuard<base::Mutex> lock_guard(&mutex_); 3474 base::LockGuard<base::Mutex> lock_guard(&mutex_);
3451 queue_.Clear(); 3475 queue_.Clear();
3452 } 3476 }
3453 3477
3454 } } // namespace v8::internal 3478 } } // 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