From 223e831acf8ac845e3d71c8e9edca582a913648f Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Wed, 11 Jun 2014 13:40:18 +0000 Subject: [PATCH] Ignore live_edit_ flag when when dealing with LiveEdit in a debug break. LiveEdit maybe disabled when we enter the break and again when we leave it, but enabled in between. TEST=https://codereview.chromium.org/329533002 R=ulan@chromium.org Review URL: https://codereview.chromium.org/325183003 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21770 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/debug.cc | 13 +++++-------- src/debug.h | 1 + src/liveedit.cc | 18 ++++++++++++------ src/liveedit.h | 4 +++- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/debug.cc b/src/debug.cc index 03c91979e..a710f0ba5 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -886,9 +886,8 @@ void Debug::Break(Arguments args, JavaScriptFrame* frame) { HandleScope scope(isolate_); ASSERT(args.length() == 0); - if (live_edit_enabled()) { - thread_local_.frame_drop_mode_ = LiveEdit::FRAMES_UNTOUCHED; - } + // Initialize LiveEdit. + LiveEdit::InitializeThreadLocal(this); // Just continue if breaks are disabled or debugger cannot be loaded. if (break_disabled_) return; @@ -2307,11 +2306,9 @@ void Debug::RemoveDebugInfo(Handle debug_info) { void Debug::SetAfterBreakTarget(JavaScriptFrame* frame) { - if (live_edit_enabled()) { - after_break_target_ = - LiveEdit::AfterBreakTarget(thread_local_.frame_drop_mode_, isolate_); - if (after_break_target_ != NULL) return; // LiveEdit did the job. - } + after_break_target_ = NULL; + + if (LiveEdit::SetAfterBreakTarget(this)) return; // LiveEdit did the job. HandleScope scope(isolate_); PrepareForBreakPoints(); diff --git a/src/debug.h b/src/debug.h index 5224d1c9a..7f9b1a2eb 100644 --- a/src/debug.h +++ b/src/debug.h @@ -674,6 +674,7 @@ class Debug { friend class Isolate; friend class DebugScope; friend class DisableBreak; + friend class LiveEdit; friend class SuppressDebug; friend Handle GetDebuggedFunctions(); // In test-debug.cc diff --git a/src/liveedit.cc b/src/liveedit.cc index d802d0dd9..05bd550b6 100644 --- a/src/liveedit.cc +++ b/src/liveedit.cc @@ -805,11 +805,17 @@ class FunctionInfoListener { }; -Address LiveEdit::AfterBreakTarget(FrameDropMode mode, Isolate* isolate) { +void LiveEdit::InitializeThreadLocal(Debug* debug) { + debug->thread_local_.frame_drop_mode_ = LiveEdit::FRAMES_UNTOUCHED; +} + + +bool LiveEdit::SetAfterBreakTarget(Debug* debug) { Code* code = NULL; - switch (mode) { + Isolate* isolate = debug->isolate_; + switch (debug->thread_local_.frame_drop_mode_) { case FRAMES_UNTOUCHED: - break; + return false; case FRAME_DROPPED_IN_IC_CALL: // We must have been calling IC stub. Do not go there anymore. code = isolate->builtins()->builtin(Builtins::kPlainReturn_LiveEdit); @@ -821,7 +827,7 @@ Address LiveEdit::AfterBreakTarget(FrameDropMode mode, Isolate* isolate) { break; case FRAME_DROPPED_IN_DIRECT_CALL: // Nothing to do, after_break_target is not used here. - break; + return true; case FRAME_DROPPED_IN_RETURN_CALL: code = isolate->builtins()->builtin(Builtins::kFrameDropper_LiveEdit); break; @@ -829,8 +835,8 @@ Address LiveEdit::AfterBreakTarget(FrameDropMode mode, Isolate* isolate) { UNREACHABLE(); break; } - if (code == NULL) return NULL; - return code->entry(); + debug->after_break_target_ = code->entry(); + return true; } diff --git a/src/liveedit.h b/src/liveedit.h index 2293d1cbf..3465d886d 100644 --- a/src/liveedit.h +++ b/src/liveedit.h @@ -74,7 +74,9 @@ class LiveEdit : AllStatic { CURRENTLY_SET_MODE }; - static Address AfterBreakTarget(FrameDropMode mode, Isolate* isolate); + static void InitializeThreadLocal(Debug* debug); + + static bool SetAfterBreakTarget(Debug* debug); MUST_USE_RESULT static MaybeHandle GatherCompileInfo( Handle