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

Unified Diff: test/cctest/compiler/test-run-bytecode-graph-builder.cc

Issue 1667073002: [interpreter, debugger] implement debugger statement. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@sourcepositiontable
Patch Set: Created 4 years, 10 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/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 aa640de08a678cdae96d71d6bab5b132765de1a5..c15a4684c1da70c305450af2900176ccb9a8683f 100644
--- a/test/cctest/compiler/test-run-bytecode-graph-builder.cc
+++ b/test/cctest/compiler/test-run-bytecode-graph-builder.cc
@@ -2669,6 +2669,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

Powered by Google App Engine
This is Rietveld 408576698