Revision: 5283
Author: [email protected]
Date: Tue Aug 17 04:06:12 2010
Log: Fix breakpoints on inlined named stores in code from the optimizing
compiler
Review URL: http://codereview.chromium.org/3164018
http://code.google.com/p/v8/source/detail?r=5283
Modified:
/branches/bleeding_edge/src/debug.cc
/branches/bleeding_edge/test/cctest/test-debug.cc
=======================================
--- /branches/bleeding_edge/src/debug.cc Fri Aug 13 06:54:28 2010
+++ /branches/bleeding_edge/src/debug.cc Tue Aug 17 04:06:12 2010
@@ -461,6 +461,8 @@
KeyedStoreIC::ClearInlinedVersion(pc());
} else if (code->is_load_stub()) {
LoadIC::ClearInlinedVersion(pc());
+ } else if (code->is_store_stub()) {
+ StoreIC::ClearInlinedVersion(pc());
}
}
}
=======================================
--- /branches/bleeding_edge/test/cctest/test-debug.cc Thu Aug 5 06:38:27
2010
+++ /branches/bleeding_edge/test/cctest/test-debug.cc Tue Aug 17 04:06:12
2010
@@ -2678,6 +2678,65 @@
v8::Debug::SetDebugEventListener(NULL);
CheckDebuggerUnloaded();
}
+
+
+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<v8::Function> 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.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev