Reviewers: Yang,

Message:
PTAL

Description:
Never clear debug-stub call ICs. Make a clear distinction between is_debug_stub
used everywhere but the debugger, and IsDebugBreak, used by the debugger.

Please review this at https://chromiumcodereview.appspot.com/23361014/

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

Affected files:
  M src/debug.cc
  M src/ic.cc
  M src/liveedit.cc
  M src/objects-inl.h
  M src/objects.h
  M src/runtime.h
  M src/runtime.cc
  A + test/mjsunit/regress/debug-prepare-step-in.js


Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index 4966713baabf7644a48a8de9591699645fc33d8e..990a9a5c7b8824f9f28c579d6db2989964381f8e 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -1627,7 +1627,7 @@ bool Debug::StepNextContinue(BreakLocationIterator* break_location_iterator,
 // object.
 bool Debug::IsDebugBreak(Address addr) {
   Code* code = Code::GetCodeFromTargetAddress(addr);
-  return code->is_debug_break();
+  return code->is_debug_stub() && code->extra_ic_state() == DEBUG_BREAK;
 }


Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index 7634ce93dad0dc1dde1ce80ff6496aa82be7ead1..cc7fee5468fd8ce4578b70ee8d8fa8c0db965919 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -379,7 +379,7 @@ void IC::Clear(Address address) {
   Code* target = GetTargetAtAddress(address);

// Don't clear debug break inline cache as it will remove the break point.
-  if (target->is_debug_break()) return;
+  if (target->is_debug_stub()) return;

   switch (target->kind()) {
     case Code::LOAD_IC: return LoadIC::Clear(address, target);
Index: src/liveedit.cc
diff --git a/src/liveedit.cc b/src/liveedit.cc
index 406510a3b867fbcc65586ce67d0b6b73b48d14b9..b260c81f844be5bef478ff3b63d44797663f5385 100644
--- a/src/liveedit.cc
+++ b/src/liveedit.cc
@@ -1691,7 +1691,7 @@ static const char* DropFrames(Vector<StackFrame*> frames,
   Code* pre_top_frame_code = pre_top_frame->LookupCode();
   bool frame_has_padding;
   if (pre_top_frame_code->is_inline_cache_stub() &&
-      pre_top_frame_code->is_debug_break()) {
+      pre_top_frame_code->is_debug_stub()) {
     // OK, we can drop inline cache calls.
     *mode = Debug::FRAME_DROPPED_IN_IC_CALL;
     frame_has_padding = Debug::FramePaddingLayout::kIsSupported;
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 6c1ecbb322ea00211813ba6c9584fcbf8a227b5b..4c74b10c814f37e43e4b54857af75a7efbd905c1 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -4084,8 +4084,8 @@ bool Code::is_inline_cache_stub() {
 }


-bool Code::is_debug_break() {
-  return ic_state() == DEBUG_STUB && extra_ic_state() == DEBUG_BREAK;
+bool Code::is_debug_stub() {
+  return ic_state() == DEBUG_STUB;
 }


Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 96b4011664bef5255601b653a0a664e1a7367551..ffd8584d56ab8336b48313dc5714945914d9a3de 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -4911,7 +4911,7 @@ class Code: public HeapObject {

   // Testers for IC stub kinds.
   inline bool is_inline_cache_stub();
-  inline bool is_debug_break();
+  inline bool is_debug_stub();
   inline bool is_load_stub() { return kind() == LOAD_IC; }
   inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; }
   inline bool is_store_stub() { return kind() == STORE_IC; }
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 057e268f7ad0e6ec9f830b449b7963a5eda30934..6311f4b0cb44ad5467947669094b65986cfdd4ff 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -14153,6 +14153,14 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FlattenString) {
 }


+RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyContextDisposed) {
+  HandleScope scope(isolate);
+  ASSERT(args.length() == 0);
+  isolate->heap()->NotifyContextDisposed();
+  return isolate->heap()->undefined_value();
+}
+
+
 RUNTIME_FUNCTION(MaybeObject*, Runtime_MigrateInstance) {
   HandleScope scope(isolate);
   ASSERT(args.length() == 1);
Index: src/runtime.h
diff --git a/src/runtime.h b/src/runtime.h
index 3d2f1c0fa7668a61faee42a18ba2cca9162a624d..a4924ecddcc8b6bcd6051029a4872b1205425c76 100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -111,6 +111,7 @@ namespace internal {
   F(DebugPrepareStepInIfStepping, 1, 1) \
   F(FlattenString, 1, 1) \
   F(MigrateInstance, 1, 1) \
+  F(NotifyContextDisposed, 0, 1) \
   \
   /* Array join support */ \
   F(PushIfAbsent, 2, 1) \
Index: test/mjsunit/regress/debug-prepare-step-in.js
diff --git a/test/mjsunit/function-source.js b/test/mjsunit/regress/debug-prepare-step-in.js
similarity index 79%
copy from test/mjsunit/function-source.js
copy to test/mjsunit/regress/debug-prepare-step-in.js
index 8f2fc2265c364ed4d779057a96acc62518e306a2..b8c21164000bd9df01024fdfad6225c1bd217d3d 100644
--- a/test/mjsunit/function-source.js
+++ b/test/mjsunit/regress/debug-prepare-step-in.js
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2013 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -25,25 +25,30 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-// Flags: --expose-debug-as debug
+// Flags: --expose-debug-as debug --allow-natives-syntax --expose-gc
 // Get the Debug object exposed from the debug context global object.
 Debug = debug.Debug

-// Check that the script source for all functions in a script is the same.
-function f() {
-  function h() {
-    assertEquals(Debug.scriptSource(f), Debug.scriptSource(h));
-  }
-  h();
+function breakListener(event, exec_state, event_data, data) {
+  exec_state.prepareStep(Debug.StepAction.StepIn, 1);
 }

+Debug.setListener(breakListener);
+
+var o = {x:function() { return 10; }};
+
+function f(o) {
+  var m = "x";
+  o[m]();
+}
+
+Debug.setBreakPoint(f, 2, 0);
+
+f(o);
+
+%NotifyContextDisposed();
 function g() {
-  function h() {
-    assertEquals(Debug.scriptSource(f), Debug.scriptSource(h));
-  }
-  h();
+  gc();
 }

-assertEquals(Debug.scriptSource(f), Debug.scriptSource(g));
-f();
 g();


--
--
v8-dev mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to