Chromium Code Reviews| 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, |
|
kozy
2017/03/18 00:48:05
I found this behavior during work on this CL and c
|
| + // 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); |
| + } |
| +} |