Revision: 5349
Author: [email protected]
Date: Wed Aug 25 23:33:29 2010
Log: Merge r5333, r5336, r5341 to 2.2 branch

This fixes a bug in the handling of debug break in CallIC.
Review URL: http://codereview.chromium.org/3187024
http://code.google.com/p/v8/source/detail?r=5349

Modified:
 /branches/2.2/src/arm/debug-arm.cc
 /branches/2.2/src/ia32/debug-ia32.cc
 /branches/2.2/src/objects-inl.h
 /branches/2.2/src/version.cc
 /branches/2.2/src/x64/debug-x64.cc
 /branches/2.2/test/cctest/cctest.status
 /branches/2.2/test/cctest/test-debug.cc

=======================================
--- /branches/2.2/src/arm/debug-arm.cc  Wed Jun  9 02:38:56 2010
+++ /branches/2.2/src/arm/debug-arm.cc  Wed Aug 25 23:33:29 2010
@@ -225,16 +225,9 @@
 void Debug::GenerateCallICDebugBreak(MacroAssembler* masm) {
   // Calling convention for IC call (from ic-arm.cc)
   // ----------- S t a t e -------------
-  //  -- r0: number of arguments
-  //  -- r1: receiver
-  //  -- lr: return address
+  //  -- r2: name
   // -----------------------------------
- // Register r1 contains an object that needs to be pushed on the expression
-  // stack of the fake JS frame. r0 is the actual number of arguments not
- // encoded as a smi, therefore it cannot be on the expression stack of the - // fake JS frame as it can easily be an invalid pointer (e.g. 1). r0 will be
-  // pushed on the stack of the C frame and restored from there.
-  Generate_DebugBreakCallHelper(masm, r1.bit());
+  Generate_DebugBreakCallHelper(masm, r2.bit());
 }


=======================================
--- /branches/2.2/src/ia32/debug-ia32.cc        Wed Jun  9 02:38:56 2010
+++ /branches/2.2/src/ia32/debug-ia32.cc        Wed Aug 25 23:33:29 2010
@@ -183,8 +183,6 @@
   //  -- ecx    : key
   //  -- edx    : receiver
   // -----------------------------------
-  // Register eax contains an object that needs to be pushed on the
-  // expression stack of the fake JS frame.
Generate_DebugBreakCallHelper(masm, eax.bit() | ecx.bit() | edx.bit(), false);
 }

@@ -192,10 +190,9 @@
 void Debug::GenerateCallICDebugBreak(MacroAssembler* masm) {
   // Register state for keyed IC call call (from ic-ia32.cc)
   // ----------- S t a t e -------------
-  //  -- eax: number of arguments
+  //  -- ecx: name
   // -----------------------------------
-  // The number of arguments in eax is not smi encoded.
-  Generate_DebugBreakCallHelper(masm, 0, false);
+  Generate_DebugBreakCallHelper(masm, ecx.bit(), false);
 }


=======================================
--- /branches/2.2/src/objects-inl.h     Tue Jul 13 13:58:03 2010
+++ /branches/2.2/src/objects-inl.h     Wed Aug 25 23:33:29 2010
@@ -2863,7 +2863,7 @@

 bool Code::contains(byte* pc) {
   return (instruction_start() <= pc) &&
-      (pc < instruction_start() + instruction_size());
+      (pc <= instruction_start() + instruction_size());
 }


=======================================
--- /branches/2.2/src/version.cc        Wed Aug 18 00:28:48 2010
+++ /branches/2.2/src/version.cc        Wed Aug 25 23:33:29 2010
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     2
 #define MINOR_VERSION     2
 #define BUILD_NUMBER      24
-#define PATCH_LEVEL       16
+#define PATCH_LEVEL       17
 #define CANDIDATE_VERSION false

 // Define SONAME to have the SCons build the put a specific SONAME into the
=======================================
--- /branches/2.2/src/x64/debug-x64.cc  Wed Jun  9 02:38:56 2010
+++ /branches/2.2/src/x64/debug-x64.cc  Wed Aug 25 23:33:29 2010
@@ -100,12 +100,11 @@


 void Debug::GenerateCallICDebugBreak(MacroAssembler* masm) {
-  // Register state for keyed IC call call (from ic-x64.cc)
+  // Register state for IC call call (from ic-x64.cc)
   // ----------- S t a t e -------------
-  //  -- rax: number of arguments
+  //  -- rcx: function name
   // -----------------------------------
-  // The number of arguments in rax is not smi encoded.
-  Generate_DebugBreakCallHelper(masm, 0, false);
+  Generate_DebugBreakCallHelper(masm, rcx.bit(), false);
 }


=======================================
--- /branches/2.2/test/cctest/cctest.status     Wed Mar 24 01:21:20 2010
+++ /branches/2.2/test/cctest/cctest.status     Wed Aug 25 23:33:29 2010
@@ -54,6 +54,10 @@
 # BUG(355): Test crashes on ARM.
 test-log/ProfLazyMode: SKIP

+# BUG(845)
+test-debug/GCDuringBreakPointProcessing: SKIP
+test-debug/BreakPointICCallWithGC: SKIP
+
 [ $arch == mips ]
 test-accessors: SKIP
 test-alloc: SKIP
=======================================
--- /branches/2.2/test/cctest/test-debug.cc     Thu Aug  5 08:01:05 2010
+++ /branches/2.2/test/cctest/test-debug.cc     Wed Aug 25 23:33:29 2010
@@ -870,7 +870,7 @@
       Heap::CollectGarbage(0, v8::internal::NEW_SPACE);
     } else {
       // Mark sweep (and perhaps compact).
-      Heap::CollectAllGarbage(false);
+      Heap::CollectAllGarbage(true);
     }
   }
 }
@@ -1127,7 +1127,7 @@
   foo->Call(env->Global(), 0, NULL);
   CHECK_EQ(0, break_point_hit_count);

-  // Run with breakpoint
+  // Run with breakpoint.
   int bp = SetBreakPoint(foo, 0);
   foo->Call(env->Global(), 0, NULL);
   CHECK_EQ(1, break_point_hit_count);
@@ -1142,6 +1142,39 @@
   v8::Debug::SetDebugEventListener(NULL);
   CheckDebuggerUnloaded();
 }
+
+
+// Test that a break point can be set at an IC call location and survive a GC.
+TEST(BreakPointICCallWithGC) {
+  break_point_hit_count = 0;
+  v8::HandleScope scope;
+  DebugLocalContext env;
+  v8::Debug::SetDebugEventListener(DebugEventBreakPointCollectGarbage,
+                                   v8::Undefined());
+  v8::Script::Compile(v8::String::New("function bar(){return 1;}"))->Run();
+ v8::Script::Compile(v8::String::New("function foo(){return bar();}"))->Run();
+  v8::Local<v8::Function> foo =
+ v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo")));
+
+  // Run without breakpoints.
+  CHECK_EQ(1, foo->Call(env->Global(), 0, NULL)->Int32Value());
+  CHECK_EQ(0, break_point_hit_count);
+
+  // Run with breakpoint.
+  int bp = SetBreakPoint(foo, 0);
+  CHECK_EQ(1, foo->Call(env->Global(), 0, NULL)->Int32Value());
+  CHECK_EQ(1, break_point_hit_count);
+  CHECK_EQ(1, foo->Call(env->Global(), 0, NULL)->Int32Value());
+  CHECK_EQ(2, break_point_hit_count);
+
+  // Run without breakpoints.
+  ClearBreakPoint(bp);
+  foo->Call(env->Global(), 0, NULL);
+  CHECK_EQ(2, break_point_hit_count);
+
+  v8::Debug::SetDebugEventListener(NULL);
+  CheckDebuggerUnloaded();
+}


 // Test that a break point can be set at a return store location.

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to