From: sgjesse@chromium.org Date: Tue, 17 Aug 2010 11:06:12 +0000 (+0000) Subject: Fix breakpoints on inlined named stores in code from the optimizing compiler X-Git-Tag: upstream/4.7.83~21344 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1c1f4161581e77a1c7936f9bbb3c83a293d89076;p=platform%2Fupstream%2Fv8.git Fix breakpoints on inlined named stores in code from the optimizing compiler Review URL: http://codereview.chromium.org/3164018 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5283 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/debug.cc b/src/debug.cc index c13c8c9..5809854 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -461,6 +461,8 @@ void BreakLocationIterator::SetDebugBreakAtIC() { KeyedStoreIC::ClearInlinedVersion(pc()); } else if (code->is_load_stub()) { LoadIC::ClearInlinedVersion(pc()); + } else if (code->is_store_stub()) { + StoreIC::ClearInlinedVersion(pc()); } } } diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc index 0455790..1e93bf5 100644 --- a/test/cctest/test-debug.cc +++ b/test/cctest/test-debug.cc @@ -2680,6 +2680,65 @@ TEST(DebugStepNamedLoadLoop) { } +static void DoDebugStepNamedStoreLoop(int expected, bool full_compiler = true) { + v8::HandleScope scope; + DebugLocalContext env; + + // Register a debug event listener which steps and counts before compiling the + // function to ensure the full compiler is used. + if (full_compiler) { + v8::Debug::SetDebugEventListener(DebugEventStep); + } + + // Create a function for testing stepping of named store. + v8::Local foo = CompileFunction( + &env, + "function foo() {\n" + " var a = {a:1};\n" + " for (var i = 0; i < 10; i++) {\n" + " a.a = 2\n" + " }\n" + "}\n", + "foo"); + + // Call function without any break points to ensure inlining is in place. + foo->Call(env->Global(), 0, NULL); + + // Register a debug event listener which steps and counts after compiling the + // function to ensure the optimizing compiler is used. + if (!full_compiler) { + v8::Debug::SetDebugEventListener(DebugEventStep); + } + + // Setup break point and step through the function. + SetBreakPoint(foo, 3); + step_action = StepNext; + break_point_hit_count = 0; + foo->Call(env->Global(), 0, NULL); + + // With stepping all expected break locations are hit. + CHECK_EQ(expected, break_point_hit_count); + + v8::Debug::SetDebugEventListener(NULL); + CheckDebuggerUnloaded(); +} + + +// Test of the stepping mechanism for named load in a loop. +TEST(DebugStepNamedStoreLoopFull) { + // With the full compiler it is possible to break on the for statement. + DoDebugStepNamedStoreLoop(22); +} + + +// Test of the stepping mechanism for named load in a loop. +TEST(DebugStepNamedStoreLoopOptimizing) { + // With the optimizing compiler it is not possible to break on the for + // statement as it uses a local variable thus no IC's. + DoDebugStepNamedStoreLoop(11, false); +} + + // Test the stepping mechanism with different ICs. TEST(DebugStepLinearMixedICs) { v8::HandleScope scope;