Commit d5ada19c authored by yangguo's avatar yangguo Committed by Commit bot

[debug] mark more unused debug API as deprecated.

R=jgruber@chromium.org
BUG=v8:5510

Review-Url: https://codereview.chromium.org/2531543002
Cr-Commit-Position: refs/heads/master@{#41283}
parent abf4c01d
......@@ -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 {
......@@ -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.
*/
static MaybeLocal<Value> GetMirror(Local<Context> context,
v8::Local<v8::Value> obj);
V8_DEPRECATED("No longer supported",
static MaybeLocal<Value> GetMirror(Local<Context> context,
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
......
......@@ -8756,22 +8756,8 @@ MaybeLocal<Value> Debug::Call(Local<Context> context,
MaybeLocal<Value> Debug::GetMirror(Local<Context> context,
v8::Local<v8::Value> obj) {
PREPARE_FOR_EXECUTION(context, Debug, GetMirror, Value);
i::Debug* isolate_debug = isolate->debug();
has_pending_exception = !isolate_debug->Load();
RETURN_ON_FAILED_EXECUTION(Value);
i::Handle<i::JSObject> debug(isolate_debug->debug_context()->global_object());
auto name = isolate->factory()->NewStringFromStaticChars("MakeMirror");
auto fun_obj = i::JSReceiver::GetProperty(debug, name).ToHandleChecked();
auto v8_fun = Utils::CallableToLocal(i::Handle<i::JSFunction>::cast(fun_obj));
const int kArgc = 1;
v8::Local<v8::Value> argv[kArgc] = {obj};
Local<Value> result;
has_pending_exception =
!v8_fun->Call(context, Utils::ToLocal(debug), kArgc, argv)
.ToLocal(&result);
RETURN_ON_FAILED_EXECUTION(Value);
RETURN_ESCAPED(result);
UNIMPLEMENTED();
return MaybeLocal<Value>();
}
void Debug::ProcessDebugMessages(Isolate* isolate) { UNIMPLEMENTED(); }
......@@ -8784,12 +8770,8 @@ Local<Context> Debug::GetDebugContext(Isolate* isolate) {
MaybeLocal<Context> Debug::GetDebuggedContext(Isolate* isolate) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
ENTER_V8(i_isolate);
if (!i_isolate->debug()->in_debug_scope()) return MaybeLocal<Context>();
i::Handle<i::Object> calling = i_isolate->GetCallingNativeContext();
if (calling.is_null()) return MaybeLocal<Context>();
return Utils::ToLocal(i::Handle<i::Context>::cast(calling));
UNIMPLEMENTED();
return MaybeLocal<Context>();
}
void Debug::SetLiveEditEnabled(Isolate* isolate, bool enable) {
......
......@@ -974,8 +974,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());
......
......@@ -1773,11 +1773,6 @@ void Debug::OnCompileError(Handle<Script> 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) {
ProcessCompileEvent(v8::AfterCompile, script);
......
......@@ -304,7 +304,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);
......@@ -5685,31 +5682,6 @@ TEST(NoDebugBreakInAfterCompileEventListener) {
}
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) {
DebugLocalContext env;
......@@ -5848,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);
......
......@@ -31,11 +31,9 @@ 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,
AsyncTaskEvent: 5
};
// 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