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 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "api.h" | 7 #include "api.h" |
8 #include "arguments.h" | 8 #include "arguments.h" |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "code-stubs.h" | 10 #include "code-stubs.h" |
(...skipping 2667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2678 exception, uncaught, promise).ToHandle(&event_data)) { | 2678 exception, uncaught, promise).ToHandle(&event_data)) { |
2679 return; | 2679 return; |
2680 } | 2680 } |
2681 | 2681 |
2682 // Process debug event. | 2682 // Process debug event. |
2683 ProcessDebugEvent(event, Handle<JSObject>::cast(event_data), false); | 2683 ProcessDebugEvent(event, Handle<JSObject>::cast(event_data), false); |
2684 // Return to continue execution from where the exception was thrown. | 2684 // Return to continue execution from where the exception was thrown. |
2685 } | 2685 } |
2686 | 2686 |
2687 | 2687 |
2688 void Debugger::OnSyntaxError(Handle<Script> script) { | |
2689 HandleScope scope(isolate_); | |
2690 Debug* debug = isolate_->debug(); | |
2691 | |
2692 // No more to do if not debugging. | |
2693 if (!IsDebuggerActive()) return; | |
2694 | |
2695 // No compile events while compiling natives. | |
2696 if (compiling_natives()) return; | |
2697 | |
2698 // Store whether in debugger before entering debugger. | |
2699 bool in_debugger = debug->InDebugger(); | |
2700 | |
2701 // Enter the debugger. | |
2702 EnterDebugger debugger(isolate_); | |
2703 if (debugger.FailedToEnter()) return; | |
2704 | |
2705 // Save breakpoints or not, if SyntaxError ocured? | |
vsevik
2014/06/06 16:12:01
I don't think we should care about breakpoints in
| |
2706 | |
2707 // If debugging there might be script break points registered for this | |
2708 // script. Make sure that these break points are set. | |
2709 | |
2710 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js). | |
2711 Handle<String> update_script_break_points_string = | |
2712 isolate_->factory()->InternalizeOneByteString( | |
2713 STATIC_ASCII_VECTOR("UpdateScriptBreakPoints")); | |
2714 Handle<GlobalObject> debug_global(debug->debug_context()->global_object()); | |
2715 Handle<Object> update_script_break_points = | |
2716 Object::GetProperty( | |
2717 debug_global, update_script_break_points_string).ToHandleChecked(); | |
2718 if (!update_script_break_points->IsJSFunction()) { | |
2719 return; | |
2720 } | |
2721 ASSERT(update_script_break_points->IsJSFunction()); | |
2722 | |
2723 // Wrap the script object in a proper JS object before passing it | |
2724 // to JavaScript. | |
2725 Handle<Object> wrapper = Script::GetWrapper(script); | |
2726 | |
2727 // Call UpdateScriptBreakPoints expect no exceptions. | |
2728 Handle<Object> argv[] = { wrapper }; | |
2729 if (Execution::TryCall(Handle<JSFunction>::cast(update_script_break_points), | |
2730 isolate_->js_builtins_object(), | |
2731 ARRAY_SIZE(argv), | |
2732 argv).is_null()) { | |
2733 return; | |
2734 } | |
2735 // Bail out based on state or if there is no listener for this event | |
2736 if (!Debugger::EventActive(v8::AfterCompile)) return; | |
2737 | |
2738 // Create the compile state object. | |
2739 Handle<Object> event_data; | |
2740 // Bail out and don't call debugger if exception. | |
2741 if (!MakeCompileEvent(script, false).ToHandle(&event_data)) return; | |
2742 | |
2743 // Process debug event. | |
2744 ProcessDebugEvent(v8::ScriptFailedToParse, | |
2745 Handle<JSObject>::cast(event_data), true); | |
2746 } | |
2747 | |
2748 | |
2688 void Debugger::OnDebugBreak(Handle<Object> break_points_hit, | 2749 void Debugger::OnDebugBreak(Handle<Object> break_points_hit, |
2689 bool auto_continue) { | 2750 bool auto_continue) { |
2690 HandleScope scope(isolate_); | 2751 HandleScope scope(isolate_); |
2691 | 2752 |
2692 // Debugger has already been entered by caller. | 2753 // Debugger has already been entered by caller. |
2693 ASSERT(isolate_->context() == *isolate_->debug()->debug_context()); | 2754 ASSERT(isolate_->context() == *isolate_->debug()->debug_context()); |
2694 | 2755 |
2695 // Bail out if there is no listener for this event | 2756 // Bail out if there is no listener for this event |
2696 if (!Debugger::EventActive(v8::Break)) return; | 2757 if (!Debugger::EventActive(v8::Break)) return; |
2697 | 2758 |
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3720 already_signalled_ = false; | 3781 already_signalled_ = false; |
3721 } | 3782 } |
3722 { | 3783 { |
3723 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); | 3784 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); |
3724 isolate_->debugger()->CallMessageDispatchHandler(); | 3785 isolate_->debugger()->CallMessageDispatchHandler(); |
3725 } | 3786 } |
3726 } | 3787 } |
3727 } | 3788 } |
3728 | 3789 |
3729 } } // namespace v8::internal | 3790 } } // namespace v8::internal |
OLD | NEW |