From f9f632499701220b64d249d03d850738dafdb825 Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Tue, 3 Jun 2014 14:39:55 +0000 Subject: [PATCH] Rename EnterDebugger to DebugScope. R=ulan@chromium.org Review URL: https://codereview.chromium.org/300683005 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21647 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/debug.cc | 125 ++++++++++++++++++++++++++------------------------------- src/debug.h | 47 ++++++++++++---------- src/isolate.cc | 2 +- src/runtime.cc | 8 ++-- 4 files changed, 87 insertions(+), 95 deletions(-) diff --git a/src/debug.cc b/src/debug.cc index c741acd..03c9197 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -565,7 +565,7 @@ void Debug::ThreadInit() { thread_local_.step_into_fp_ = 0; thread_local_.step_out_fp_ = 0; // TODO(isolates): frames_are_dropped_? - thread_local_.debugger_entry_ = NULL; + thread_local_.current_debug_scope_ = NULL; thread_local_.restarter_frame_function_pointer_ = NULL; thread_local_.promise_on_stack_ = NULL; } @@ -894,8 +894,8 @@ void Debug::Break(Arguments args, JavaScriptFrame* frame) { if (break_disabled_) return; // Enter the debugger. - EnterDebugger debugger(isolate_); - if (debugger.FailedToEnter()) return; + DebugScope debug_scope(this); + if (debug_scope.failed()) return; // Postpone interrupt during breakpoint processing. PostponeInterruptsScope postpone(isolate_); @@ -1348,7 +1348,7 @@ void Debug::PrepareStep(StepAction step_action, PrepareForBreakPoints(); - ASSERT(is_entered()); + ASSERT(in_debug_scope()); // Remember this step action and count. thread_local_.last_step_action_ = step_action; @@ -2458,7 +2458,7 @@ bool Debug::IsDebugGlobal(GlobalObject* global) { void Debug::ClearMirrorCache() { PostponeInterruptsScope postpone(isolate_); HandleScope scope(isolate_); - ASSERT(isolate_->context() == *Debug::debug_context()); + AssertDebugContext(); Factory* factory = isolate_->factory(); JSObject::SetProperty(isolate_->global_object(), factory->NewStringFromAsciiChecked("next_handle_"), @@ -2514,7 +2514,7 @@ void Debug::AfterGarbageCollection() { MaybeHandle Debug::MakeJSObject(const char* constructor_name, int argc, Handle argv[]) { - ASSERT(isolate_->context() == *debug_context()); + AssertDebugContext(); // Create the execution state object. Handle constructor = Object::GetProperty( isolate_, isolate_->global_object(), constructor_name).ToHandleChecked(); @@ -2583,7 +2583,7 @@ MaybeHandle Debug::MakeScriptCollectedEvent(int id) { void Debug::OnException(Handle exception, bool uncaught) { - if (is_entered() || ignore_events()) return; + if (in_debug_scope() || ignore_events()) return; HandleScope scope(isolate_); Handle promise = GetPromiseForUncaughtException(); @@ -2598,9 +2598,8 @@ void Debug::OnException(Handle exception, bool uncaught) { if (!break_on_exception_) return; } - // Enter the debugger. - EnterDebugger debugger(isolate_); - if (debugger.FailedToEnter()) return; + DebugScope debug_scope(this); + if (debug_scope.failed()) return; // Clear all current stepping setup. ClearStepping(); @@ -2621,8 +2620,8 @@ void Debug::OnException(Handle exception, bool uncaught) { void Debug::OnDebugBreak(Handle break_points_hit, bool auto_continue) { - // Debugger has already been entered by caller. - ASSERT(isolate_->context() == *debug_context()); + // The caller provided for DebugScope. + AssertDebugContext(); // Bail out if there is no listener for this event if (ignore_events()) return; @@ -2640,12 +2639,11 @@ void Debug::OnDebugBreak(Handle break_points_hit, void Debug::OnBeforeCompile(Handle