Commit 88116e99 authored by kozyatinskiy's avatar kozyatinskiy Committed by Commit bot

[inspector] don't enter to debugger context for PromiseEventOccurred

Inspector doesn't use debugger context and this entering only slow down our async instrumentation.

BUG=v8:6189
R=yangguo@chromium.org

Review-Url: https://codereview.chromium.org/2816373004
Cr-Commit-Position: refs/heads/master@{#44665}
parent c8c03c15
......@@ -169,8 +169,7 @@ MaybeLocal<UnboundScript> CompileInspectorScript(Isolate* isolate,
class DebugDelegate {
public:
virtual ~DebugDelegate() {}
virtual void PromiseEventOccurred(v8::Local<v8::Context> context,
debug::PromiseDebugActionType type, int id,
virtual void PromiseEventOccurred(debug::PromiseDebugActionType type, int id,
int parent_id, bool created_by_user) {}
virtual void ScriptCompiled(v8::Local<Script> script,
bool has_compile_error) {}
......
......@@ -2044,9 +2044,6 @@ void Debug::OnAsyncTaskEvent(debug::PromiseDebugActionType type, int id,
if (in_debug_scope() || ignore_events()) return;
if (!debug_delegate_) return;
SuppressDebug while_processing(this);
DebugScope debug_scope(isolate_->debug());
if (debug_scope.failed()) return;
HandleScope scope(isolate_);
PostponeInterruptsScope no_interrupts(isolate_);
DisableBreak no_recursive_break(this);
bool created_by_user = false;
......@@ -2058,9 +2055,7 @@ void Debug::OnAsyncTaskEvent(debug::PromiseDebugActionType type, int id,
!it.done() &&
!IsFrameBlackboxed(it.frame());
}
debug_delegate_->PromiseEventOccurred(
Utils::ToLocal(debug_scope.GetContext()), type, id, parent_id,
created_by_user);
debug_delegate_->PromiseEventOccurred(type, id, parent_id, created_by_user);
}
void Debug::ProcessCompileEvent(v8::DebugEvent event, Handle<Script> script) {
......@@ -2346,8 +2341,11 @@ bool Debug::PerformSideEffectCheckForCallback(Address function) {
}
void LegacyDebugDelegate::PromiseEventOccurred(
v8::Local<v8::Context> context, v8::debug::PromiseDebugActionType type,
int id, int parent_id, bool created_by_user) {
v8::debug::PromiseDebugActionType type, int id, int parent_id,
bool created_by_user) {
DebugScope debug_scope(isolate_->debug());
if (debug_scope.failed()) return;
HandleScope scope(isolate_);
Handle<Object> event_data;
if (isolate_->debug()->MakeAsyncTaskEvent(type, id).ToHandle(&event_data)) {
ProcessDebugEvent(v8::AsyncTaskEvent, Handle<JSObject>::cast(event_data));
......
......@@ -616,8 +616,7 @@ class Debug {
class LegacyDebugDelegate : public v8::debug::DebugDelegate {
public:
explicit LegacyDebugDelegate(Isolate* isolate) : isolate_(isolate) {}
void PromiseEventOccurred(v8::Local<v8::Context> context,
v8::debug::PromiseDebugActionType type, int id,
void PromiseEventOccurred(v8::debug::PromiseDebugActionType type, int id,
int parent_id, bool created_by_user) override;
void ScriptCompiled(v8::Local<v8::debug::Script> script,
bool has_compile_error) override;
......
......@@ -640,8 +640,7 @@ bool V8Debugger::IsFunctionBlackboxed(v8::Local<v8::debug::Script> script,
end);
}
void V8Debugger::PromiseEventOccurred(v8::Local<v8::Context> context,
v8::debug::PromiseDebugActionType type,
void V8Debugger::PromiseEventOccurred(v8::debug::PromiseDebugActionType type,
int id, int parentId,
bool createdByUser) {
// Async task events from Promises are given misaligned pointers to prevent
......@@ -652,10 +651,7 @@ void V8Debugger::PromiseEventOccurred(v8::Local<v8::Context> context,
switch (type) {
case v8::debug::kDebugPromiseCreated:
asyncTaskCreatedForStack(task, parentTask);
if (createdByUser && parentTask) {
v8::Context::Scope contextScope(context);
asyncTaskCandidateForStepping(task);
}
if (createdByUser && parentTask) asyncTaskCandidateForStepping(task);
break;
case v8::debug::kDebugEnqueueAsyncFunction:
asyncTaskScheduledForStack("async function", task, true);
......
......@@ -147,8 +147,7 @@ class V8Debugger : public v8::debug::DebugDelegate {
void registerAsyncTaskIfNeeded(void* task);
// v8::debug::DebugEventListener implementation.
void PromiseEventOccurred(v8::Local<v8::Context> context,
v8::debug::PromiseDebugActionType type, int id,
void PromiseEventOccurred(v8::debug::PromiseDebugActionType type, int id,
int parentId, bool createdByUser) override;
void ScriptCompiled(v8::Local<v8::debug::Script> script,
bool has_compile_error) override;
......
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