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