diff options
Diffstat (limited to 'deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc')
-rw-r--r-- | deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc b/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc index 74a51b915a..ea7fcd6449 100644 --- a/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc +++ b/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc @@ -10,6 +10,7 @@ #include "src/handles.h" #include "src/interpreter/bytecode-array-builder.h" #include "src/interpreter/interpreter.h" +#include "src/objects-inl.h" #include "src/parsing/parse-info.h" #include "test/cctest/cctest.h" @@ -80,8 +81,6 @@ class BytecodeGraphTester { i::FLAG_always_opt = false; i::FLAG_allow_natives_syntax = true; i::FLAG_loop_assignment_analysis = false; - // Ensure handler table is generated. - isolate->interpreter()->Initialize(); } virtual ~BytecodeGraphTester() {} @@ -3029,35 +3028,32 @@ TEST(BytecodeGraphBuilderIllegalConstDeclaration) { } } +static int debug_break_count = 0; +static void DebugEventCounter(const v8::Debug::EventDetails& event_details) { + if (event_details.GetEvent() == v8::Break) debug_break_count++; +} + TEST(BytecodeGraphBuilderDebuggerStatement) { - FLAG_expose_debug_as = "debug"; HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); Zone* zone = scope.main_zone(); + v8::Debug::SetDebugEventListener(CcTest::isolate(), DebugEventCounter); + 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); + "f();", + {isolate->factory()->undefined_value()}}; - BytecodeGraphTester tester(isolate, zone, script.start()); + BytecodeGraphTester tester(isolate, zone, snippet.code_snippet); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); - CHECK(return_value->SameValue(*snippet.return_value())); + + v8::Debug::SetDebugEventListener(CcTest::isolate(), nullptr); + CHECK(return_value.is_identical_to(snippet.return_value())); + CHECK_EQ(2, debug_break_count); } } // namespace compiler |