Revision: 5178
Author: [email protected]
Date: Thu Aug  5 04:39:01 2010
Log: Add RelocInfo::DEBUG_BREAK_SLOT to RelocInfo::kApplyMask on ia32/x64 to ensure that debug break slots get relocated correctly during compacting GC.

Review URL: http://codereview.chromium.org/3058048
http://code.google.com/p/v8/source/detail?r=5178

Modified:
 /branches/bleeding_edge/src/ia32/assembler-ia32.cc
 /branches/bleeding_edge/src/x64/assembler-x64.cc
 /branches/bleeding_edge/test/cctest/test-debug.cc

=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32.cc Tue Jul 13 06:06:33 2010 +++ /branches/bleeding_edge/src/ia32/assembler-ia32.cc Thu Aug 5 04:39:01 2010
@@ -158,7 +158,8 @@

 const int RelocInfo::kApplyMask =
   RelocInfo::kCodeTargetMask | 1 << RelocInfo::RUNTIME_ENTRY |
-    1 << RelocInfo::JS_RETURN | 1 << RelocInfo::INTERNAL_REFERENCE;
+    1 << RelocInfo::JS_RETURN | 1 << RelocInfo::INTERNAL_REFERENCE |
+    1 << RelocInfo::DEBUG_BREAK_SLOT;


 bool RelocInfo::IsCodedSpecially() {
=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64.cc Wed Jul 28 02:36:53 2010 +++ /branches/bleeding_edge/src/x64/assembler-x64.cc Thu Aug 5 04:39:01 2010
@@ -2942,7 +2942,8 @@

 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask |
                                   1 << RelocInfo::INTERNAL_REFERENCE |
-                                  1 << RelocInfo::JS_RETURN;
+                                  1 << RelocInfo::JS_RETURN |
+                                  1 << RelocInfo::DEBUG_BREAK_SLOT;


 bool RelocInfo::IsCodedSpecially() {
=======================================
--- /branches/bleeding_edge/test/cctest/test-debug.cc Wed Jul 28 06:02:03 2010 +++ /branches/bleeding_edge/test/cctest/test-debug.cc Thu Aug 5 04:39:01 2010
@@ -1244,7 +1244,9 @@

// Call the function three times with different garbage collections in between
 // and make sure that the break point survives.
-static void CallAndGC(v8::Local<v8::Object> recv, v8::Local<v8::Function> f) {
+static void CallAndGC(v8::Local<v8::Object> recv,
+                      v8::Local<v8::Function> f,
+                      bool force_compaction) {
   break_point_hit_count = 0;

   for (int i = 0; i < 3; i++) {
@@ -1258,15 +1260,14 @@
     CHECK_EQ(2 + i * 3, break_point_hit_count);

     // Mark sweep (and perhaps compact) and call function.
-    Heap::CollectAllGarbage(false);
+    Heap::CollectAllGarbage(force_compaction);
     f->Call(recv, 0, NULL);
     CHECK_EQ(3 + i * 3, break_point_hit_count);
   }
 }


-// Test that a break point can be set at a return store location.
-TEST(BreakPointSurviveGC) {
+static void TestBreakPointSurviveGC(bool force_compaction) {
   break_point_hit_count = 0;
   v8::HandleScope scope;
   DebugLocalContext env;
@@ -1278,26 +1279,33 @@
   // Test IC store break point with garbage collection.
   foo = CompileFunction(&env, "function foo(){bar=0;}", "foo");
   SetBreakPoint(foo, 0);
-  CallAndGC(env->Global(), foo);
+  CallAndGC(env->Global(), foo, force_compaction);

   // Test IC load break point with garbage collection.
   foo = CompileFunction(&env, "bar=1;function foo(){var x=bar;}", "foo");
   SetBreakPoint(foo, 0);
-  CallAndGC(env->Global(), foo);
+  CallAndGC(env->Global(), foo, force_compaction);

   // Test IC call break point with garbage collection.
foo = CompileFunction(&env, "function bar(){};function foo(){bar();}", "foo");
   SetBreakPoint(foo, 0);
-  CallAndGC(env->Global(), foo);
+  CallAndGC(env->Global(), foo, force_compaction);

   // Test return break point with garbage collection.
   foo = CompileFunction(&env, "function foo(){}", "foo");
   SetBreakPoint(foo, 0);
-  CallAndGC(env->Global(), foo);
+  CallAndGC(env->Global(), foo, force_compaction);

   v8::Debug::SetDebugEventListener(NULL);
   CheckDebuggerUnloaded();
 }
+
+
+// Test that a break point can be set at a return store location.
+TEST(BreakPointSurviveGC) {
+  TestBreakPointSurviveGC(false);
+  TestBreakPointSurviveGC(true);
+}


 // Test that break points can be set using the global Debug object.

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

Reply via email to