From: vegorov@chromium.org Date: Thu, 5 Aug 2010 11:39:01 +0000 (+0000) Subject: Add RelocInfo::DEBUG_BREAK_SLOT to RelocInfo::kApplyMask on ia32/x64 to ensure that... X-Git-Tag: upstream/4.7.83~21412 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2ba27d2201d808a6e15e94b8204bf21d3226cca8;p=platform%2Fupstream%2Fv8.git 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 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5178 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/ia32/assembler-ia32.cc b/src/ia32/assembler-ia32.cc index e011237..6c830cb 100644 --- a/src/ia32/assembler-ia32.cc +++ b/src/ia32/assembler-ia32.cc @@ -158,7 +158,8 @@ void Displacement::init(Label* L, Type type) { 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() { diff --git a/src/x64/assembler-x64.cc b/src/x64/assembler-x64.cc index b62db14..d700cc5 100644 --- a/src/x64/assembler-x64.cc +++ b/src/x64/assembler-x64.cc @@ -2942,7 +2942,8 @@ bool Assembler::WriteRecordedPositions() { 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() { diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc index 5f8b826..5ffe362 100644 --- a/test/cctest/test-debug.cc +++ b/test/cctest/test-debug.cc @@ -1244,7 +1244,9 @@ TEST(GCDuringBreakPointProcessing) { // Call the function three times with different garbage collections in between // and make sure that the break point survives. -static void CallAndGC(v8::Local recv, v8::Local f) { +static void CallAndGC(v8::Local recv, + v8::Local f, + bool force_compaction) { break_point_hit_count = 0; for (int i = 0; i < 3; i++) { @@ -1258,15 +1260,14 @@ static void CallAndGC(v8::Local recv, v8::Local f) { 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,28 +1279,35 @@ TEST(BreakPointSurviveGC) { // 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. TEST(BreakPointThroughJavaScript) { break_point_hit_count = 0;