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

Side by Side Diff: src/execution.cc

Issue 298863011: Merge the classes Debug and Debugger. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rename EnterDebugger Created 6 years, 7 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/execution.h ('k') | src/factory.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "execution.h" 5 #include "execution.h"
6 6
7 #include "bootstrapper.h" 7 #include "bootstrapper.h"
8 #include "codegen.h" 8 #include "codegen.h"
9 #include "deoptimizer.h" 9 #include "deoptimizer.h"
10 #include "isolate-inl.h" 10 #include "isolate-inl.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 #ifdef VERIFY_HEAP 97 #ifdef VERIFY_HEAP
98 value->ObjectVerify(); 98 value->ObjectVerify();
99 #endif 99 #endif
100 100
101 // Update the pending exception flag and return the value. 101 // Update the pending exception flag and return the value.
102 bool has_exception = value->IsException(); 102 bool has_exception = value->IsException();
103 ASSERT(has_exception == isolate->has_pending_exception()); 103 ASSERT(has_exception == isolate->has_pending_exception());
104 if (has_exception) { 104 if (has_exception) {
105 isolate->ReportPendingMessages(); 105 isolate->ReportPendingMessages();
106 // Reset stepping state when script exits with uncaught exception. 106 // Reset stepping state when script exits with uncaught exception.
107 if (isolate->debugger()->is_active()) { 107 if (isolate->debug()->is_active()) {
108 isolate->debug()->ClearStepping(); 108 isolate->debug()->ClearStepping();
109 } 109 }
110 return MaybeHandle<Object>(); 110 return MaybeHandle<Object>();
111 } else { 111 } else {
112 isolate->clear_pending_message(); 112 isolate->clear_pending_message();
113 } 113 }
114 114
115 return Handle<Object>(value, isolate); 115 return Handle<Object>(value, isolate);
116 } 116 }
117 117
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 args); 648 args);
649 Handle<Object> result; 649 Handle<Object> result;
650 if (!maybe_result.ToHandle(&result) || !result->IsString()) { 650 if (!maybe_result.ToHandle(&result) || !result->IsString()) {
651 return isolate->factory()->empty_string(); 651 return isolate->factory()->empty_string();
652 } 652 }
653 653
654 return Handle<String>::cast(result); 654 return Handle<String>::cast(result);
655 } 655 }
656 656
657 657
658 void Execution::DebugBreakHelper(Isolate* isolate) {
659 // Just continue if breaks are disabled.
660 if (isolate->debug()->disable_break()) return;
661
662 // Ignore debug break during bootstrapping.
663 if (isolate->bootstrapper()->IsActive()) return;
664
665 // Ignore debug break if debugger is not active.
666 if (!isolate->debugger()->is_active()) return;
667
668 StackLimitCheck check(isolate);
669 if (check.HasOverflowed()) return;
670
671 { JavaScriptFrameIterator it(isolate);
672 ASSERT(!it.done());
673 Object* fun = it.frame()->function();
674 if (fun && fun->IsJSFunction()) {
675 // Don't stop in builtin functions.
676 if (JSFunction::cast(fun)->IsBuiltin()) return;
677 GlobalObject* global = JSFunction::cast(fun)->context()->global_object();
678 // Don't stop in debugger functions.
679 if (isolate->debug()->IsDebugGlobal(global)) return;
680 }
681 }
682
683 // Collect the break state before clearing the flags.
684 bool debug_command_only = isolate->stack_guard()->CheckDebugCommand() &&
685 !isolate->stack_guard()->CheckDebugBreak();
686
687 isolate->stack_guard()->ClearDebugBreak();
688
689 Execution::ProcessDebugMessages(isolate, debug_command_only);
690 }
691
692
693 void Execution::ProcessDebugMessages(Isolate* isolate,
694 bool debug_command_only) {
695 isolate->stack_guard()->ClearDebugCommand();
696
697 StackLimitCheck check(isolate);
698 if (check.HasOverflowed()) return;
699
700 HandleScope scope(isolate);
701 // Enter the debugger. Just continue if we fail to enter the debugger.
702 EnterDebugger debugger(isolate);
703 if (debugger.FailedToEnter()) return;
704
705 // Notify the debug event listeners. Indicate auto continue if the break was
706 // a debug command break.
707 isolate->debugger()->OnDebugBreak(isolate->factory()->undefined_value(),
708 debug_command_only);
709 }
710
711
712 Object* StackGuard::HandleInterrupts() { 658 Object* StackGuard::HandleInterrupts() {
713 bool has_api_interrupt = false; 659 bool has_api_interrupt = false;
714 { 660 {
715 ExecutionAccess access(isolate_); 661 ExecutionAccess access(isolate_);
716 if (should_postpone_interrupts(access)) { 662 if (should_postpone_interrupts(access)) {
717 return isolate_->heap()->undefined_value(); 663 return isolate_->heap()->undefined_value();
718 } 664 }
719 665
720 if (CheckAndClearInterrupt(GC_REQUEST, access)) { 666 if (CheckAndClearInterrupt(GC_REQUEST, access)) {
721 isolate_->heap()->CollectAllGarbage(Heap::kNoGCFlags, "GC interrupt"); 667 isolate_->heap()->CollectAllGarbage(Heap::kNoGCFlags, "GC interrupt");
722 } 668 }
723 669
724 if (CheckDebugBreak() || CheckDebugCommand()) { 670 if (CheckDebugBreak() || CheckDebugCommand()) {
725 Execution::DebugBreakHelper(isolate_); 671 isolate_->debug()->HandleDebugBreak();
726 } 672 }
727 673
728 if (CheckAndClearInterrupt(TERMINATE_EXECUTION, access)) { 674 if (CheckAndClearInterrupt(TERMINATE_EXECUTION, access)) {
729 return isolate_->TerminateExecution(); 675 return isolate_->TerminateExecution();
730 } 676 }
731 677
732 if (CheckAndClearInterrupt(FULL_DEOPT, access)) { 678 if (CheckAndClearInterrupt(FULL_DEOPT, access)) {
733 Deoptimizer::DeoptimizeAll(isolate_); 679 Deoptimizer::DeoptimizeAll(isolate_);
734 } 680 }
735 681
(...skipping 15 matching lines...) Expand all
751 697
752 if (has_api_interrupt) { 698 if (has_api_interrupt) {
753 // Callback must be invoked outside of ExecusionAccess lock. 699 // Callback must be invoked outside of ExecusionAccess lock.
754 isolate_->InvokeApiInterruptCallback(); 700 isolate_->InvokeApiInterruptCallback();
755 } 701 }
756 702
757 return isolate_->heap()->undefined_value(); 703 return isolate_->heap()->undefined_value();
758 } 704 }
759 705
760 } } // namespace v8::internal 706 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/execution.h ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698