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

Side by Side Diff: src/debug.cc

Issue 352583008: Rollback to Version 3.28.4 (based on bleeding_edge revision r22031) (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 6 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « src/debug.h ('k') | src/debug-debugger.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 2536 matching lines...) Expand 10 before | Expand all | Expand 10 after
2547 // Create the new exception event object. 2547 // Create the new exception event object.
2548 Handle<Object> argv[] = { isolate_->factory()->NewNumberFromInt(break_id()), 2548 Handle<Object> argv[] = { isolate_->factory()->NewNumberFromInt(break_id()),
2549 exception, 2549 exception,
2550 isolate_->factory()->ToBoolean(uncaught), 2550 isolate_->factory()->ToBoolean(uncaught),
2551 promise }; 2551 promise };
2552 return MakeJSObject("MakeExceptionEvent", ARRAY_SIZE(argv), argv); 2552 return MakeJSObject("MakeExceptionEvent", ARRAY_SIZE(argv), argv);
2553 } 2553 }
2554 2554
2555 2555
2556 MaybeHandle<Object> Debug::MakeCompileEvent(Handle<Script> script, 2556 MaybeHandle<Object> Debug::MakeCompileEvent(Handle<Script> script,
2557 v8::DebugEvent type) { 2557 bool before) {
2558 // Create the compile event object. 2558 // Create the compile event object.
2559 Handle<Object> script_wrapper = Script::GetWrapper(script); 2559 Handle<Object> script_wrapper = Script::GetWrapper(script);
2560 Handle<Object> argv[] = { script_wrapper, 2560 Handle<Object> argv[] = { script_wrapper,
2561 isolate_->factory()->NewNumberFromInt(type) }; 2561 isolate_->factory()->ToBoolean(before) };
2562 return MakeJSObject("MakeCompileEvent", ARRAY_SIZE(argv), argv); 2562 return MakeJSObject("MakeCompileEvent", ARRAY_SIZE(argv), argv);
2563 } 2563 }
2564 2564
2565 2565
2566 MaybeHandle<Object> Debug::MakeScriptCollectedEvent(int id) { 2566 MaybeHandle<Object> Debug::MakeScriptCollectedEvent(int id) {
2567 // Create the script collected event object. 2567 // Create the script collected event object.
2568 Handle<Object> id_object = Handle<Smi>(Smi::FromInt(id), isolate_); 2568 Handle<Object> id_object = Handle<Smi>(Smi::FromInt(id), isolate_);
2569 Handle<Object> argv[] = { id_object }; 2569 Handle<Object> argv[] = { id_object };
2570 return MakeJSObject("MakeScriptCollectedEvent", ARRAY_SIZE(argv), argv); 2570 return MakeJSObject("MakeScriptCollectedEvent", ARRAY_SIZE(argv), argv);
2571 } 2571 }
(...skipping 28 matching lines...) Expand all
2600 exception, uncaught, promise).ToHandle(&event_data)) { 2600 exception, uncaught, promise).ToHandle(&event_data)) {
2601 return; 2601 return;
2602 } 2602 }
2603 2603
2604 // Process debug event. 2604 // Process debug event.
2605 ProcessDebugEvent(v8::Exception, Handle<JSObject>::cast(event_data), false); 2605 ProcessDebugEvent(v8::Exception, Handle<JSObject>::cast(event_data), false);
2606 // Return to continue execution from where the exception was thrown. 2606 // Return to continue execution from where the exception was thrown.
2607 } 2607 }
2608 2608
2609 2609
2610 void Debug::OnCompileError(Handle<Script> script) {
2611 // No more to do if not debugging.
2612 if (in_debug_scope() || ignore_events()) return;
2613
2614 HandleScope scope(isolate_);
2615 DebugScope debug_scope(this);
2616 if (debug_scope.failed()) return;
2617
2618 // Create the compile state object.
2619 Handle<Object> event_data;
2620 // Bail out and don't call debugger if exception.
2621 if (!MakeCompileEvent(script, v8::CompileError).ToHandle(&event_data)) return;
2622
2623 // Process debug event.
2624 ProcessDebugEvent(v8::CompileError, Handle<JSObject>::cast(event_data), true);
2625 }
2626
2627
2628 void Debug::OnDebugBreak(Handle<Object> break_points_hit, 2610 void Debug::OnDebugBreak(Handle<Object> break_points_hit,
2629 bool auto_continue) { 2611 bool auto_continue) {
2630 // The caller provided for DebugScope. 2612 // The caller provided for DebugScope.
2631 AssertDebugContext(); 2613 AssertDebugContext();
2632 // Bail out if there is no listener for this event 2614 // Bail out if there is no listener for this event
2633 if (ignore_events()) return; 2615 if (ignore_events()) return;
2634 2616
2635 HandleScope scope(isolate_); 2617 HandleScope scope(isolate_);
2636 // Create the event data object. 2618 // Create the event data object.
2637 Handle<Object> event_data; 2619 Handle<Object> event_data;
(...skipping 10 matching lines...) Expand all
2648 void Debug::OnBeforeCompile(Handle<Script> script) { 2630 void Debug::OnBeforeCompile(Handle<Script> script) {
2649 if (in_debug_scope() || ignore_events()) return; 2631 if (in_debug_scope() || ignore_events()) return;
2650 2632
2651 HandleScope scope(isolate_); 2633 HandleScope scope(isolate_);
2652 DebugScope debug_scope(this); 2634 DebugScope debug_scope(this);
2653 if (debug_scope.failed()) return; 2635 if (debug_scope.failed()) return;
2654 2636
2655 // Create the event data object. 2637 // Create the event data object.
2656 Handle<Object> event_data; 2638 Handle<Object> event_data;
2657 // Bail out and don't call debugger if exception. 2639 // Bail out and don't call debugger if exception.
2658 if (!MakeCompileEvent(script, v8::BeforeCompile).ToHandle(&event_data)) 2640 if (!MakeCompileEvent(script, true).ToHandle(&event_data)) return;
2659 return;
2660 2641
2661 // Process debug event. 2642 // Process debug event.
2662 ProcessDebugEvent(v8::BeforeCompile, 2643 ProcessDebugEvent(v8::BeforeCompile,
2663 Handle<JSObject>::cast(event_data), 2644 Handle<JSObject>::cast(event_data),
2664 true); 2645 true);
2665 } 2646 }
2666 2647
2667 2648
2668 // Handle debugger actions when a new script is compiled. 2649 // Handle debugger actions when a new script is compiled.
2669 void Debug::OnAfterCompile(Handle<Script> script) { 2650 void Debug::OnAfterCompile(Handle<Script> script,
2651 AfterCompileFlags after_compile_flags) {
2670 // Add the newly compiled script to the script cache. 2652 // Add the newly compiled script to the script cache.
2671 if (script_cache_ != NULL) script_cache_->Add(script); 2653 if (script_cache_ != NULL) script_cache_->Add(script);
2672 2654
2673 // No more to do if not debugging. 2655 // No more to do if not debugging.
2674 if (in_debug_scope() || ignore_events()) return; 2656 if (in_debug_scope() || ignore_events()) return;
2675 2657
2676 HandleScope scope(isolate_); 2658 HandleScope scope(isolate_);
2659 // Store whether in debugger before entering debugger.
2660 bool was_in_scope = in_debug_scope();
2661
2677 DebugScope debug_scope(this); 2662 DebugScope debug_scope(this);
2678 if (debug_scope.failed()) return; 2663 if (debug_scope.failed()) return;
2679 2664
2680 // If debugging there might be script break points registered for this 2665 // If debugging there might be script break points registered for this
2681 // script. Make sure that these break points are set. 2666 // script. Make sure that these break points are set.
2682 2667
2683 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js). 2668 // Get the function UpdateScriptBreakPoints (defined in debug-debugger.js).
2684 Handle<String> update_script_break_points_string = 2669 Handle<String> update_script_break_points_string =
2685 isolate_->factory()->InternalizeOneByteString( 2670 isolate_->factory()->InternalizeOneByteString(
2686 STATIC_ASCII_VECTOR("UpdateScriptBreakPoints")); 2671 STATIC_ASCII_VECTOR("UpdateScriptBreakPoints"));
(...skipping 11 matching lines...) Expand all
2698 Handle<Object> wrapper = Script::GetWrapper(script); 2683 Handle<Object> wrapper = Script::GetWrapper(script);
2699 2684
2700 // Call UpdateScriptBreakPoints expect no exceptions. 2685 // Call UpdateScriptBreakPoints expect no exceptions.
2701 Handle<Object> argv[] = { wrapper }; 2686 Handle<Object> argv[] = { wrapper };
2702 if (Execution::TryCall(Handle<JSFunction>::cast(update_script_break_points), 2687 if (Execution::TryCall(Handle<JSFunction>::cast(update_script_break_points),
2703 isolate_->js_builtins_object(), 2688 isolate_->js_builtins_object(),
2704 ARRAY_SIZE(argv), 2689 ARRAY_SIZE(argv),
2705 argv).is_null()) { 2690 argv).is_null()) {
2706 return; 2691 return;
2707 } 2692 }
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;
2708 2695
2709 // Create the compile state object. 2696 // Create the compile state object.
2710 Handle<Object> event_data; 2697 Handle<Object> event_data;
2711 // Bail out and don't call debugger if exception. 2698 // Bail out and don't call debugger if exception.
2712 if (!MakeCompileEvent(script, v8::AfterCompile).ToHandle(&event_data)) return; 2699 if (!MakeCompileEvent(script, false).ToHandle(&event_data)) return;
2713 2700
2714 // Process debug event. 2701 // Process debug event.
2715 ProcessDebugEvent(v8::AfterCompile, Handle<JSObject>::cast(event_data), true); 2702 ProcessDebugEvent(v8::AfterCompile, Handle<JSObject>::cast(event_data), true);
2716 } 2703 }
2717 2704
2718 2705
2719 void Debug::OnScriptCollected(int id) { 2706 void Debug::OnScriptCollected(int id) {
2720 if (in_debug_scope() || ignore_events()) return; 2707 if (in_debug_scope() || ignore_events()) return;
2721 2708
2722 HandleScope scope(isolate_); 2709 HandleScope scope(isolate_);
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
3395 logger_->DebugEvent("Put", message.text()); 3382 logger_->DebugEvent("Put", message.text());
3396 } 3383 }
3397 3384
3398 3385
3399 void LockingCommandMessageQueue::Clear() { 3386 void LockingCommandMessageQueue::Clear() {
3400 LockGuard<Mutex> lock_guard(&mutex_); 3387 LockGuard<Mutex> lock_guard(&mutex_);
3401 queue_.Clear(); 3388 queue_.Clear();
3402 } 3389 }
3403 3390
3404 } } // namespace v8::internal 3391 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/debug.h ('k') | src/debug-debugger.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698