Index: test/cctest/compiler/test-run-bytecode-graph-builder.cc |
diff --git a/test/cctest/compiler/test-run-bytecode-graph-builder.cc b/test/cctest/compiler/test-run-bytecode-graph-builder.cc |
index 35d147c97f55cc811dd4155c534acc4ca830a7c3..e595aad10da301633a49f31092b5c028be78e0fc 100644 |
--- a/test/cctest/compiler/test-run-bytecode-graph-builder.cc |
+++ b/test/cctest/compiler/test-run-bytecode-graph-builder.cc |
@@ -2716,6 +2716,37 @@ TEST(BytecodeGraphBuilderWithStatement) { |
} |
} |
+TEST(BytecodeGraphBuilderDebuggerStatement) { |
+ FLAG_expose_debug_as = "debug"; |
+ HandleAndZoneScope scope; |
+ Isolate* isolate = scope.main_isolate(); |
+ Zone* zone = scope.main_zone(); |
+ |
+ ExpectedSnippet<0> snippet = { |
+ "var Debug = debug.Debug;" |
+ "var count = 0;" |
+ "function f() {" |
+ " debugger;" |
+ "}" |
+ "function listener(event) {" |
+ " if (event == Debug.DebugEvent.Break) count++;" |
+ "}" |
+ "Debug.setListener(listener);" |
+ "f();" |
+ "Debug.setListener(null);" |
+ "return count;", |
+ {handle(Smi::FromInt(1), isolate)}}; |
+ |
+ ScopedVector<char> script(1024); |
+ SNPrintF(script, "function %s() { %s }\n%s();", kFunctionName, |
+ snippet.code_snippet, kFunctionName); |
+ |
+ BytecodeGraphTester tester(isolate, zone, script.start()); |
+ auto callable = tester.GetCallable<>(); |
+ Handle<Object> return_value = callable().ToHandleChecked(); |
+ CHECK(return_value->SameValue(*snippet.return_value())); |
+} |
+ |
} // namespace compiler |
} // namespace internal |
} // namespace v8 |