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 "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 2629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2640 if (!MakeCompileEvent(script, true).ToHandle(&event_data)) return; | 2640 if (!MakeCompileEvent(script, true).ToHandle(&event_data)) return; |
2641 | 2641 |
2642 // Process debug event. | 2642 // Process debug event. |
2643 ProcessDebugEvent(v8::BeforeCompile, | 2643 ProcessDebugEvent(v8::BeforeCompile, |
2644 Handle<JSObject>::cast(event_data), | 2644 Handle<JSObject>::cast(event_data), |
2645 true); | 2645 true); |
2646 } | 2646 } |
2647 | 2647 |
2648 | 2648 |
2649 // Handle debugger actions when a new script is compiled. | 2649 // Handle debugger actions when a new script is compiled. |
2650 void Debug::OnAfterCompile(Handle<Script> script, | 2650 void Debug::OnAfterCompile(Handle<Script> script) { |
2651 AfterCompileFlags after_compile_flags) { | |
2652 // Add the newly compiled script to the script cache. | 2651 // Add the newly compiled script to the script cache. |
2653 if (script_cache_ != NULL) script_cache_->Add(script); | 2652 if (script_cache_ != NULL) script_cache_->Add(script); |
2654 | 2653 |
2655 // No more to do if not debugging. | 2654 // No more to do if not debugging. |
2656 if (in_debug_scope() || ignore_events()) return; | 2655 if (in_debug_scope() || ignore_events()) return; |
2657 | 2656 |
2658 HandleScope scope(isolate_); | 2657 HandleScope scope(isolate_); |
2659 // Store whether in debugger before entering debugger. | |
2660 bool was_in_scope = in_debug_scope(); | |
2661 | |
2662 DebugScope debug_scope(this); | 2658 DebugScope debug_scope(this); |
2663 if (debug_scope.failed()) return; | 2659 if (debug_scope.failed()) return; |
2664 | 2660 |
2665 // If debugging there might be script break points registered for this | 2661 // If debugging there might be script break points registered for this |
2666 // script. Make sure that these break points are set. | 2662 // script. Make sure that these break points are set. |
2667 | 2663 |
2668 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js). | 2664 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js). |
2669 Handle<String> update_script_break_points_string = | 2665 Handle<String> update_script_break_points_string = |
2670 isolate_->factory()->InternalizeOneByteString( | 2666 isolate_->factory()->InternalizeOneByteString( |
2671 STATIC_ASCII_VECTOR("UpdateScriptBreakPoints")); | 2667 STATIC_ASCII_VECTOR("UpdateScriptBreakPoints")); |
(...skipping 11 matching lines...) Expand all Loading... |
2683 Handle<Object> wrapper = Script::GetWrapper(script); | 2679 Handle<Object> wrapper = Script::GetWrapper(script); |
2684 | 2680 |
2685 // Call UpdateScriptBreakPoints expect no exceptions. | 2681 // Call UpdateScriptBreakPoints expect no exceptions. |
2686 Handle<Object> argv[] = { wrapper }; | 2682 Handle<Object> argv[] = { wrapper }; |
2687 if (Execution::TryCall(Handle<JSFunction>::cast(update_script_break_points), | 2683 if (Execution::TryCall(Handle<JSFunction>::cast(update_script_break_points), |
2688 isolate_->js_builtins_object(), | 2684 isolate_->js_builtins_object(), |
2689 ARRAY_SIZE(argv), | 2685 ARRAY_SIZE(argv), |
2690 argv).is_null()) { | 2686 argv).is_null()) { |
2691 return; | 2687 return; |
2692 } | 2688 } |
2693 // Bail out based on state or if there is no listener for this event | |
2694 if (was_in_scope && (after_compile_flags & SEND_WHEN_DEBUGGING) == 0) return; | |
2695 | 2689 |
2696 // Create the compile state object. | 2690 // Create the compile state object. |
2697 Handle<Object> event_data; | 2691 Handle<Object> event_data; |
2698 // Bail out and don't call debugger if exception. | 2692 // Bail out and don't call debugger if exception. |
2699 if (!MakeCompileEvent(script, false).ToHandle(&event_data)) return; | 2693 if (!MakeCompileEvent(script, false).ToHandle(&event_data)) return; |
2700 | 2694 |
2701 // Process debug event. | 2695 // Process debug event. |
2702 ProcessDebugEvent(v8::AfterCompile, Handle<JSObject>::cast(event_data), true); | 2696 ProcessDebugEvent(v8::AfterCompile, Handle<JSObject>::cast(event_data), true); |
2703 } | 2697 } |
2704 | 2698 |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3382 logger_->DebugEvent("Put", message.text()); | 3376 logger_->DebugEvent("Put", message.text()); |
3383 } | 3377 } |
3384 | 3378 |
3385 | 3379 |
3386 void LockingCommandMessageQueue::Clear() { | 3380 void LockingCommandMessageQueue::Clear() { |
3387 LockGuard<Mutex> lock_guard(&mutex_); | 3381 LockGuard<Mutex> lock_guard(&mutex_); |
3388 queue_.Clear(); | 3382 queue_.Clear(); |
3389 } | 3383 } |
3390 | 3384 |
3391 } } // namespace v8::internal | 3385 } } // namespace v8::internal |
OLD | NEW |