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

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

Issue 2758483002: [debugger] tuned StepNext and StepOut at return position (Closed)
Patch Set: addressed comments Created 3 years, 9 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
Index: test/cctest/test-debug.cc
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index 07af24a6354db54d785571f78d422c6884dc4be1..6d889dfe09cc24d7921f17c878d6c7d1e36f7fc3 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -6679,3 +6679,37 @@ TEST(BuiltinsExceptionPrediction) {
}
CHECK(!fail);
}
+
+TEST(DebugGetPossibleBreakpointsReturnLocations) {
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::String> source = v8_str(
+ "function fib(x) {\n"
+ " if (x < 0) return;\n"
+ " if (x === 0) return 1;\n"
+ " if (x === 1) return fib(0);\n"
+ " return x > 2 ? fib(x - 1) + fib(x - 2) : fib(1) + fib(0);\n"
+ "}");
+ CompileRun(source);
+ v8::PersistentValueVector<v8::debug::Script> scripts(isolate);
+ v8::debug::GetLoadedScripts(isolate, scripts);
+ CHECK(scripts.Size() == 1);
+ std::vector<v8::debug::BreakLocation> locations;
+ CHECK(scripts.Get(0)->GetPossibleBreakpoints(
+ v8::debug::Location(0, 17), v8::debug::Location(), true, &locations));
+ int returns_count = 0;
+ for (size_t i = 0; i < locations.size(); ++i) {
+ if (locations[i].type() == v8::debug::kReturnBreakLocation) {
+ ++returns_count;
+ }
+ }
+ if (i::FLAG_turbo) {
+ // With turbofan we generate one return location per return statement,
+ // each has line = 5, column = 0 as statement position.
+ CHECK(returns_count == 4);
+ } else {
+ // Without turbofan we generate one return location.
+ CHECK(returns_count == 1);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698