diff --git a/deps/v8/include/v8-debug.h b/deps/v8/include/v8-debug.h index 797d23314e2fd4..54c0f216aa6cc1 100644 --- a/deps/v8/include/v8-debug.h +++ b/deps/v8/include/v8-debug.h @@ -8,7 +8,9 @@ #include "v8.h" // NOLINT(build/include) /** - * Debugger support for the V8 JavaScript engine. + * ATTENTION: The debugger API exposed by this file is deprecated and will be + * removed by the end of 2017. Please use the V8 inspector declared + * in include/v8-inspector.h instead. */ namespace v8 { @@ -140,21 +142,19 @@ class V8_EXPORT Debug { */ typedef void (*MessageHandler)(const Message& message); - /** - * This is now a no-op. - */ - typedef void (*DebugMessageDispatchHandler)(); - - static bool SetDebugEventListener(Isolate* isolate, EventCallback that, - Local data = Local()); + V8_DEPRECATED("No longer supported", static bool SetDebugEventListener( + Isolate* isolate, EventCallback that, + Local data = Local())); // Schedule a debugger break to happen when JavaScript code is run // in the given isolate. - static void DebugBreak(Isolate* isolate); + V8_DEPRECATED("No longer supported", + static void DebugBreak(Isolate* isolate)); // Remove scheduled debugger break in given isolate if it has not // happened yet. - static void CancelDebugBreak(Isolate* isolate); + V8_DEPRECATED("No longer supported", + static void CancelDebugBreak(Isolate* isolate)); // Check if a debugger break is scheduled in the given isolate. V8_DEPRECATED("No longer supported", @@ -189,10 +189,10 @@ class V8_EXPORT Debug { * } * \endcode */ - // TODO(dcarney): data arg should be a MaybeLocal - static MaybeLocal Call(Local context, - v8::Local fun, - Local data = Local()); + V8_DEPRECATED("No longer supported", + static MaybeLocal Call( + Local context, v8::Local fun, + Local data = Local())); // This is now a no-op. V8_DEPRECATED("No longer supported", @@ -221,23 +221,28 @@ class V8_EXPORT Debug { * (default Isolate if not provided). V8 will abort if LiveEdit is * unexpectedly used. LiveEdit is enabled by default. */ - static void SetLiveEditEnabled(Isolate* isolate, bool enable); + V8_DEPRECATED("No longer supported", + static void SetLiveEditEnabled(Isolate* isolate, bool enable)); /** * Returns array of internal properties specific to the value type. Result has * the following format: [, ,...,, ]. Result array * will be allocated in the current context. */ - static MaybeLocal GetInternalProperties(Isolate* isolate, - Local value); + V8_DEPRECATED("No longer supported", + static MaybeLocal GetInternalProperties( + Isolate* isolate, Local value)); /** * Defines if the ES2015 tail call elimination feature is enabled or not. * The change of this flag triggers deoptimization of all functions that * contain calls at tail position. */ - static bool IsTailCallEliminationEnabled(Isolate* isolate); - static void SetTailCallEliminationEnabled(Isolate* isolate, bool enabled); + V8_DEPRECATED("No longer supported", + static bool IsTailCallEliminationEnabled(Isolate* isolate)); + V8_DEPRECATED("No longer supported", + static void SetTailCallEliminationEnabled(Isolate* isolate, + bool enabled)); }; diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index 432431d7e06d03..beeec065a96bdf 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -8931,17 +8931,12 @@ bool Debug::SetDebugEventListener(Isolate* isolate, EventCallback that, return true; } -void Debug::DebugBreak(Isolate* isolate) { - reinterpret_cast(isolate)->stack_guard()->RequestDebugBreak(); -} - +void Debug::DebugBreak(Isolate* isolate) { debug::DebugBreak(isolate); } void Debug::CancelDebugBreak(Isolate* isolate) { - i::Isolate* internal_isolate = reinterpret_cast(isolate); - internal_isolate->stack_guard()->ClearDebugBreak(); + debug::CancelDebugBreak(isolate); } - bool Debug::CheckDebugBreak(Isolate* isolate) { i::Isolate* internal_isolate = reinterpret_cast(isolate); return internal_isolate->stack_guard()->CheckDebugBreak(); @@ -8956,29 +8951,15 @@ void Debug::SendCommand(Isolate* isolate, const uint16_t* command, int length, MaybeLocal Debug::Call(Local context, v8::Local fun, v8::Local data) { - PREPARE_FOR_EXECUTION(context, Debug, Call, Value); - i::Handle data_obj; - if (data.IsEmpty()) { - data_obj = isolate->factory()->undefined_value(); - } else { - data_obj = Utils::OpenHandle(*data); - } - Local result; - has_pending_exception = - !ToLocal(isolate->debug()->Call(Utils::OpenHandle(*fun), data_obj), - &result); - RETURN_ON_FAILED_EXECUTION(Value); - RETURN_ESCAPED(result); + return debug::Call(context, fun, data); } - void Debug::ProcessDebugMessages(Isolate* isolate) {} Local Debug::GetDebugContext(Isolate* isolate) { return debug::GetDebugContext(isolate); } - MaybeLocal Debug::GetDebuggedContext(Isolate* isolate) { i::Isolate* i_isolate = reinterpret_cast(isolate); ENTER_V8(i_isolate); @@ -8989,8 +8970,7 @@ MaybeLocal Debug::GetDebuggedContext(Isolate* isolate) { } void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) { - i::Isolate* internal_isolate = reinterpret_cast(isolate); - internal_isolate->debug()->set_live_edit_enabled(enable); + debug::SetLiveEditEnabled(isolate, enable); } bool Debug::IsTailCallEliminationEnabled(Isolate* isolate) { @@ -9005,13 +8985,7 @@ void Debug::SetTailCallEliminationEnabled(Isolate* isolate, bool enabled) { MaybeLocal Debug::GetInternalProperties(Isolate* v8_isolate, Local value) { - i::Isolate* isolate = reinterpret_cast(v8_isolate); - ENTER_V8(isolate); - i::Handle val = Utils::OpenHandle(*value); - i::Handle result; - if (!i::Runtime::GetInternalProperties(isolate, val).ToHandle(&result)) - return MaybeLocal(); - return Utils::ToLocal(result); + return debug::GetInternalProperties(v8_isolate, value); } Local debug::GetDebugContext(Isolate* isolate) { @@ -9023,22 +8997,43 @@ Local debug::GetDebugContext(Isolate* isolate) { MaybeLocal debug::Call(Local context, v8::Local fun, v8::Local data) { - return Debug::Call(context, fun, data); + PREPARE_FOR_EXECUTION(context, Debug, Call, Value); + i::Handle data_obj; + if (data.IsEmpty()) { + data_obj = isolate->factory()->undefined_value(); + } else { + data_obj = Utils::OpenHandle(*data); + } + Local result; + has_pending_exception = !ToLocal( + isolate->debug()->Call(Utils::OpenHandle(*fun), data_obj), &result); + RETURN_ON_FAILED_EXECUTION(Value); + RETURN_ESCAPED(result); } void debug::SetLiveEditEnabled(Isolate* isolate, bool enable) { - Debug::SetLiveEditEnabled(isolate, enable); + i::Isolate* internal_isolate = reinterpret_cast(isolate); + internal_isolate->debug()->set_live_edit_enabled(enable); } -void debug::DebugBreak(Isolate* isolate) { Debug::DebugBreak(isolate); } +void debug::DebugBreak(Isolate* isolate) { + reinterpret_cast(isolate)->stack_guard()->RequestDebugBreak(); +} void debug::CancelDebugBreak(Isolate* isolate) { - Debug::CancelDebugBreak(isolate); + i::Isolate* internal_isolate = reinterpret_cast(isolate); + internal_isolate->stack_guard()->ClearDebugBreak(); } -MaybeLocal debug::GetInternalProperties(Isolate* isolate, +MaybeLocal debug::GetInternalProperties(Isolate* v8_isolate, Local value) { - return Debug::GetInternalProperties(isolate, value); + i::Isolate* isolate = reinterpret_cast(v8_isolate); + ENTER_V8(isolate); + i::Handle val = Utils::OpenHandle(*value); + i::Handle result; + if (!i::Runtime::GetInternalProperties(isolate, val).ToHandle(&result)) + return MaybeLocal(); + return Utils::ToLocal(result); } void debug::ChangeBreakOnException(Isolate* isolate, ExceptionBreakState type) { diff --git a/deps/v8/test/cctest/cctest.h b/deps/v8/test/cctest/cctest.h index 7d8ad59a269c61..412a219e497327 100644 --- a/deps/v8/test/cctest/cctest.h +++ b/deps/v8/test/cctest/cctest.h @@ -31,7 +31,7 @@ #include #include "include/libplatform/libplatform.h" -#include "include/v8-debug.h" +#include "src/debug/debug-interface.h" #include "src/utils.h" #include "src/v8.h" #include "src/zone/accounting-allocator.h" @@ -547,18 +547,15 @@ static inline void CheckDoubleEquals(double expected, double actual) { CHECK_GE(expected, actual - kEpsilon); } - -static void DummyDebugEventListener( - const v8::Debug::EventDetails& event_details) {} - +static v8::debug::DebugDelegate dummy_delegate; static inline void EnableDebugger(v8::Isolate* isolate) { - v8::Debug::SetDebugEventListener(isolate, &DummyDebugEventListener); + v8::debug::SetDebugDelegate(isolate, &dummy_delegate); } static inline void DisableDebugger(v8::Isolate* isolate) { - v8::Debug::SetDebugEventListener(isolate, nullptr); + v8::debug::SetDebugDelegate(isolate, nullptr); } 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 b21447ef30c871..37838225632f1b 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 @@ -6,6 +6,7 @@ #include "src/compilation-info.h" #include "src/compiler/pipeline.h" +#include "src/debug/debug-interface.h" #include "src/execution.h" #include "src/handles.h" #include "src/interpreter/bytecode-array-builder.h" @@ -2966,16 +2967,22 @@ 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++; -} +class CountBreakDebugDelegate : public v8::debug::DebugDelegate { + public: + void BreakProgramRequested(v8::Local paused_context, + v8::Local exec_state, + v8::Local break_points_hit) override { + debug_break_count++; + } + int debug_break_count = 0; +}; TEST(BytecodeGraphBuilderDebuggerStatement) { + CountBreakDebugDelegate delegate; HandleAndZoneScope scope; Isolate* isolate = scope.main_isolate(); - v8::Debug::SetDebugEventListener(CcTest::isolate(), DebugEventCounter); + v8::debug::SetDebugDelegate(CcTest::isolate(), &delegate); ExpectedSnippet<0> snippet = { "function f() {" @@ -2988,9 +2995,9 @@ TEST(BytecodeGraphBuilderDebuggerStatement) { auto callable = tester.GetCallable<>(); Handle return_value = callable().ToHandleChecked(); - v8::Debug::SetDebugEventListener(CcTest::isolate(), nullptr); + v8::debug::SetDebugDelegate(CcTest::isolate(), nullptr); CHECK(return_value.is_identical_to(snippet.return_value())); - CHECK_EQ(2, debug_break_count); + CHECK_EQ(2, delegate.debug_break_count); } } // namespace compiler diff --git a/deps/v8/test/cctest/test-debug.cc b/deps/v8/test/cctest/test-debug.cc index 8d06b1b66e3fa4..05e3da34f3a3d4 100644 --- a/deps/v8/test/cctest/test-debug.cc +++ b/deps/v8/test/cctest/test-debug.cc @@ -140,6 +140,21 @@ static v8::Local CompileFunction(DebugLocalContext* env, return CompileFunction(env->GetIsolate(), source, function_name); } +static void SetDebugEventListener( + v8::Isolate* isolate, v8::Debug::EventCallback that, + v8::Local data = v8::Local()) { + i::Isolate* i_isolate = reinterpret_cast(isolate); + i::HandleScope scope(i_isolate); + if (that == nullptr) { + i_isolate->debug()->SetDebugDelegate(nullptr, false); + } else { + i::Handle i_data = i_isolate->factory()->undefined_value(); + if (!data.IsEmpty()) i_data = v8::Utils::OpenHandle(*data); + i::NativeDebugDelegate* delegate = + new i::NativeDebugDelegate(i_isolate, that, i_data); + i_isolate->debug()->SetDebugDelegate(delegate, true); + } +} // Is there any debug info for the function? static bool HasDebugInfo(v8::Local fun) { @@ -821,7 +836,7 @@ static void DebugEventBreak( CcTest::CollectGarbage(v8::internal::NEW_SPACE); // Set the break flag again to come back here as soon as possible. - v8::Debug::DebugBreak(CcTest::isolate()); + v8::debug::DebugBreak(CcTest::isolate()); } } @@ -845,7 +860,7 @@ static void DebugEventBreakMax( break_point_hit_count++; // Set the break flag again to come back here as soon as possible. - v8::Debug::DebugBreak(v8_isolate); + v8::debug::DebugBreak(v8_isolate); } else if (terminate_after_max_break_point_hit) { // Terminate execution after the last break if requested. @@ -924,8 +939,7 @@ TEST(BreakPointICStore) { DebugLocalContext env; v8::HandleScope scope(env->GetIsolate()); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); v8::Local foo = CompileFunction(&env, "function foo(){bar=0;}", "foo"); @@ -945,7 +959,7 @@ TEST(BreakPointICStore) { foo->Call(env.context(), env->Global(), 0, NULL).ToLocalChecked(); CHECK_EQ(2, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -955,8 +969,7 @@ TEST(BreakPointICLoad) { break_point_hit_count = 0; DebugLocalContext env; v8::HandleScope scope(env->GetIsolate()); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); CompileRunChecked(env->GetIsolate(), "bar=1"); v8::Local foo = @@ -978,7 +991,7 @@ TEST(BreakPointICLoad) { foo->Call(env.context(), env->Global(), 0, NULL).ToLocalChecked(); CHECK_EQ(2, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -988,8 +1001,7 @@ TEST(BreakPointICCall) { break_point_hit_count = 0; DebugLocalContext env; v8::HandleScope scope(env->GetIsolate()); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); CompileRunChecked(env->GetIsolate(), "function bar(){}"); v8::Local foo = CompileFunction(&env, "function foo(){bar();}", "foo"); @@ -1010,7 +1022,7 @@ TEST(BreakPointICCall) { foo->Call(env.context(), env->Global(), 0, NULL).ToLocalChecked(); CHECK_EQ(2, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -1020,8 +1032,7 @@ TEST(BreakPointICCallWithGC) { break_point_hit_count = 0; DebugLocalContext env; v8::HandleScope scope(env->GetIsolate()); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointCollectGarbage); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointCollectGarbage); CompileRunChecked(env->GetIsolate(), "function bar(){return 1;}"); v8::Local foo = CompileFunction(&env, "function foo(){return bar();}", "foo"); @@ -1052,7 +1063,7 @@ TEST(BreakPointICCallWithGC) { foo->Call(context, env->Global(), 0, NULL).ToLocalChecked(); CHECK_EQ(2, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -1062,8 +1073,7 @@ TEST(BreakPointConstructCallWithGC) { break_point_hit_count = 0; DebugLocalContext env; v8::HandleScope scope(env->GetIsolate()); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointCollectGarbage); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointCollectGarbage); CompileRunChecked(env->GetIsolate(), "function bar(){ this.x = 1;}"); v8::Local foo = CompileFunction(&env, "function foo(){return new bar(1).x;}", "foo"); @@ -1094,7 +1104,7 @@ TEST(BreakPointConstructCallWithGC) { foo->Call(context, env->Global(), 0, NULL).ToLocalChecked(); CHECK_EQ(2, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -1114,9 +1124,7 @@ TEST(BreakPointReturn) { frame_source_column_source, "frame_source_column"); - - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); v8::Local foo = CompileFunction(&env, "function foo(){}", "foo"); v8::Local context = env.context(); @@ -1141,7 +1149,7 @@ TEST(BreakPointReturn) { foo->Call(context, env->Global(), 0, NULL).ToLocalChecked(); CHECK_EQ(2, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -1165,8 +1173,7 @@ TEST(GCDuringBreakPointProcessing) { v8::HandleScope scope(env->GetIsolate()); v8::Local context = env.context(); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointCollectGarbage); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointCollectGarbage); v8::Local foo; // Test IC store break point with garbage collection. @@ -1194,7 +1201,7 @@ TEST(GCDuringBreakPointProcessing) { SetBreakPoint(foo, 0); CallWithBreakPoints(context, env->Global(), foo, 1, 25); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -1230,8 +1237,7 @@ TEST(BreakPointSurviveGC) { v8::HandleScope scope(env->GetIsolate()); v8::Local context = env.context(); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); v8::Local foo; // Test IC store break point with garbage collection. @@ -1276,8 +1282,7 @@ TEST(BreakPointSurviveGC) { } CallAndGC(context, env->Global(), foo); - - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -1291,7 +1296,7 @@ TEST(BreakPointThroughJavaScript) { v8::Local context = env.context(); env.ExposeDebug(); - v8::Debug::SetDebugEventListener(isolate, DebugEventBreakPointHitCount); + SetDebugEventListener(isolate, DebugEventBreakPointHitCount); CompileRunChecked(isolate, "function bar(){}"); CompileFunction(isolate, "function foo(){bar();bar();}", "foo"); // 012345678901234567890 @@ -1329,7 +1334,7 @@ TEST(BreakPointThroughJavaScript) { foo->Run(context).ToLocalChecked(); CHECK_EQ(8, break_point_hit_count); - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); // Make sure that the break point numbers are consecutive. @@ -1348,7 +1353,7 @@ TEST(ScriptBreakPointByNameThroughJavaScript) { v8::Local context = env.context(); env.ExposeDebug(); - v8::Debug::SetDebugEventListener(isolate, DebugEventBreakPointHitCount); + SetDebugEventListener(isolate, DebugEventBreakPointHitCount); v8::Local script = v8_str(isolate, "function f() {\n" @@ -1434,7 +1439,7 @@ TEST(ScriptBreakPointByNameThroughJavaScript) { g->Call(context, env->Global(), 0, NULL).ToLocalChecked(); CHECK_EQ(0, break_point_hit_count); - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); // Make sure that the break point numbers are consecutive. @@ -1455,7 +1460,7 @@ TEST(ScriptBreakPointByIdThroughJavaScript) { v8::Local context = env.context(); env.ExposeDebug(); - v8::Debug::SetDebugEventListener(isolate, DebugEventBreakPointHitCount); + SetDebugEventListener(isolate, DebugEventBreakPointHitCount); v8::Local source = v8_str(isolate, "function f() {\n" @@ -1543,7 +1548,7 @@ TEST(ScriptBreakPointByIdThroughJavaScript) { g->Call(context, env->Global(), 0, NULL).ToLocalChecked(); CHECK_EQ(0, break_point_hit_count); - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); // Make sure that the break point numbers are consecutive. @@ -1565,7 +1570,7 @@ TEST(EnableDisableScriptBreakPoint) { v8::Local context = env.context(); env.ExposeDebug(); - v8::Debug::SetDebugEventListener(isolate, DebugEventBreakPointHitCount); + SetDebugEventListener(isolate, DebugEventBreakPointHitCount); v8::Local script = v8_str(isolate, "function f() {\n" @@ -1601,7 +1606,7 @@ TEST(EnableDisableScriptBreakPoint) { f->Call(context, env->Global(), 0, NULL).ToLocalChecked(); CHECK_EQ(2, break_point_hit_count); - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); } @@ -1613,8 +1618,7 @@ TEST(ConditionalScriptBreakPoint) { v8::HandleScope scope(env->GetIsolate()); env.ExposeDebug(); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); v8::Local script = v8_str(env->GetIsolate(), "count = 0;\n" @@ -1658,7 +1662,7 @@ TEST(ConditionalScriptBreakPoint) { } CHECK_EQ(5, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -1670,8 +1674,7 @@ TEST(ScriptBreakPointMultiple) { v8::HandleScope scope(env->GetIsolate()); env.ExposeDebug(); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); v8::Local context = env.context(); v8::Local f; @@ -1735,7 +1738,7 @@ TEST(ScriptBreakPointMultiple) { g->Call(context, env->Global(), 0, NULL).ToLocalChecked(); CHECK_EQ(2, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -1747,8 +1750,7 @@ TEST(ScriptBreakPointLineOffset) { v8::HandleScope scope(env->GetIsolate()); env.ExposeDebug(); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); v8::Local context = env.context(); v8::Local f; @@ -1801,7 +1803,7 @@ TEST(ScriptBreakPointLineOffset) { f->Call(context, env->Global(), 0, NULL).ToLocalChecked(); CHECK_EQ(1, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -1817,8 +1819,7 @@ TEST(ScriptBreakPointLine) { frame_function_name_source, "frame_function_name"); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); v8::Local context = env.context(); v8::Local f; @@ -1916,7 +1917,7 @@ TEST(ScriptBreakPointLine) { ClearBreakPointFromJS(env->GetIsolate(), sbp5); ClearBreakPointFromJS(env->GetIsolate(), sbp6); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -1927,8 +1928,7 @@ TEST(ScriptBreakPointLineTopLevel) { v8::HandleScope scope(env->GetIsolate()); env.ExposeDebug(); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); v8::Local context = env.context(); v8::Local script = @@ -1961,7 +1961,7 @@ TEST(ScriptBreakPointLineTopLevel) { CompileRunWithOrigin(script, "test.html"); CHECK_EQ(0, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -1973,8 +1973,7 @@ TEST(ScriptBreakPointTopLevelCrash) { v8::HandleScope scope(env->GetIsolate()); env.ExposeDebug(); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); CompileRunWithOrigin( "function f() {\n" @@ -1994,7 +1993,7 @@ TEST(ScriptBreakPointTopLevelCrash) { ClearBreakPointFromJS(env->GetIsolate(), sbp1); ClearBreakPointFromJS(env->GetIsolate(), sbp2); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -2010,8 +2009,7 @@ TEST(RemoveBreakPointInBreak) { CompileFunction(&env, "function foo(){a=1;}", "foo"); // Register the debug event listener pasing the function - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventRemoveBreakPoint, foo); + SetDebugEventListener(env->GetIsolate(), DebugEventRemoveBreakPoint, foo); debug_event_remove_break_point = SetBreakPoint(foo, 0); @@ -2023,7 +2021,7 @@ TEST(RemoveBreakPointInBreak) { foo->Call(context, env->Global(), 0, NULL).ToLocalChecked(); CHECK_EQ(0, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -2033,8 +2031,7 @@ TEST(DebuggerStatement) { break_point_hit_count = 0; DebugLocalContext env; v8::HandleScope scope(env->GetIsolate()); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); v8::Local context = env.context(); v8::Script::Compile(context, v8_str(env->GetIsolate(), "function bar(){debugger}")) @@ -2063,7 +2060,7 @@ TEST(DebuggerStatement) { foo->Call(context, env->Global(), 0, NULL).ToLocalChecked(); CHECK_EQ(3, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -2074,8 +2071,7 @@ TEST(DebuggerStatementBreakpoint) { DebugLocalContext env; v8::HandleScope scope(env->GetIsolate()); v8::Local context = env.context(); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); v8::Script::Compile(context, v8_str(env->GetIsolate(), "function foo(){debugger;}")) .ToLocalChecked() @@ -2097,7 +2093,7 @@ TEST(DebuggerStatementBreakpoint) { CHECK_EQ(2, break_point_hit_count); ClearBreakPoint(bp); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -2115,7 +2111,7 @@ TEST(DebugEvaluate) { evaluate_check_source, "evaluate_check"); // Register the debug event listener - v8::Debug::SetDebugEventListener(isolate, DebugEventEvaluate); + SetDebugEventListener(isolate, DebugEventEvaluate); // Different expected vaules of x and a when in a break point (u = undefined, // d = Hello, world!). @@ -2237,7 +2233,7 @@ TEST(DebugEvaluate) { v8::Number::New(env->GetIsolate(), barbar_break_position + 1)}; bar->Call(context, env->Global(), 2, argv_bar_3).ToLocalChecked(); - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); } @@ -2255,7 +2251,7 @@ TEST(ConditionalBreakpointWithCodeGenerationDisallowed) { v8::HandleScope scope(env->GetIsolate()); env.ExposeDebug(); - v8::Debug::SetDebugEventListener(env->GetIsolate(), CheckDebugEvent); + SetDebugEventListener(env->GetIsolate(), CheckDebugEvent); v8::Local context = env.context(); v8::Local foo = CompileFunction(&env, @@ -2273,7 +2269,7 @@ TEST(ConditionalBreakpointWithCodeGenerationDisallowed) { foo->Call(context, env->Global(), 0, NULL).ToLocalChecked(); CHECK_EQ(1, debugEventCount); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -2310,7 +2306,7 @@ TEST(DebugEvaluateWithCodeGenerationDisallowed) { v8::HandleScope scope(env->GetIsolate()); env.ExposeDebug(); - v8::Debug::SetDebugEventListener(env->GetIsolate(), CheckDebugEval); + SetDebugEventListener(env->GetIsolate(), CheckDebugEval); v8::Local context = env.context(); v8::Local foo = CompileFunction(&env, @@ -2339,7 +2335,7 @@ TEST(DebugEvaluateWithCodeGenerationDisallowed) { checkGlobalEvalFunction.Clear(); checkFrameEvalFunction.Clear(); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -2358,7 +2354,7 @@ TEST(DebugStepLinear) { CompileRun("a=0; b=0; c=0; foo();"); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStep); + SetDebugEventListener(env->GetIsolate(), DebugEventStep); SetBreakPoint(foo, 3); @@ -2370,12 +2366,11 @@ TEST(DebugStepLinear) { // With stepping all break locations are hit. CHECK_EQ(4, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); // Register a debug event listener which just counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); SetBreakPoint(foo, 3); break_point_hit_count = 0; @@ -2384,7 +2379,7 @@ TEST(DebugStepLinear) { // Without stepping only active break points are hit. CHECK_EQ(1, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -2395,7 +2390,7 @@ TEST(DebugStepKeyedLoadLoop) { v8::HandleScope scope(env->GetIsolate()); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStep); + SetDebugEventListener(env->GetIsolate(), DebugEventStep); // Create a function for testing stepping of keyed load. The statement 'y=1' // is there to have more than one breakable statement in the loop, TODO(315). @@ -2435,7 +2430,7 @@ TEST(DebugStepKeyedLoadLoop) { // With stepping all break locations are hit. CHECK_EQ(44, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -2446,7 +2441,7 @@ TEST(DebugStepKeyedStoreLoop) { v8::HandleScope scope(env->GetIsolate()); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStep); + SetDebugEventListener(env->GetIsolate(), DebugEventStep); // Create a function for testing stepping of keyed store. The statement 'y=1' // is there to have more than one breakable statement in the loop, TODO(315). @@ -2485,7 +2480,7 @@ TEST(DebugStepKeyedStoreLoop) { // With stepping all break locations are hit. CHECK_EQ(44, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -2496,7 +2491,7 @@ TEST(DebugStepNamedLoadLoop) { v8::HandleScope scope(env->GetIsolate()); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStep); + SetDebugEventListener(env->GetIsolate(), DebugEventStep); v8::Local context = env.context(); // Create a function for testing stepping of named load. @@ -2530,7 +2525,7 @@ TEST(DebugStepNamedLoadLoop) { // With stepping all break locations are hit. CHECK_EQ(65, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -2540,7 +2535,7 @@ static void DoDebugStepNamedStoreLoop(int expected) { v8::HandleScope scope(env->GetIsolate()); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStep); + SetDebugEventListener(env->GetIsolate(), DebugEventStep); // Create a function for testing stepping of named store. v8::Local context = env.context(); @@ -2566,7 +2561,7 @@ static void DoDebugStepNamedStoreLoop(int expected) { // With stepping all expected break locations are hit. CHECK_EQ(expected, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -2580,7 +2575,7 @@ TEST(DebugStepLinearMixedICs) { v8::HandleScope scope(env->GetIsolate()); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStep); + SetDebugEventListener(env->GetIsolate(), DebugEventStep); v8::Local context = env.context(); // Create a function for testing stepping. @@ -2604,12 +2599,11 @@ TEST(DebugStepLinearMixedICs) { // With stepping all break locations are hit. CHECK_EQ(10, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); // Register a debug event listener which just counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); SetBreakPoint(foo, 0); break_point_hit_count = 0; @@ -2618,7 +2612,7 @@ TEST(DebugStepLinearMixedICs) { // Without stepping only active break points are hit. CHECK_EQ(1, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -2628,7 +2622,7 @@ TEST(DebugStepDeclarations) { v8::HandleScope scope(env->GetIsolate()); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStep); + SetDebugEventListener(env->GetIsolate(), DebugEventStep); v8::Local context = env.context(); // Create a function for testing stepping. Run it to allow it to get @@ -2652,7 +2646,7 @@ TEST(DebugStepDeclarations) { CHECK_EQ(5, break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -2662,7 +2656,7 @@ TEST(DebugStepLocals) { v8::HandleScope scope(env->GetIsolate()); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStep); + SetDebugEventListener(env->GetIsolate(), DebugEventStep); v8::Local context = env.context(); // Create a function for testing stepping. Run it to allow it to get @@ -2686,7 +2680,7 @@ TEST(DebugStepLocals) { CHECK_EQ(5, break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -2697,7 +2691,7 @@ TEST(DebugStepIf) { v8::HandleScope scope(isolate); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStep); + SetDebugEventListener(env->GetIsolate(), DebugEventStep); v8::Local context = env.context(); // Create a function for testing stepping. Run it to allow it to get @@ -2731,7 +2725,7 @@ TEST(DebugStepIf) { CHECK_EQ(5, break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(isolate); } @@ -2742,7 +2736,7 @@ TEST(DebugStepSwitch) { v8::HandleScope scope(isolate); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(isolate, DebugEventStep); + SetDebugEventListener(isolate, DebugEventStep); v8::Local context = env.context(); // Create a function for testing stepping. Run it to allow it to get @@ -2789,7 +2783,7 @@ TEST(DebugStepSwitch) { CHECK_EQ(7, break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); } @@ -2800,7 +2794,7 @@ TEST(DebugStepWhile) { v8::HandleScope scope(isolate); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(isolate, DebugEventStep); + SetDebugEventListener(isolate, DebugEventStep); v8::Local context = env.context(); // Create a function for testing stepping. Run it to allow it to get @@ -2838,7 +2832,7 @@ TEST(DebugStepWhile) { CHECK_EQ(203, break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); } @@ -2849,7 +2843,7 @@ TEST(DebugStepDoWhile) { v8::HandleScope scope(isolate); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(isolate, DebugEventStep); + SetDebugEventListener(isolate, DebugEventStep); v8::Local context = env.context(); // Create a function for testing stepping. Run it to allow it to get @@ -2887,7 +2881,7 @@ TEST(DebugStepDoWhile) { CHECK_EQ(202, break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); } @@ -2898,7 +2892,7 @@ TEST(DebugStepFor) { v8::HandleScope scope(isolate); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(isolate, DebugEventStep); + SetDebugEventListener(isolate, DebugEventStep); v8::Local context = env.context(); // Create a function for testing stepping. Run it to allow it to get @@ -2937,7 +2931,7 @@ TEST(DebugStepFor) { CHECK_EQ(304, break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); } @@ -2948,7 +2942,7 @@ TEST(DebugStepForContinue) { v8::HandleScope scope(isolate); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(isolate, DebugEventStep); + SetDebugEventListener(isolate, DebugEventStep); v8::Local context = env.context(); // Create a function for testing stepping. Run it to allow it to get @@ -2990,7 +2984,7 @@ TEST(DebugStepForContinue) { CHECK_EQ(557, break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); } @@ -3001,7 +2995,7 @@ TEST(DebugStepForBreak) { v8::HandleScope scope(isolate); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(isolate, DebugEventStep); + SetDebugEventListener(isolate, DebugEventStep); v8::Local context = env.context(); // Create a function for testing stepping. Run it to allow it to get @@ -3044,7 +3038,7 @@ TEST(DebugStepForBreak) { CHECK_EQ(604, break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); } @@ -3054,7 +3048,7 @@ TEST(DebugStepForIn) { v8::HandleScope scope(env->GetIsolate()); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStep); + SetDebugEventListener(env->GetIsolate(), DebugEventStep); v8::Local context = env.context(); // Create a function for testing stepping. Run it to allow it to get @@ -3093,7 +3087,7 @@ TEST(DebugStepForIn) { CHECK_EQ(10, break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -3103,7 +3097,7 @@ TEST(DebugStepWith) { v8::HandleScope scope(env->GetIsolate()); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStep); + SetDebugEventListener(env->GetIsolate(), DebugEventStep); v8::Local context = env.context(); // Create a function for testing stepping. Run it to allow it to get @@ -3128,7 +3122,7 @@ TEST(DebugStepWith) { CHECK_EQ(4, break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -3139,7 +3133,7 @@ TEST(DebugConditional) { v8::HandleScope scope(isolate); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(isolate, DebugEventStep); + SetDebugEventListener(isolate, DebugEventStep); v8::Local context = env.context(); // Create a function for testing stepping. Run it to allow it to get @@ -3165,7 +3159,7 @@ TEST(DebugConditional) { CHECK_EQ(2, break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); } @@ -3180,7 +3174,7 @@ TEST(StepInOutSimple) { "frame_function_name"); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStepSequence); + SetDebugEventListener(env->GetIsolate(), DebugEventStepSequence); v8::Local context = env.context(); // Create a function for testing stepping. Run it to allow it to get @@ -3217,7 +3211,7 @@ TEST(StepInOutSimple) { break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -3232,7 +3226,7 @@ TEST(StepInOutTree) { "frame_function_name"); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStepSequence); + SetDebugEventListener(env->GetIsolate(), DebugEventStepSequence); v8::Local context = env.context(); // Create a function for testing stepping. Run it to allow it to get @@ -3270,7 +3264,7 @@ TEST(StepInOutTree) { break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate(), true); } @@ -3285,7 +3279,7 @@ TEST(StepInOutBranch) { "frame_function_name"); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStepSequence); + SetDebugEventListener(env->GetIsolate(), DebugEventStepSequence); v8::Local context = env.context(); // Create a function for testing stepping. Run it to allow it to get @@ -3306,7 +3300,7 @@ TEST(StepInOutBranch) { break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -3323,7 +3317,7 @@ TEST(DebugStepNatives) { "foo"); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStep); + SetDebugEventListener(env->GetIsolate(), DebugEventStep); v8::Local context = env.context(); step_action = StepIn; @@ -3333,12 +3327,11 @@ TEST(DebugStepNatives) { // With stepping all break locations are hit. CHECK_EQ(3, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); // Register a debug event listener which just counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); break_point_hit_count = 0; foo->Call(context, env->Global(), 0, NULL).ToLocalChecked(); @@ -3346,7 +3339,7 @@ TEST(DebugStepNatives) { // Without stepping only active break points are hit. CHECK_EQ(1, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -3364,7 +3357,7 @@ TEST(DebugStepFunctionApply) { "foo"); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStep); + SetDebugEventListener(env->GetIsolate(), DebugEventStep); v8::Local context = env.context(); step_action = StepIn; @@ -3374,12 +3367,11 @@ TEST(DebugStepFunctionApply) { // With stepping all break locations are hit. CHECK_EQ(7, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); // Register a debug event listener which just counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); break_point_hit_count = 0; foo->Call(context, env->Global(), 0, NULL).ToLocalChecked(); @@ -3387,7 +3379,7 @@ TEST(DebugStepFunctionApply) { // Without stepping only the debugger statement is hit. CHECK_EQ(1, break_point_hit_count); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -3413,7 +3405,7 @@ TEST(DebugStepFunctionCall) { "foo"); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(isolate, DebugEventStep); + SetDebugEventListener(isolate, DebugEventStep); step_action = StepIn; // Check stepping where the if condition in bar is false. @@ -3428,11 +3420,11 @@ TEST(DebugStepFunctionCall) { foo->Call(context, env->Global(), argc, argv).ToLocalChecked(); CHECK_EQ(8, break_point_hit_count); - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); // Register a debug event listener which just counts. - v8::Debug::SetDebugEventListener(isolate, DebugEventBreakPointHitCount); + SetDebugEventListener(isolate, DebugEventBreakPointHitCount); break_point_hit_count = 0; foo->Call(context, env->Global(), 0, NULL).ToLocalChecked(); @@ -3440,7 +3432,7 @@ TEST(DebugStepFunctionCall) { // Without stepping only the debugger statement is hit. CHECK_EQ(1, break_point_hit_count); - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); } @@ -3464,18 +3456,18 @@ TEST(DebugStepFunctionCallApply) { "foo"); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(isolate, DebugEventStep); + SetDebugEventListener(isolate, DebugEventStep); step_action = StepIn; break_point_hit_count = 0; foo->Call(context, env->Global(), 0, NULL).ToLocalChecked(); CHECK_EQ(6, break_point_hit_count); - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); // Register a debug event listener which just counts. - v8::Debug::SetDebugEventListener(isolate, DebugEventBreakPointHitCount); + SetDebugEventListener(isolate, DebugEventBreakPointHitCount); break_point_hit_count = 0; foo->Call(context, env->Global(), 0, NULL).ToLocalChecked(); @@ -3483,7 +3475,7 @@ TEST(DebugStepFunctionCallApply) { // Without stepping only the debugger statement is hit. CHECK_EQ(1, break_point_hit_count); - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); } @@ -3495,7 +3487,7 @@ TEST(PauseInScript) { env.ExposeDebug(); // Register a debug event listener which counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventCounter); + SetDebugEventListener(env->GetIsolate(), DebugEventCounter); v8::Local context = env.context(); // Create a script that returns a function. @@ -3518,7 +3510,7 @@ TEST(PauseInScript) { CHECK_EQ(1, break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -3561,7 +3553,7 @@ TEST(BreakOnException) { "caughtFinally"); env->GetIsolate()->AddMessageListener(MessageCallbackCount); - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventCounter); + SetDebugEventListener(env->GetIsolate(), DebugEventCounter); // Initial state should be no break on exceptions. DebugEventCounterClear(); @@ -3721,7 +3713,7 @@ TEST(BreakOnException) { edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked(); DebugEventCounterCheck(4, 3, 2); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); env->GetIsolate()->RemoveMessageListeners(MessageCallbackCount); } @@ -3743,7 +3735,7 @@ TEST(TryFinallyOriginalMessage) { DebugLocalContext env; v8::Isolate* isolate = CcTest::isolate(); isolate->AddMessageListener(try_finally_original_message); - v8::Debug::SetDebugEventListener(isolate, DebugEventCounter); + SetDebugEventListener(isolate, DebugEventCounter); ChangeBreakOnException(true, true); v8::HandleScope scope(isolate); CompileRun( @@ -3752,7 +3744,7 @@ TEST(TryFinallyOriginalMessage) { "} finally {\n" "}\n"); DebugEventCounterCheck(1, 1, 1); - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); isolate->RemoveMessageListeners(try_finally_original_message); } @@ -3772,7 +3764,7 @@ TEST(BreakOnCompileException) { frame_count = CompileFunction(&env, frame_count_source, "frame_count"); env->GetIsolate()->AddMessageListener(MessageCallbackCount); - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventCounter); + SetDebugEventListener(env->GetIsolate(), DebugEventCounter); DebugEventCounterClear(); MessageCallbackCountClear(); @@ -3836,7 +3828,7 @@ TEST(StepWithException) { "frame_function_name"); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStepSequence); + SetDebugEventListener(env->GetIsolate(), DebugEventStepSequence); v8::Local context = env.context(); // Create functions for testing stepping. @@ -3914,7 +3906,7 @@ TEST(StepWithException) { break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -3929,7 +3921,7 @@ TEST(DebugBreak) { v8::HandleScope scope(isolate); // Register a debug event listener which sets the break flag and counts. - v8::Debug::SetDebugEventListener(isolate, DebugEventBreak); + SetDebugEventListener(isolate, DebugEventBreak); v8::Local context = env.context(); // Create a function for testing stepping. @@ -3954,7 +3946,7 @@ TEST(DebugBreak) { f3->Call(context, env->Global(), 0, NULL).ToLocalChecked(); // Set the debug break flag. - v8::Debug::DebugBreak(env->GetIsolate()); + v8::debug::DebugBreak(env->GetIsolate()); // Call all functions with different argument count. break_point_hit_count = 0; @@ -3969,7 +3961,7 @@ TEST(DebugBreak) { CHECK(4 * arraysize(argv) == break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); } @@ -3981,7 +3973,7 @@ TEST(DisableBreak) { v8::HandleScope scope(env->GetIsolate()); // Register a debug event listener which sets the break flag and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventCounter); + SetDebugEventListener(env->GetIsolate(), DebugEventCounter); v8::Local context = env.context(); // Create a function for testing stepping. @@ -3989,11 +3981,11 @@ TEST(DisableBreak) { v8::Local f = CompileFunction(&env, src, "f"); // Set, test and cancel debug break. - v8::Debug::DebugBreak(env->GetIsolate()); - v8::Debug::CancelDebugBreak(env->GetIsolate()); + v8::debug::DebugBreak(env->GetIsolate()); + v8::debug::CancelDebugBreak(env->GetIsolate()); // Set the debug break flag. - v8::Debug::DebugBreak(env->GetIsolate()); + v8::debug::DebugBreak(env->GetIsolate()); // Call all functions with different argument count. break_point_hit_count = 0; @@ -4001,7 +3993,7 @@ TEST(DisableBreak) { CHECK_EQ(1, break_point_hit_count); { - v8::Debug::DebugBreak(env->GetIsolate()); + v8::debug::DebugBreak(env->GetIsolate()); i::Isolate* isolate = reinterpret_cast(env->GetIsolate()); v8::internal::DisableBreak disable_break(isolate->debug()); f->Call(context, env->Global(), 0, NULL).ToLocalChecked(); @@ -4012,7 +4004,7 @@ TEST(DisableBreak) { CHECK_EQ(2, break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -4021,7 +4013,7 @@ TEST(DisableDebuggerStatement) { v8::HandleScope scope(env->GetIsolate()); // Register a debug event listener which sets the break flag and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventCounter); + SetDebugEventListener(env->GetIsolate(), DebugEventCounter); CompileRun("debugger;"); CHECK_EQ(1, break_point_hit_count); @@ -4044,10 +4036,10 @@ TEST(NoBreakWhenBootstrapping) { v8::HandleScope scope(isolate); // Register a debug event listener which sets the break flag and counts. - v8::Debug::SetDebugEventListener(isolate, DebugEventCounter); + SetDebugEventListener(isolate, DebugEventCounter); // Set the debug break flag. - v8::Debug::DebugBreak(isolate); + v8::debug::DebugBreak(isolate); break_point_hit_count = 0; { // Create a context with an extension to make sure that some JavaScript @@ -4063,7 +4055,7 @@ TEST(NoBreakWhenBootstrapping) { CHECK_EQ(0, break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); } @@ -4593,7 +4585,7 @@ TEST(NoHiddenProperties) { TEST(SetDebugEventListenerOnUninitializedVM) { - v8::Debug::SetDebugEventListener(CcTest::isolate(), DummyDebugEventListener); + EnableDebugger(CcTest::isolate()); } // Source for a JavaScript function which returns the data parameter of a @@ -4623,9 +4615,9 @@ v8::Local debugger_call_with_closure; // in the debugger. static void CheckFrameCount(const v8::FunctionCallbackInfo& args) { v8::Local context = args.GetIsolate()->GetCurrentContext(); - CHECK(v8::Debug::Call(context, frame_count).ToLocalChecked()->IsNumber()); + CHECK(v8::debug::Call(context, frame_count).ToLocalChecked()->IsNumber()); CHECK_EQ(args[0]->Int32Value(context).FromJust(), - v8::Debug::Call(context, frame_count) + v8::debug::Call(context, frame_count) .ToLocalChecked() ->Int32Value(context) .FromJust()); @@ -4637,9 +4629,9 @@ static void CheckFrameCount(const v8::FunctionCallbackInfo& args) { static void CheckSourceLine(const v8::FunctionCallbackInfo& args) { v8::Local context = args.GetIsolate()->GetCurrentContext(); CHECK( - v8::Debug::Call(context, frame_source_line).ToLocalChecked()->IsNumber()); + v8::debug::Call(context, frame_source_line).ToLocalChecked()->IsNumber()); CHECK_EQ(args[0]->Int32Value(context).FromJust(), - v8::Debug::Call(context, frame_source_line) + v8::debug::Call(context, frame_source_line) .ToLocalChecked() ->Int32Value(context) .FromJust()); @@ -4653,13 +4645,13 @@ static void CheckDataParameter( const v8::FunctionCallbackInfo& args) { v8::Local data = v8_str(args.GetIsolate(), "Test"); v8::Local context = args.GetIsolate()->GetCurrentContext(); - CHECK(v8::Debug::Call(context, debugger_call_with_data, data) + CHECK(v8::debug::Call(context, debugger_call_with_data, data) .ToLocalChecked() ->IsString()); for (int i = 0; i < 3; i++) { v8::TryCatch catcher(args.GetIsolate()); - CHECK(v8::Debug::Call(context, debugger_call_with_data).IsEmpty()); + CHECK(v8::debug::Call(context, debugger_call_with_data).IsEmpty()); CHECK(catcher.HasCaught()); CHECK(catcher.Exception()->IsString()); } @@ -4669,10 +4661,10 @@ static void CheckDataParameter( // Function to test using a JavaScript with closure in the debugger. static void CheckClosure(const v8::FunctionCallbackInfo& args) { v8::Local context = args.GetIsolate()->GetCurrentContext(); - CHECK(v8::Debug::Call(context, debugger_call_with_closure) + CHECK(v8::debug::Call(context, debugger_call_with_closure) .ToLocalChecked() ->IsNumber()); - CHECK_EQ(3, v8::Debug::Call(context, debugger_call_with_closure) + CHECK_EQ(3, v8::debug::Call(context, debugger_call_with_closure) .ToLocalChecked() ->Int32Value(context) .FromJust()); @@ -4741,7 +4733,7 @@ TEST(CallFunctionInDebugger) { // no JavaScript frames. CHECK(v8::Integer::New(isolate, 0) ->Equals(context, - v8::Debug::Call(context, frame_count).ToLocalChecked()) + v8::debug::Call(context, frame_count).ToLocalChecked()) .FromJust()); // Test that the number of frames can be retrieved. @@ -4814,8 +4806,7 @@ TEST(DebuggerUnload) { // Set a debug event listener. break_point_hit_count = 0; - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); v8::Local context = env.context(); { v8::HandleScope scope(env->GetIsolate()); @@ -4841,7 +4832,7 @@ TEST(DebuggerUnload) { // Remove the debug event listener without clearing breakpoints. Do this // outside a handle scope. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate(), true); } @@ -4853,7 +4844,7 @@ static void EventListenerClearingItself( event_listener_hit_count++; // Clear debug event listener. - v8::Debug::SetDebugEventListener(details.GetIsolate(), nullptr); + SetDebugEventListener(details.GetIsolate(), nullptr); } @@ -4866,8 +4857,7 @@ TEST(DebuggerClearEventListenerWhileActive) { CheckDebuggerUnloaded(env->GetIsolate()); // Set a debug event listener. - v8::Debug::SetDebugEventListener(env->GetIsolate(), - EventListenerClearingItself); + SetDebugEventListener(env->GetIsolate(), EventListenerClearingItself); // Run code to throw an uncaught exception. This should trigger the listener. CompileRun("throw 1"); @@ -4948,8 +4938,7 @@ TEST(ScriptNameAndData) { frame_script_name_source, "frame_script_name"); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakPointHitCount); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakPointHitCount); v8::Local context = env.context(); // Test function source. @@ -5052,7 +5041,7 @@ TEST(ContextData) { context_1 = v8::Context::New(isolate, NULL, global_template, global_object); context_2 = v8::Context::New(isolate, NULL, global_template, global_object); - v8::Debug::SetDebugEventListener(isolate, ContextCheckEventListener); + SetDebugEventListener(isolate, ContextCheckEventListener); // Default data value is undefined. CHECK(context_1->GetEmbedderData(0)->IsUndefined()); @@ -5091,7 +5080,7 @@ TEST(ContextData) { // Two times compile event and two times break event. CHECK_GT(event_listener_hit_count, 3); - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); CheckDebuggerUnloaded(isolate); } @@ -5102,7 +5091,7 @@ static void DebugBreakEventListener(const v8::Debug::EventDetails& details) { if (details.GetEvent() == v8::Break) { event_listener_break_hit_count++; if (event_listener_break_hit_count == 1) { - v8::Debug::DebugBreak(details.GetIsolate()); + v8::debug::DebugBreak(details.GetIsolate()); } } } @@ -5113,7 +5102,7 @@ TEST(DebugBreakInEventListener) { DebugLocalContext env; v8::HandleScope scope(env->GetIsolate()); - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugBreakEventListener); + SetDebugEventListener(env->GetIsolate(), DebugBreakEventListener); v8::Local context = env.context(); // Test functions. @@ -5170,7 +5159,7 @@ static void DebugEventDebugBreak( // Keep forcing breaks. if (break_point_hit_count < 20) { - v8::Debug::DebugBreak(CcTest::isolate()); + v8::debug::DebugBreak(CcTest::isolate()); } } } @@ -5200,8 +5189,8 @@ TEST(RegExpDebugBreak) { f->Call(context, env->Global(), argc, argv).ToLocalChecked(); CHECK_EQ(12, result->Int32Value(context).FromJust()); - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventDebugBreak); - v8::Debug::DebugBreak(env->GetIsolate()); + SetDebugEventListener(env->GetIsolate(), DebugEventDebugBreak); + v8::debug::DebugBreak(env->GetIsolate()); result = f->Call(context, env->Global(), argc, argv).ToLocalChecked(); // Check that there was only one break event. Matching RegExp should not @@ -5224,8 +5213,7 @@ TEST(EvalContextData) { context_1 = v8::Context::New(CcTest::isolate(), NULL, global_template); - v8::Debug::SetDebugEventListener(CcTest::isolate(), - ContextCheckEventListener); + SetDebugEventListener(CcTest::isolate(), ContextCheckEventListener); // Default data value is undefined. CHECK(context_1->GetEmbedderData(0)->IsUndefined()); @@ -5247,7 +5235,7 @@ TEST(EvalContextData) { f->Call(context_1, context_1->Global(), 0, NULL).ToLocalChecked(); } - v8::Debug::SetDebugEventListener(CcTest::isolate(), nullptr); + SetDebugEventListener(CcTest::isolate(), nullptr); // One time compile event and one time break event. CHECK_GT(event_listener_hit_count, 2); @@ -5273,24 +5261,22 @@ TEST(AfterCompileEventWhenEventListenerIsReset) { v8::Local context = env.context(); const char* script = "var a=1"; - v8::Debug::SetDebugEventListener(env->GetIsolate(), - AfterCompileEventListener); + SetDebugEventListener(env->GetIsolate(), AfterCompileEventListener); v8::Script::Compile(context, v8_str(env->GetIsolate(), script)) .ToLocalChecked() ->Run(context) .ToLocalChecked(); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - AfterCompileEventListener); - v8::Debug::DebugBreak(env->GetIsolate()); + SetDebugEventListener(env->GetIsolate(), AfterCompileEventListener); + v8::debug::DebugBreak(env->GetIsolate()); v8::Script::Compile(context, v8_str(env->GetIsolate(), script)) .ToLocalChecked() ->Run(context) .ToLocalChecked(); // Setting listener to NULL should cause debugger unload. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); // Compilation cache should be disabled when debugger is active. @@ -5324,7 +5310,7 @@ TEST(SyntaxErrorEventOnSyntaxException) { // For this test, we want to break on uncaught exceptions: ChangeBreakOnException(false, true); - v8::Debug::SetDebugEventListener(env->GetIsolate(), CompileErrorEventCounter); + SetDebugEventListener(env->GetIsolate(), CompileErrorEventCounter); v8::Local context = env.context(); CompileErrorEventCounterClear(); @@ -5366,17 +5352,15 @@ TEST(BreakEventWhenEventListenerIsReset) { v8::Local context = env.context(); const char* script = "function f() {};"; - v8::Debug::SetDebugEventListener(env->GetIsolate(), - AfterCompileEventListener); + SetDebugEventListener(env->GetIsolate(), AfterCompileEventListener); v8::Script::Compile(context, v8_str(env->GetIsolate(), script)) .ToLocalChecked() ->Run(context) .ToLocalChecked(); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - AfterCompileEventListener); - v8::Debug::DebugBreak(env->GetIsolate()); + SetDebugEventListener(env->GetIsolate(), AfterCompileEventListener); + v8::debug::DebugBreak(env->GetIsolate()); v8::Local f = v8::Local::Cast( env->Global() ->Get(context, v8_str(env->GetIsolate(), "f")) @@ -5384,7 +5368,7 @@ TEST(BreakEventWhenEventListenerIsReset) { f->Call(context, env->Global(), 0, NULL).ToLocalChecked(); // Setting event listener to NULL should cause debugger unload. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); // Compilation cache should be disabled when debugger is active. @@ -5409,15 +5393,14 @@ TEST(ExceptionEventWhenEventListenerIsReset) { exception_event_count = 0; const char* script = "function f() {throw new Error()};"; - v8::Debug::SetDebugEventListener(env->GetIsolate(), - AfterCompileEventListener); + SetDebugEventListener(env->GetIsolate(), AfterCompileEventListener); v8::Script::Compile(context, v8_str(env->GetIsolate(), script)) .ToLocalChecked() ->Run(context) .ToLocalChecked(); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); - v8::Debug::SetDebugEventListener(env->GetIsolate(), ExceptionEventListener); + SetDebugEventListener(env->GetIsolate(), ExceptionEventListener); v8::Local f = v8::Local::Cast( env->Global() ->Get(context, v8_str(env->GetIsolate(), "f")) @@ -5425,7 +5408,7 @@ TEST(ExceptionEventWhenEventListenerIsReset) { CHECK(f->Call(context, env->Global(), 0, NULL).IsEmpty()); // Setting event listener to NULL should cause debugger unload. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); CHECK_EQ(1, exception_event_count); @@ -5441,8 +5424,7 @@ TEST(ProvisionalBreakpointOnLineOutOfRange) { const char* script = "function f() {};"; const char* resource_name = "test_resource"; - v8::Debug::SetDebugEventListener(env->GetIsolate(), - AfterCompileEventListener); + SetDebugEventListener(env->GetIsolate(), AfterCompileEventListener); v8::Local context = env.context(); // Set a couple of provisional breakpoint on lines out of the script lines @@ -5471,7 +5453,7 @@ TEST(ProvisionalBreakpointOnLineOutOfRange) { ClearBreakPointFromJS(env->GetIsolate(), sbp1); ClearBreakPointFromJS(env->GetIsolate(), sbp2); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -5488,10 +5470,10 @@ TEST(NoDebugBreakInAfterCompileEventListener) { v8::Local context = env.context(); // Register a debug event listener which sets the break flag and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), BreakEventListener); + SetDebugEventListener(env->GetIsolate(), BreakEventListener); // Set the debug break flag. - v8::Debug::DebugBreak(env->GetIsolate()); + v8::debug::DebugBreak(env->GetIsolate()); // Create a function for testing stepping. const char* src = "function f() { eval('var x = 10;'); } "; @@ -5501,13 +5483,13 @@ TEST(NoDebugBreakInAfterCompileEventListener) { CHECK_EQ(1, break_point_hit_count); // Set the debug break flag again. - v8::Debug::DebugBreak(env->GetIsolate()); + v8::debug::DebugBreak(env->GetIsolate()); f->Call(context, env->Global(), 0, NULL).ToLocalChecked(); // There should be one more break event when the script is evaluated in 'f'. CHECK_EQ(2, break_point_hit_count); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -5527,10 +5509,10 @@ TEST(DebugBreakFunctionApply) { "foo"); // Register a debug event listener which steps and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventBreakMax); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakMax); // Set the debug break flag before calling the code using function.apply. - v8::Debug::DebugBreak(env->GetIsolate()); + v8::debug::DebugBreak(env->GetIsolate()); // Limit the number of debug breaks. This is a regression test for issue 493 // where this test would enter an infinite loop. @@ -5541,7 +5523,7 @@ TEST(DebugBreakFunctionApply) { // When keeping the debug break several break will happen. CHECK_GT(break_point_hit_count, 1); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -5609,7 +5591,7 @@ TEST(CallingContextIsNotDebugContext) { .FromJust()); // Register the debug event listener - v8::Debug::SetDebugEventListener(isolate, DebugEventGetAtgumentPropertyValue); + SetDebugEventListener(isolate, DebugEventGetAtgumentPropertyValue); // Create a function that invokes debugger. v8::Local foo = CompileFunction( @@ -5622,7 +5604,7 @@ TEST(CallingContextIsNotDebugContext) { foo->Call(debugee_context, env->Global(), 0, NULL).ToLocalChecked(); CHECK_EQ(1, break_point_hit_count); - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); debugee_context = v8::Local(); debugger_context = v8::Local(); CheckDebuggerUnloaded(isolate); @@ -5644,8 +5626,8 @@ TEST(DebugEventContext) { v8::HandleScope scope(isolate); expected_context = v8::Context::New(isolate); expected_callback_data = v8::Int32::New(isolate, 2010); - v8::Debug::SetDebugEventListener(isolate, DebugEventContextChecker, - expected_callback_data); + SetDebugEventListener(isolate, DebugEventContextChecker, + expected_callback_data); v8::Context::Scope context_scope(expected_context); v8::Script::Compile(expected_context, v8_str(isolate, "(function(){debugger;})();")) @@ -5653,7 +5635,7 @@ TEST(DebugEventContext) { ->Run(expected_context) .ToLocalChecked(); expected_context.Clear(); - v8::Debug::SetDebugEventListener(isolate, nullptr); + SetDebugEventListener(isolate, nullptr); expected_context_data = v8::Local(); CheckDebuggerUnloaded(isolate); } @@ -5688,7 +5670,7 @@ static void DebugEventBreakDeoptimize( } } - v8::Debug::DebugBreak(CcTest::isolate()); + v8::debug::DebugBreak(CcTest::isolate()); } } @@ -5711,20 +5693,19 @@ TEST(DeoptimizeDuringDebugBreak) { // This tests lazy deoptimization bailout for the stack check, as the first // time in function bar when using debug break and no break points will be at // the initial stack check. - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugEventBreakDeoptimize); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakDeoptimize); // Compile and run function bar which will optimize it for some flag settings. v8::Local f = CompileFunction(&env, "function bar(){}", "bar"); f->Call(context, v8::Undefined(env->GetIsolate()), 0, NULL).ToLocalChecked(); // Set debug break and call bar again. - v8::Debug::DebugBreak(env->GetIsolate()); + v8::debug::DebugBreak(env->GetIsolate()); f->Call(context, v8::Undefined(env->GetIsolate()), 0, NULL).ToLocalChecked(); CHECK(debug_event_break_deoptimize_done); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); } @@ -5791,9 +5772,8 @@ static void DebugEventBreakWithOptimizedStack( static void ScheduleBreak(const v8::FunctionCallbackInfo& args) { - v8::Debug::SetDebugEventListener(args.GetIsolate(), - DebugEventBreakWithOptimizedStack); - v8::Debug::DebugBreak(args.GetIsolate()); + SetDebugEventListener(args.GetIsolate(), DebugEventBreakWithOptimizedStack); + v8::debug::DebugBreak(args.GetIsolate()); } @@ -5866,7 +5846,7 @@ static void TestDebugBreakInLoop(const char* loop_head, CompileRun(buffer.start()); // Set the debug break to enter the debugger as soon as possible. - v8::Debug::DebugBreak(CcTest::isolate()); + v8::debug::DebugBreak(CcTest::isolate()); // Call function with infinite loop. CompileRun("f();"); @@ -5902,7 +5882,7 @@ void DebugBreakLoop(const char* loop_header, const char** loop_bodies, v8::HandleScope scope(env->GetIsolate()); // Register a debug event listener which sets the break flag and counts. - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventBreakMax); + SetDebugEventListener(env->GetIsolate(), DebugEventBreakMax); CompileRun( "var a = 1;\n" @@ -5912,7 +5892,7 @@ void DebugBreakLoop(const char* loop_header, const char** loop_bodies, TestDebugBreakInLoop(loop_header, loop_bodies, loop_footer); // Get rid of the debug event listener. - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -6006,7 +5986,7 @@ static void DebugBreakInlineListener( i::Script::GetLineNumber(source_script, result->Int32Value(context).FromJust())); } - v8::Debug::SetDebugEventListener(CcTest::isolate(), nullptr); + SetDebugEventListener(CcTest::isolate(), nullptr); CcTest::isolate()->TerminateExecution(); } @@ -6030,7 +6010,7 @@ TEST(DebugBreakInline) { "g(false); \n" "%OptimizeFunctionOnNextCall(g); \n" "g(true);"; - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugBreakInlineListener); + SetDebugEventListener(env->GetIsolate(), DebugBreakInlineListener); inline_script = v8::Script::Compile(context, v8_str(env->GetIsolate(), source)) .ToLocalChecked(); @@ -6065,7 +6045,7 @@ TEST(Regress131642) { // on the stack. DebugLocalContext env; v8::HandleScope scope(env->GetIsolate()); - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugEventStepNext); + SetDebugEventListener(env->GetIsolate(), DebugEventStepNext); // We step through the first script. It exits through an exception. We run // this inside a new frame to record a different FP than the second script @@ -6077,7 +6057,7 @@ TEST(Regress131642) { const char* script_2 = "[0].forEach(function() { });"; CompileRun(script_2); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); } @@ -6099,15 +6079,15 @@ TEST(DebuggerCreatesContextIffActive) { v8::HandleScope scope(env->GetIsolate()); CHECK_EQ(1, v8::internal::CountNativeContexts()); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CompileRun("debugger;"); CHECK_EQ(1, v8::internal::CountNativeContexts()); - v8::Debug::SetDebugEventListener(env->GetIsolate(), NopListener); + SetDebugEventListener(env->GetIsolate(), NopListener); CompileRun("debugger;"); CHECK_EQ(2, v8::internal::CountNativeContexts()); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); } @@ -6115,7 +6095,7 @@ TEST(LiveEditEnabled) { v8::internal::FLAG_allow_natives_syntax = true; LocalContext env; v8::HandleScope scope(env->GetIsolate()); - v8::Debug::SetLiveEditEnabled(env->GetIsolate(), true); + v8::debug::SetLiveEditEnabled(env->GetIsolate(), true); CompileRun("%LiveEditCompareStrings('', '')"); } @@ -6124,7 +6104,7 @@ TEST(LiveEditDisabled) { v8::internal::FLAG_allow_natives_syntax = true; LocalContext env; v8::HandleScope scope(env->GetIsolate()); - v8::Debug::SetLiveEditEnabled(env->GetIsolate(), false); + v8::debug::SetLiveEditEnabled(env->GetIsolate(), false); CompileRun("%LiveEditCompareStrings('', '')"); } @@ -6137,7 +6117,7 @@ TEST(PrecompiledFunction) { DebugLocalContext env; v8::HandleScope scope(env->GetIsolate()); env.ExposeDebug(); - v8::Debug::SetDebugEventListener(env->GetIsolate(), DebugBreakInlineListener); + SetDebugEventListener(env->GetIsolate(), DebugBreakInlineListener); v8::Local break_here = CompileFunction(&env, "function break_here(){}", "break_here"); @@ -6159,7 +6139,7 @@ TEST(PrecompiledFunction) { v8::String::Utf8Value utf8(result); CHECK_EQ(0, strcmp("bar", *utf8)); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); } @@ -6171,15 +6151,14 @@ static void DebugBreakStackTraceListener( static void AddDebugBreak(const v8::FunctionCallbackInfo& args) { - v8::Debug::DebugBreak(args.GetIsolate()); + v8::debug::DebugBreak(args.GetIsolate()); } TEST(DebugBreakStackTrace) { DebugLocalContext env; v8::HandleScope scope(env->GetIsolate()); - v8::Debug::SetDebugEventListener(env->GetIsolate(), - DebugBreakStackTraceListener); + SetDebugEventListener(env->GetIsolate(), DebugBreakStackTraceListener); v8::Local context = env.context(); v8::Local add_debug_break_template = v8::FunctionTemplate::New(env->GetIsolate(), AddDebugBreak); @@ -6234,11 +6213,11 @@ TEST(DebugBreakOffThreadTerminate) { DebugLocalContext env; v8::Isolate* isolate = env->GetIsolate(); v8::HandleScope scope(isolate); - v8::Debug::SetDebugEventListener(isolate, DebugBreakTriggerTerminate); + SetDebugEventListener(isolate, DebugBreakTriggerTerminate); TerminationThread terminator(isolate); terminator.Start(); v8::TryCatch try_catch(env->GetIsolate()); - v8::Debug::DebugBreak(isolate); + v8::debug::DebugBreak(isolate); CompileRun("while (true);"); CHECK(try_catch.HasTerminated()); } @@ -6263,7 +6242,7 @@ TEST(DebugPromiseInterceptedByTryCatch) { DebugLocalContext env; v8::Isolate* isolate = env->GetIsolate(); v8::HandleScope scope(isolate); - v8::Debug::SetDebugEventListener(isolate, &DebugEventExpectNoException); + SetDebugEventListener(isolate, &DebugEventExpectNoException); v8::Local context = env.context(); ChangeBreakOnException(false, true); @@ -6302,7 +6281,7 @@ TEST(DebugPromiseRejectedByCallback) { DebugLocalContext env; v8::Isolate* isolate = env->GetIsolate(); v8::HandleScope scope(isolate); - v8::Debug::SetDebugEventListener(isolate, &DebugEventCountException); + SetDebugEventListener(isolate, &DebugEventCountException); v8::Local context = env.context(); ChangeBreakOnException(false, true); exception_event_counter = 0; @@ -6363,7 +6342,7 @@ TEST(DebugBreakInLexicalScopes) { DebugLocalContext env; v8::Isolate* isolate = env->GetIsolate(); v8::HandleScope scope(isolate); - v8::Debug::SetDebugEventListener(isolate, DebugHarmonyScopingListener); + SetDebugEventListener(isolate, DebugHarmonyScopingListener); CompileRun( "'use strict'; \n" @@ -6400,7 +6379,7 @@ static void NoInterruptsOnDebugEvent( TEST(NoInterruptsInDebugListener) { DebugLocalContext env; - v8::Debug::SetDebugEventListener(env->GetIsolate(), NoInterruptsOnDebugEvent); + SetDebugEventListener(env->GetIsolate(), NoInterruptsOnDebugEvent); CompileRun("void(0);"); } @@ -6459,8 +6438,9 @@ TEST(DisableTailCallElimination) { DebugLocalContext env; v8::Isolate* isolate = env->GetIsolate(); + i::Isolate* i_isolate = reinterpret_cast(isolate); v8::HandleScope scope(isolate); - CHECK(v8::Debug::IsTailCallEliminationEnabled(isolate)); + CHECK(i_isolate->is_tail_call_elimination_enabled()); CompileRun( "'use strict'; \n" @@ -6497,12 +6477,12 @@ TEST(DisableTailCallElimination) { ""); ExpectInt32("h();", 2); ExpectInt32("h(); %OptimizeFunctionOnNextCall(g); h();", 2); - v8::Debug::SetTailCallEliminationEnabled(isolate, false); - CHECK(!v8::Debug::IsTailCallEliminationEnabled(isolate)); + i_isolate->SetTailCallEliminationEnabled(false); + CHECK(!i_isolate->is_tail_call_elimination_enabled()); ExpectInt32("h();", 1); ExpectInt32("h(); %OptimizeFunctionOnNextCall(g); h();", 1); - v8::Debug::SetTailCallEliminationEnabled(isolate, true); - CHECK(v8::Debug::IsTailCallEliminationEnabled(isolate)); + i_isolate->SetTailCallEliminationEnabled(true); + CHECK(i_isolate->is_tail_call_elimination_enabled()); ExpectInt32("h();", 2); ExpectInt32("h(); %OptimizeFunctionOnNextCall(g); h();", 2); } @@ -6517,8 +6497,9 @@ TEST(DebugStepNextTailCallEliminiation) { DebugLocalContext env; env.ExposeDebug(); v8::Isolate* isolate = env->GetIsolate(); + i::Isolate* i_isolate = reinterpret_cast(isolate); v8::HandleScope scope(isolate); - CHECK(v8::Debug::IsTailCallEliminationEnabled(isolate)); + CHECK(i_isolate->is_tail_call_elimination_enabled()); const char* source = "'use strict'; \n" @@ -6554,7 +6535,7 @@ TEST(DebugStepNextTailCallEliminiation) { ExpectNull("exception"); ExpectString("JSON.stringify(log)", "[\"a4\",\"b2\",\"c4\",\"c11\",\"d0\"]"); - v8::Debug::SetTailCallEliminationEnabled(isolate, false); + i_isolate->SetTailCallEliminationEnabled(false); CompileRun( "log = []; \n" "Debug.setListener(listener); \n" @@ -6582,8 +6563,8 @@ TEST(DebugStepOverFunctionWithCaughtException) { DebugLocalContext env; v8::Isolate* isolate = env->GetIsolate(); v8::HandleScope scope(isolate); - v8::Debug::SetDebugEventListener( - isolate, DebugStepOverFunctionWithCaughtExceptionListener); + SetDebugEventListener(isolate, + DebugStepOverFunctionWithCaughtExceptionListener); break_point_hit_count = 0; CompileRun( @@ -6594,7 +6575,7 @@ TEST(DebugStepOverFunctionWithCaughtException) { "foo();\n" "foo();\n"); - v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); + SetDebugEventListener(env->GetIsolate(), nullptr); CHECK_EQ(4, break_point_hit_count); } diff --git a/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc b/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc index 78e949b0853dd8..0a34b404f732a4 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc @@ -54,7 +54,7 @@ void CheckLocationsFail(WasmCompiledModule *compiled_module, CHECK(!success); } -class BreakHandler { +class BreakHandler : public debug::DebugDelegate { public: enum Action { Continue = StepAction::LastStepAction + 1, @@ -72,18 +72,13 @@ class BreakHandler { explicit BreakHandler(Isolate* isolate, std::initializer_list expected_breaks) : isolate_(isolate), expected_breaks_(expected_breaks) { - current_handler = this; - v8::Debug::SetDebugEventListener(reinterpret_cast(isolate), - DebugEventListener); + v8::debug::SetDebugDelegate(reinterpret_cast(isolate_), this); } ~BreakHandler() { // Check that all expected breakpoints have been hit. CHECK_EQ(count_, expected_breaks_.size()); - // BreakHandlers must be correctly stacked. - CHECK_EQ(this, current_handler); - current_handler = nullptr; - v8::Debug::SetDebugEventListener(reinterpret_cast(isolate_), - nullptr); + v8::debug::SetDebugDelegate(reinterpret_cast(isolate_), + nullptr); } int count() const { return count_; } @@ -93,9 +88,9 @@ class BreakHandler { int count_ = 0; std::vector expected_breaks_; - static BreakHandler* current_handler; - - void HandleBreak() { + void BreakProgramRequested(v8::Local paused_context, + v8::Local exec_state, + v8::Local break_points_hit) override { printf("Break #%d\n", count_); CHECK_GT(expected_breaks_.size(), count_); @@ -118,18 +113,8 @@ class BreakHandler { } ++count_; } - - static void DebugEventListener(const v8::Debug::EventDetails& event_details) { - if (event_details.GetEvent() != v8::DebugEvent::Break) return; - - CHECK_NOT_NULL(current_handler); - current_handler->HandleBreak(); - } }; -// static -BreakHandler* BreakHandler::current_handler = nullptr; - Handle MakeFakeBreakpoint(Isolate* isolate, int position) { Handle obj = isolate->factory()->NewJSObject(isolate->object_function());