Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(969)

Unified Diff: test/cctest/test-debug.cc

Issue 1847373002: [debugger] fix step-next for tail calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix reloc info Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips64/assembler-mips64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-debug.cc
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index 253842d152efd6565bebf30f9dd9b2ab0c95b518..ab27f394e9aa3eae108605022cccad977051a5dc 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -8127,3 +8127,61 @@ TEST(DisableTailCallElimination) {
ExpectInt32("h();", 2);
ExpectInt32("h(); %OptimizeFunctionOnNextCall(g); h();", 2);
}
+
+TEST(DebugStepNextTailCallEliminiation) {
+ i::FLAG_allow_natives_syntax = true;
+ i::FLAG_harmony_tailcalls = true;
+ // TODO(ishell, 4698): Investigate why TurboFan in --always-opt mode makes
+ // stack[2].getFunctionName() return null.
+ i::FLAG_turbo_inlining = false;
+
+ DebugLocalContext env;
+ env.ExposeDebug();
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope scope(isolate);
+ CHECK(v8::Debug::IsTailCallEliminationEnabled(isolate));
+
+ const char* source =
+ "'use strict'; \n"
+ "var Debug = debug.Debug; \n"
+ "var exception = null; \n"
+ "var breaks = 0; \n"
+ "var log = []; \n"
+ "function f(x) { \n"
+ " if (x == 2) { \n"
+ " debugger; // Break a \n"
+ " } \n"
+ " if (x-- > 0) { // Break b \n"
+ " return f(x); // Break c \n"
+ " } \n"
+ "} // Break e \n"
+ "function listener(event, exec_state, event_data, data) {\n"
+ " if (event != Debug.DebugEvent.Break) return; \n"
+ " try { \n"
+ " var line = exec_state.frame(0).sourceLineText(); \n"
+ " var col = exec_state.frame(0).sourceColumn(); \n"
+ " var match = line.match(/\\/\\/ Break (\\w)/); \n"
+ " log.push(match[1] + col); \n"
+ " exec_state.prepareStep(Debug.StepAction.StepNext); \n"
+ " } catch (e) { \n"
+ " exception = e; \n"
+ " }; \n"
+ "}; \n"
+ "Debug.setListener(listener); \n"
+ "f(4); \n"
+ "Debug.setListener(null); // Break d \n";
+
+ CompileRun(source);
+ ExpectNull("exception");
+ ExpectString("JSON.stringify(log)", "[\"a4\",\"b2\",\"c4\",\"c11\",\"d0\"]");
+
+ v8::Debug::SetTailCallEliminationEnabled(isolate, false);
+ CompileRun(
+ "log = []; \n"
+ "Debug.setListener(listener); \n"
+ "f(5); \n"
+ "Debug.setListener(null); // Break f \n");
+ ExpectNull("exception");
+ ExpectString("JSON.stringify(log)",
+ "[\"a4\",\"b2\",\"c4\",\"e0\",\"e0\",\"e0\",\"e0\",\"f0\"]");
+}
« no previous file with comments | « src/mips64/assembler-mips64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698