Reviewers: ulan,

Description:
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=u...@chromium.org

Please review this at https://codereview.chromium.org/325183003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+21, -15 lines):
  M src/debug.h
  M src/debug.cc
  M src/liveedit.h
  M src/liveedit.cc


Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index 03c91979e929e2bd3be49e9e6abfd30e78d04023..a710f0ba558694c7d5db3d2d1750239643145a97 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<DebugInfo> 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();
Index: src/debug.h
diff --git a/src/debug.h b/src/debug.h
index 5224d1c9a05d24aff4521e3b65f0f6df643a8803..7f9b1a2eb0297eaf502b85d4cb2ccb47759a6ae4 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<FixedArray> GetDebuggedFunctions();  // In test-debug.cc
Index: src/liveedit.cc
diff --git a/src/liveedit.cc b/src/liveedit.cc
index d802d0dd9d88978bcfaa56f696a660e2291ea12d..05bd550b65ed4d61f9cd9c980bab58ef76ef917e 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;
 }


Index: src/liveedit.h
diff --git a/src/liveedit.h b/src/liveedit.h
index 2293d1cbf5016231663d1bbfc5c790c857b72880..3465d886d776af703044a67166a1a0d8b63f8002 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<JSArray> GatherCompileInfo(
       Handle<Script> script,


--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to