Commit 1a6dae80 authored by jgruber's avatar jgruber Committed by Commit bot

[debug] Partial reland of debug API deprecation

This relands API deprecation (without removing the implementation),
removal of NewFunction and BeforeCompile events, and removal of
DebugCommandProcessor tests.

The remaining portion of the original CLs can be relanded after the 4.7
branch point.

Original CLs:

https://codereview.chromium.org/2524323002
https://codereview.chromium.org/2531543002

BUG=v8:5510

Review-Url: https://codereview.chromium.org/2546473008
Cr-Commit-Position: refs/heads/master@{#41446}
parent 5529430d
......@@ -16,11 +16,9 @@ namespace v8 {
enum DebugEvent {
Break = 1,
Exception = 2,
NewFunction = 3,
BeforeCompile = 4,
AfterCompile = 5,
CompileError = 6,
AsyncTaskEvent = 7,
AfterCompile = 3,
CompileError = 4,
AsyncTaskEvent = 5,
};
class V8_EXPORT Debug {
......@@ -144,7 +142,7 @@ class V8_EXPORT Debug {
*
* \param message the debug message handler message object
*
* A MessageHandler2 does not take possession of the message data,
* A MessageHandler does not take possession of the message data,
* and must not rely on the data persisting after the handler returns.
*/
typedef void (*MessageHandler)(const Message& message);
......@@ -166,7 +164,8 @@ class V8_EXPORT Debug {
static void CancelDebugBreak(Isolate* isolate);
// Check if a debugger break is scheduled in the given isolate.
static bool CheckDebugBreak(Isolate* isolate);
V8_DEPRECATED("No longer supported",
static bool CheckDebugBreak(Isolate* isolate));
// Message based interface. The message protocol is JSON.
V8_DEPRECATED("No longer supported",
......@@ -204,8 +203,9 @@ class V8_EXPORT Debug {
/**
* Returns a mirror object for the given object.
*/
V8_DEPRECATED("No longer supported",
static MaybeLocal<Value> GetMirror(Local<Context> context,
v8::Local<v8::Value> obj);
v8::Local<v8::Value> obj));
/**
* Makes V8 process all pending debug messages.
......@@ -254,7 +254,9 @@ class V8_EXPORT Debug {
* While in the debug context, this method returns the top-most non-debug
* context, if it exists.
*/
static MaybeLocal<Context> GetDebuggedContext(Isolate* isolate);
V8_DEPRECATED(
"No longer supported",
static MaybeLocal<Context> GetDebuggedContext(Isolate* isolate));
/**
* Enable/disable LiveEdit functionality for the given Isolate
......
......@@ -962,8 +962,6 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
FixedArray* array = isolate->native_context()->embedder_data();
script->set_context_data(array->get(v8::Context::kDebugIdIndex));
isolate->debug()->OnBeforeCompile(script);
Handle<SharedFunctionInfo> result;
{ VMState<COMPILER> state(info->isolate());
......
......@@ -1777,9 +1777,6 @@ void Debug::OnCompileError(Handle<Script> script) {
ProcessCompileEvent(v8::CompileError, script);
}
void Debug::OnBeforeCompile(Handle<Script> script) {
ProcessCompileEvent(v8::BeforeCompile, script);
}
// Handle debugger actions when a new script is compiled.
void Debug::OnAfterCompile(Handle<Script> script) {
......@@ -1934,8 +1931,6 @@ void Debug::NotifyMessageHandler(v8::DebugEvent event,
case v8::Break:
sendEventMessage = !auto_continue;
break;
case v8::NewFunction:
case v8::BeforeCompile:
case v8::CompileError:
case v8::AsyncTaskEvent:
break;
......
......@@ -406,7 +406,6 @@ class Debug {
void OnThrow(Handle<Object> exception);
void OnPromiseReject(Handle<Object> promise, Handle<Object> value);
void OnCompileError(Handle<Script> script);
void OnBeforeCompile(Handle<Script> script);
void OnAfterCompile(Handle<Script> script);
void OnAsyncTaskEvent(Handle<String> type, Handle<Object> id,
Handle<String> name);
......
......@@ -43,11 +43,9 @@ var sourceLineBeginningSkip = /^(?:\s*(?:\/\*.*?\*\/)*)*/;
// from the API include file debug.h.
Debug.DebugEvent = { Break: 1,
Exception: 2,
NewFunction: 3,
BeforeCompile: 4,
AfterCompile: 5,
CompileError: 6,
AsyncTaskEvent: 7 };
AfterCompile: 3,
CompileError: 4,
AsyncTaskEvent: 5 };
// Types of exceptions that can be broken upon.
Debug.ExceptionBreak = { Caught : 0,
......
......@@ -559,7 +559,7 @@ void V8Debugger::handleV8DebugEvent(
v8::DebugEvent event = eventDetails.GetEvent();
if (event != v8::AsyncTaskEvent && event != v8::Break &&
event != v8::Exception && event != v8::AfterCompile &&
event != v8::BeforeCompile && event != v8::CompileError)
event != v8::CompileError)
return;
v8::Local<v8::Context> eventContext = eventDetails.GetEventContext();
......
......@@ -4125,7 +4125,6 @@ TEST(DebugBreak) {
// Set the debug break flag.
v8::Debug::DebugBreak(env->GetIsolate());
CHECK(v8::Debug::CheckDebugBreak(env->GetIsolate()));
// Call all functions with different argument count.
break_point_hit_count = 0;
......@@ -4161,9 +4160,7 @@ TEST(DisableBreak) {
// Set, test and cancel debug break.
v8::Debug::DebugBreak(env->GetIsolate());
CHECK(v8::Debug::CheckDebugBreak(env->GetIsolate()));
v8::Debug::CancelDebugBreak(env->GetIsolate());
CHECK(!v8::Debug::CheckDebugBreak(env->GetIsolate()));
// Set the debug break flag.
v8::Debug::DebugBreak(env->GetIsolate());
......@@ -5262,7 +5259,7 @@ TEST(ContextData) {
}
// Two times compile event and two times break event.
CHECK_GT(event_listener_hit_count, 4);
CHECK_GT(event_listener_hit_count, 3);
v8::Debug::SetDebugEventListener(isolate, nullptr);
CheckDebuggerUnloaded(isolate);
......@@ -5684,29 +5681,6 @@ TEST(NoDebugBreakInAfterCompileEventListener) {
CheckDebuggerUnloaded(env->GetIsolate());
}
TEST(GetMirror) {
DebugLocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
v8::Local<v8::Context> context = env.context();
v8::Local<v8::Value> obj =
v8::Debug::GetMirror(context, v8_str(isolate, "hodja")).ToLocalChecked();
v8::ScriptCompiler::Source source(
v8_str("function runTest(mirror) {"
" return mirror.isString() && (mirror.length() == 5);"
"}"
""
"runTest;"));
v8::Local<v8::Function> run_test = v8::Local<v8::Function>::Cast(
v8::ScriptCompiler::CompileUnboundScript(isolate, &source)
.ToLocalChecked()
->BindToCurrentContext()
->Run(context)
.ToLocalChecked());
v8::Local<v8::Value> result =
run_test->Call(context, env->Global(), 1, &obj).ToLocalChecked();
CHECK(result->IsTrue());
}
// Test that the debug break flag works with function.apply.
TEST(DebugBreakFunctionApply) {
......@@ -5846,41 +5820,6 @@ TEST(NoDebugContextWhenDebuggerDisabled) {
CHECK(context.IsEmpty());
}
static void DebugEventCheckContext(
const v8::Debug::EventDetails& event_details) {
if (event_details.GetEvent() == v8::Break) {
v8::Isolate* isolate = event_details.GetIsolate();
CHECK(v8::Debug::GetDebuggedContext(isolate)
.ToLocalChecked()
->Global()
->Equals(isolate->GetCurrentContext(),
event_details.GetEventContext()->Global())
.FromJust());
}
}
static void CheckContext(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(v8::Debug::GetDebuggedContext(args.GetIsolate()).IsEmpty());
}
TEST(DebuggedContext) {
DebugLocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::Debug::SetDebugEventListener(isolate, DebugEventCheckContext);
v8::Local<v8::Function> foo =
CompileFunction(&env, "function foo(){bar=0;}", "foo");
SetBreakPoint(foo, 0);
foo->Call(env.context(), env->Global(), 0, nullptr).ToLocalChecked();
v8::Local<v8::Function> fun = v8::FunctionTemplate::New(isolate, CheckContext)
->GetFunction(env.context())
.ToLocalChecked();
fun->Call(env.context(), env->Global(), 0, nullptr).ToLocalChecked();
}
static v8::Local<v8::Value> expected_callback_data;
static void DebugEventContextChecker(const v8::Debug::EventDetails& details) {
CHECK(details.GetEventContext() == expected_context);
......
......@@ -30,11 +30,8 @@ class DebugWrapper {
// Debug events which can occur in the V8 JavaScript engine.
this.DebugEvent = { Break: 1,
Exception: 2,
NewFunction: 3,
BeforeCompile: 4,
AfterCompile: 5,
CompileError: 6,
AsyncTaskEvent: 7
AfterCompile: 3,
CompileError: 4,
};
// The different types of steps.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment